a Comparison of the formation energy per atom for pyridinic nitrogen atoms in the porous C1−xNx structures with different hexagonal pore sizes (N = 1–4). The atoms in blue are nitrogen atoms, those in gray are carbon atoms. b The formation energies per atom for periodic pore structures at various concentrations of nitrogen. In both figures, the values are calculated for a temperature of 0 K. Additional structures are shown in Supplementary Fig. 3.