We construct a fast, transferable, general purpose, machine-learning interatomic potential suitable for large-scale simulations of N2. The potential is trained only on high quality quantum chemical molecule-molecule interactions; no condensed phase information is used. Although there are no explicit or implicit many-molecule interaction terms, the potential reproduces the experimental phase diagram including the melt curve and the molecular solid phases of nitrogen up to 10GPa. This demonstrates that many-molecule interactions are unnecessary to explain the condensed phases of N2. With increased pressure, transitions are observed from cubic (α), which optimizes quadrupole-quadrupole interactions, through tetragonal (γ), which allows more efficient packing, to monoclinic (λ), which packs still more efficiently. On heating, we obtain the hcp three-dimensional (3D) rotor phase (β) and, at pressure, the cubic δ phase which contains both 3D and 2D rotors, tetragonal δ* phase with 2D rotors, and the rhombohedral ε. Molecular dynamics demonstrates where these phases are indeed rotors, rather than frustrated order. The model supports the metastability of the complex ι phase, but not the reported existence of the wide range of bond lengths. The thermodynamic transitions involve both shifts of molecular centers and rotations of molecules: the onset of rotation is rapid, whereas motion of molecular centers is inhibited and we suggest that this is the cause of the experimentally observed sluggishness of transitions. Routine density functional theory calculations give a similar picture to the potential. Published by the American Physical Society 2024