  We construct a fast, transferable, general purpose, machine-learning
interatomic potential suitable for large-scale simulations of $N_2$. The
potential is trained only on high quality quantum chemical molecule-molecule
interactions, no condensed phase information is used. The potential reproduces
the experimental phase diagram including the melt curve and the molecular solid
phases of nitrogen up to 10 GPa. This demonstrates that many-molecule
interactions are unnecessary to explain the condensed phases of $N_2$. With
increased pressure, transitions are observed from cubic ($\alpha-N_2$), which
optimises quadrupole-quadrupole interactions, through tetragonal ($\gamma-N_2$)
which allows more efficient packing, through to monoclinic ($\lambda-N_2$)
which packs still more efficiently. On heating, we obtain the hcp 3D rotor
phase ($\beta-N_2$) and, at pressure, the cubic $\delta-N_2$ phase which
contains both 3D and 2D rotors, tetragonal $\delta^\star-N_2$ phase with 2D
rotors and the rhombohedral $\epsilon-N_2$. Molecular dynamics demonstrates
where these phases are indeed rotors, rather than frustrated order. The model
does not support the existence of the wide range of bondlengths reported for
the complex $\iota-N_2$ phase. The thermodynamic transitions involve both
shifts of molecular centres and rotations of molecules. We simulate these phase
transitions between finding that the onset of rotation is rapid whereas motion
of molecular centres is inhibited and the cause of the observed sluggishness of
transitions. Routine density functional theory calculations give a similar
picture to the potential.
