Graphite and diamond have comparable free energies, yet forming diamond from
graphite is far from easy. In the absence of a catalyst, pressures that are
significantly higher than the equilibrium coexistence pressures are required to
induce the graphite-to-diamond transition. Furthermore, the formation of the
metastable hexagonal polymorph of diamond instead of the more stable cubic
diamond is favored at lower temperatures. The concerted mechanism suggested in
previous theoretical studies cannot explain these phenomena. Using an ab initio
quality neural-network potential we performed a large-scale study of the
graphite-to-diamond transition assuming that it occurs via nucleation. The
nucleation mechanism accounts for the observed phenomenology and reveals its
microscopic origins. We demonstrated that the large lattice distortions that
accompany the formation of the diamond nuclei inhibit the phase transition at
low pressure and direct it towards the hexagonal diamond phase at higher
pressure. The nucleation mechanism proposed in this work is an important step
towards a better understanding of structural transformations in a wide range of
complex systems such as amorphous carbon and carbon nanomaterials