  The transformation pathway in high-pressure solid nitrogen from N$_2$
molecular state to polymeric cg-N phase was investigated by means of \textit{ab
initio} molecular dynamics and metadynamics simulations. In our study, we
observed a transformation mechanism starting from molecular $Immm$ phase that
initiated with formation of $trans$-$cis$ chains. These chains further
connected within layers and formed a chain-planar state, which we describe as a
mixture of two crystalline structures - $trans$-$cis$ chain phase and $planar$
phase, both with $Pnma$ symmetry. This mixed state appeared in molecular
dynamics performed at 120 GPa and 1500 K and in the metadynamics run at 110 GPa
and 1500 K, where the chains continued to reorganize further and eventually
formed cg-N. During separate simulations, we also found two new phases -
molecular $P2_1/c$ and two-three-coordinated chain-like $Cm$. The
transformation mechanism heading towards cg-N can be characterized as a
progressive polymerization process passing through several intermediate states
of variously connected $trans$-$cis$ chains. In the final stage of the
transformation chains in the layered form rearrange collectively and develop
new intraplanar as well as interplanar bonds leading to the geometry of cg-N.
Chains with alternating $trans$ and $cis$ conformation were found to be the key
entity - structural pattern governing the dynamics of the simulated
molecular-polymeric transformation in compressed nitrogen.
