Design of two-dimensional carbon-nitride structures by tuning the nitrogen concentration

Nitrogen-doped graphene (NG) has attracted increasing attention because its properties are significantly different to pristine graphene, making it useful for various applications in physics, chemistry, biology, and materials science. However, the NGs that can currently be fabricated using most experimental methods always have low N concentrations and a mixture of N dopants, which limits the desirable physical and chemical properties. In this work, first principles calculations combined with the local particle-swarm optimization algorithm method were applied to explore possible stable structures of 2D carbon nitrides (C1−xNx) with various C/N ratios. It is predicted that C1−xNx structures with low N-doping concentration contain both graphitic and pyridinic N based on their calculated formation energies, which explains the experimentally observed coexistence of graphitic and pyridinic N in NG. However, pyridinic N is predominant in C1−xNx when the N concentration is above 0.25. In addition, C1−xNx structures with low N-doping concentration were found to have considerably lower formation energies than those with a high N concentration, which means synthesized NGs with low N-doping concentration are favorable. Moreover, we found the restrictions of mixed doping and low N concentration can be circumvented by using different C and N feedstocks, and by growing NG at lower temperatures.


INTRODUCTION
Due to its high carrier mobility of more than 1.5 × 10 4 cm 2 V −1 s −1 at room temperature, graphene is a promising material for future high-speed transistors 1 . However, graphene field-effect transistors cannot be turned off effectively because they do not have a bandgap 2 . Heteroatom doping provides a promising approach to tune and control the electronic properties of graphene, in the same way that it is applied in electronics using silicon materials [3][4][5] . N atoms have similar atomic radii and electronegativity to C atoms, and thus are widely used to dope graphene. Compared with C, N has an additional electron and can hence be used as an electron donor, allowing graphene to be transformed into an ntype semiconductor and have an increased carrier density 6 . Therefore, N-doped graphenes (NGs) are expected to be preferable to graphene for many applications in electronic devices.
Unfortunately, doping graphene with N atoms in a controllable manner is difficult. Firstly, the doping concentration of N in graphene is usually very low (Supplementary Table 1). Although various methods such as chemical vapor deposition 7 , thermal annealing 8 , pyrolysis 9 , arc discharge 10 , hydrothermal synthesis 11 , and plasma treatment 12 have been widely applied for the N doping of graphene, none of these methods can yield NG with an N concentration higher than 0.2, except for the carbon-nitride materials synthesized from specific aromatic hydrocarbon molecules. Such a low doping concentration greatly limits the control of the carrier concentration in NG. The second challenge for NG fabrication is preventing the doping of N as a mixture of graphitic, pyridinic, and pyrrolic N configurations, resulting in stronger scattering of the carriers during their transport and thus greatly reducing carrier mobility. To prepare NG with a desirable N configuration and concentration, it is essential to understand the conditions that promote the low doping concentration of N, as well as mixed doping types. Several studies have been undertaken to understand the formation of NG. Xiang et al. found that the effective nearest-neighbor interaction between N dopants is highly repulsive because of the strong electrostatic repulsion between N atoms, and this explains why complete nitrogen-carbon phase separation does not occur in NG 13 . Shi et al. have studied the N-doping limitations of NG and found that the largest achievable graphitic N-doping concentration in NG is 0.333-0.375 14 . Feng et al. further investigated the most stable structures of two-dimensional (2D) NG with higher N concentration and found that the 2D NGs can be stabilized at high N concentration although structures with lower N concentration are energetically more favorable 15 . Until now, the inherent reason for the observed doping concentration and type of N in NG has been unclear, despite previous reports.
In this work, we systematically studied the stable structures of carbon nitride with different C/N ratios (C 1−x N x , 0 < x < 1), based on the particle-swarm optimization (PSO) algorithm 16 and density functional theory (DFT) calculations. It is found that C 1−x N x structures with lower N concentrations (or small x values) exhibit lower formation energies and thus are more thermodynamically stable with reference to the chemical potentials of C in graphene and N in N 2 . In addition, we found that graphitic N and pyridinic N in 2D C 1−x N x structures have comparable formation energies at low N-doping concentrations. This explains current experimental observations that 2D carbon nitride films consistently exhibit lower doping concentrations in which graphitic and pyridinic Ndoping coexist. With the increase of doping concentration, 2D C 1−x N x structures become dominated by pyridinic N due to a significant increase in repulsive interactions between graphitic N atoms, which leads to transformation from a composition with mixed graphitic and pyridinic N to porous structures with only pyridinic N. Further, we found that the concentration of N in C 1 −x N x can be regulated by adjusting the feedstock used in the fabrication because this changes the chemical potential of the C or N. By appropriately modulating the chemical potential of the C and N atoms or decreasing the growth temperature, C 1−x N x with high N concentration can be obtained. 2D C 1−x N x structures with different N concentrations have unique electronic properties and are expected to have applications in many fields.

RESULTS AND DISCUSSION
Effect of N type and concentration on C 1−x N x stability Generally, there are three bonding configurations that appear in the NG lattice. As described by Wang et al. 17 : (1) a graphitic N atom is an N atom that replaces a C atom in the graphene lattice and bonds with three other adjacent C atoms in the hexagonal ring; (2) a pyridinic N bonds with two C atoms at the edges or defects of graphene and contributes one p electron to the π system; and (3) a pyrrolic N contributes two p electrons to the π system, though this is not restricted to a five-membered ring, as in pyrrole. Comparing these nitrogen types, pyridinic N and graphitic N are sp 2 hybridized and pyrrolic N is sp 3 hybridized. To determine the probability of producing different N configurations in NG, we calculated their formation energy per N atom. Firstly, we define the total formation energy of the structure, E f (C 1−x N x ; Gr, N 2 ) as where E C1Àx Nx is the free energy of C 1−x N x , μ CðGrÞ is the chemical potential of C in perfect graphene and μ NðN2Þ is the chemical potential of N in N 2 (for details see Supplementary Note 1). In general, this is dependent on the temperature and partial pressure of N 2 , but we consider the system at 0 K first. Figure 1 shows the calculated values of E f ðC 1Àx N x ; Gr; N 2 Þ for various values of x at 0 K. In each structure, the doping percentage of N is limited to less than 1 at% (x < 0.01) to minimize the interactions between the neighboring N dopants. Figure 1 shows that graphitic and pyridinic N in a hexagonal pore have much lower formation energies (~3 eV per N atom) than the pyrrolic pore (~1 eV per N atom). The lower formation energies indicate that graphitic and pyridinic N have higher probability of forming (based on thermodynamic considerations), therefore only graphitic and pyridinic N in a hexagonal pore (pyri-N-3) were considered in the following NG structural search. Graphitic N-N pairs in NG are reported to be unfavorable due to the strong electrostatic repulsion between N atoms 13 . This effect also prevents complete nitrogen-carbon phase separation and leads to the formation of carbon-nitride materials. To search for the most stable structures of graphitic NG (C 1−x N x ) in various N concentration ranges, we calculated the nearest-neighbor interaction between N dopants. A 12 × 12 supercell of graphene is used to calculate the interaction between two graphitic N atoms in the results presented below. Larger supercell sizes were found to give similar results. As shown in the inset of Fig. 2a, the honeycomb lattice of graphene can be considered to consist of two interpenetrating triangular sublattices: sublattice A and sublattice B. We consider the interaction between an N atom at an arbitrarily chosen site (labeled as 0A) and those at other sites that have different interaction distances to the 0A N atom. The pair-interaction energy (E p ) between N atoms is calculated by Eq.
(1), where each C 1−x N x structure contains only two N atoms. The calculated values of E p for N atoms within an interaction range of 6.5 Å are plotted in Fig. 2a and shown as a function of the N-N distance. It can be seen that E p increases with the shortening of the N-N distance, especially when the distance is less than 3 Å (or 0A-3B in Fig. 2a). Two local minima, the 0A-3B and 0A-7B pairs, were identified in the calculated energy curve, which is consistent with a previous report which also found these two local minima 13 .
Since there is no N-C phase separation in NG, it seems likely that we can construct C 1−x N x superstructures with uniform distributions of N dopants. Figure 2b shows the calculated formation energies of the most stable structures of C 1−x N x 2D materials with different N/C ratios. These structures and the values of the formation energies are shown in Supplementary Fig. 1. Figure 2b clearly shows that the formation energies of the C 1−x N x materials increase with N concentration. The most stable structure of each C 1−x N x (x < 0.25) is mainly composed of 0A-3B and 0A-7B N-N pairs that have low pair interaction energies ( Supplementary  Fig. 2), demonstrating that the N-N pair interaction plays an important role in determining the structures of 25, the formation energies increase dramatically with the N concentration because of the short distance and hence strong repulsion of the N-N pairs. C 1−x N x structures composed of pyridinic N are also considered in our calculations since pyridinic N has a similar formation energy to that of graphitic N at low doping concentration (Fig. 1). Unlike graphitic N-dopants, which preserve the honeycomb structure of graphene, doping of pyridinic N in graphene leads to porous C 1−x N x structures where each edge of the pore is composed of N atoms. Figure 3a shows the formation energies of pyridinic N in hexagonal pores. To test for a pore-size effect, the number of N atoms at the edge is increased from 1 to 4. It is clear that the formation energy of pyridinic N increases with pore size, demonstrating that it is more energetically favorable to have pyridinic N in small pores. Using the smallest hexagonal pore as a building block, we can construct C 1−x N x superstructures with a uniform distribution of hexagonal pores. As shown in Fig. 3b, a series of superstructures with different pore densities are constructed by reducing the distance between the pores. This also leads to an increase in the N concentration. From the calculated energy curve of Fig. 3b, we can clearly see that the formation energies of the porous structures increase with N concentration. This prevents the formation of large pores and produces graphite materials with pyridinic N structures that have uniformly spaced small pores. It should be noted that only C 1−x N x structures with N concentrations up to 0.5 are considered, since the structures with higher N concentration involve both pyridinic and graphitic N and will be discussed later.
To understand the formation probability of observing graphitic and pyridinic N in NG, we compared the formation energies of the most stable C 1−x N x structures with graphitic or pyridinic N. The N concentration of the C 1−x N x structures was varied from 0 to 0.5. The local PSO algorithm was used to search all the stable structures of 2D C 1−x N x (Supplementary Fig. 4). It is worth noting that the structure search for hexagonal pyridinic N with very low N-doping concentration requires large lattice parameters, which is not easily achievable using PSO algorithm searching. Therefore, all the pyridinic N structures with low N concentration were constructed manually and optimized using DFT calculations ( Supplementary Fig. 5). Figure 4a and b show the formation energies and the most stable structures with graphitic N or pyridinic N in hexagonal pores. It shows that graphitic N and pyridinic N have formation energies that are within~0.1 eV atom −1 at very low N-doping concentrations (<0.08, which is shown as Region-I in Fig. 4a). When the doping concentration of N increases (Region-II shown in Fig. 4a), the pyridinic NG becomes more energetically favorable than graphitic NG. This means the increased N-doping concentration can increase the formation probability of pyridinic N. When the N concentration is higher than 0.25 (Region-III shown in Fig. 4a), the energy difference between graphitic and pyridinic N becomes much larger (>0.1 eV atom −1 ), which means the C 1−x N x structures with high N concentration predominantly contain pyridinic N. Interestingly, further calculations demonstrate that the coexistence of pyridinic and graphitic N in 2D C 1−x N x decreases the formation energies of these structures ( Supplementary Figs. 6 and 7). In particular, we found that g-C 3 N 4 (x = 0.57), which consists of pyridinic and graphitic N ( Supplementary Fig. 8), has lower formation energy than CN (x = 0.50) which is composed of pyridinic N only, demonstrating that co-doping of pyridinic and graphitic N in 2D C 1−x N x is beneficial to the energetic stability of the structure. This is consistent with a b numerous previous experimental observations that show pyridinic and graphitic N coexist in NG with low doping concentrations 7,18,19 (Supplementary Table 1), and particularly with the stability of experimentally synthesized g-C 3 N 4 , which contains both graphitic and pyridinic N 18 . Figure 4a also demonstrates that formation of NG with low doping concentration is more thermodynamically favorable than those with high doping concentrations, and this is consistent with the fact that the experimentally synthesized NGs typically have very low N-doping concentrations 19 .
Of all the structures considered, C 3 N (x = 0.25 for graphitic N structures) demonstrate enhanced stability because their formation energies are the local minimum of the energy curves. The enhanced stability of C 3 N composed of graphitic N can be attributed to the existence of 0A-3B N-N pairs, which we have demonstrated to be stable ( Supplementary Fig. 2), and the high symmetry of the structure 13 . It should be noted that the graphitic N-doped C 3 N (x = 0.25) has already been synthesized and characterized in recent experiments 20,21 . Experimentally, pyrrolic N has also been widely observed in NG as a defect. To compare with experiments, we also considered the effect of pyrrolic N on the formation energy of NG structures. It is found that the existence of a small concentration of pyrrolic N in NG greatly increases the formation energy of the 2D C 1−x N x structures. (Supplementary Figs. 6 and 7). The addition of pyrrolic N into the NG structures containing only pyridinic N or both pyridinic and graphitic N leads to an increase of the formation energy. This demonstrates that pyrrolic N is not energetically favorable in NG, and the experimentally observed pyrrolic N in NG may be attributed to the formation of pyrrolic N at the edges of the structures. Moreover, we studied the formation of pyrrolic N in the experimentally synthesized C 2 N (Supplementary Fig. 9) and g-C 3 N 4 ( Supplementary Fig. 10). Similarly to the 2D C 1−x N x structures discussed above, the formation energies of both C 2 N and g-C 3 N 4 increase with addition of pyrrolic N defects. Considering systems with the same proportion of pyrrolic N defects, but in different positions, C 2 N (or g-C 3 N 4 ) with large distances between the defects leads to a lower formation energy of the structure. (Supplementary Figs. 9 and 10). Furthermore, for g-C 3 N 4 with high defect concentrations of pyrrolic N, the strain introduced by addition of the defects is so high that it causes the C-N bond to break in the calculations, and this reduces the formation energy of the system (Supplementary Fig. 10).
Regulation of the structure of C 1−x N x The calculations of formation energies above are with reference to μ C(Gr) for C in graphene and μ NðN2Þ for N in N 2 at 0 K. Since the chemical potential of C and N will vary with temperature, partial pressure of the feedstock and the type of feedstock, the formation free energies can be tuned by changing these parameters 22,23 . A general expression for the formation energy is given by Eq. (S20) of Supplementary Note 1. Figure 5a and b show how the formation free energies of NG change with change in μ C and μ N due to change in the feedstock, at fixed temperature and pressure. Figure 5a shows the results obtained when μ C is fixed at the chemical potential of a C atom in graphene at 0 K and μ N is increased from 0 to 1.0 eV. In this case, the formation energies of the C 1−x N x structures decrease, and the effect is greatest when the structures have high N concentrations as the formation energy is dependent on x (Eq. (1)). This means that C 1−x N x structures with high N concentration become more energetically favorable than those with low N concentration when the chemical potential changes by about 0.5 eV. However, if μ N is kept constant at the chemical potential of an N atom in N 2 and μ C is increased (Fig. 5b), the formation energies of C 1−x N x structures decrease, but structures with low N concentrations have a more substantial reduction in energy. Therefore, C 1−x N x structures with low Ndoping concentration become much more energetically favorable than structures with high N-doping concentration, which finally leads to the production of C 1−x N x materials with a higher percentage of graphitic N. To increase the proportion of C 1−x N x materials with higher concentrations of N, a feedstock with a lower value of μ C than graphene would need to be selected.
In experiments, the chemical potential of C and N atom in different feedstocks (defined in Eqs. (S2) and (S3) of Supplementary Information) can be calculated at different temperatures and pressures. The chemical potential of C in C m H n (m and n are integers), μ CðCmHnÞ , is given by where G is the free energy, T is the temperature, P X is the partial pressure of X, P 0 = 0.1 MPa is the standard pressure, Δ f G 0 X ðTÞ is free energy of formation of X at standard pressure, and Δ T G X ðTÞ G X ðTÞ À G X ð0Þ, (see Supplementary Information).
Similarly, μ NðN k H l Þ is given by The differences in chemical potential of C and N in the feedstock and that in graphene or nitrogen at 0 K can be defined as Δμ CðCmHnÞ ðT; PÞ μ CðCmHnÞ ðT; PÞ À μ CðGrÞ ð0Þ; (4) Δμ NðNk Hl Þ ðT; PÞ μ NðNk Hl Þ ðT; PÞ À μ NðN2Þ ð0Þ; respectively, and values 0 K for a number of feedstocks are given in Supplementary Table 2. Using these definitions, the free energy for the formation of C 1−x N x at temperature of T, and pressure of P, from C m H n and N k H l , E f (C 1−x N x ; C m H n , N k H l , T, P), can be expressed where we assume that the thermal contribution to the free energy of carbon in graphene equals the thermal contribution to the free energy of C 1−x N x (details can be found in Supplementary  Information).
Based on the calculated Δμ C and Δμ N in different feedstocks with typical experimental temperatures and pressures (Supplementary Table 3, T = 1300 K, P 0 = 0.1 MPa, P H2 ¼ P feedstock ¼ 10 À6 MPa), the formation energies of C 1−x N x can be calculated. Figure 5c shows the effect of different N feedstocks, when CH 4 is used as the C feedstock. The N feedstocks considered are N 2 , NH 3 , and N 2 H 4 . It is clear that N 2 favors the formation of C 1−x N x with low N concentration, whereas N 2 H 4 enhances the formation probability of C 1−x N x with high N concentration. Figure 5d shows the effect of different C feedstocks, when NH 3 is used as the N b e f c d a Fig. 5 Structure regulation of C 1−x N x . a The effect of the chemical potential of nitrogen (μ N ) on the formation energy of C 1−x N x . b The effect of the chemical potential of carbon (μ C ) on the formation energy of C 1−x N x . c The effect of nitrogen feedstock on the formation energy of C 1−x N x . CH 4 is used as the carbon feedstock, N 2 , NH 3 , and N 2 H 4 are considered as the nitrogen feedstocks. d The effect of carbon feedstock on the formation energy of C 1−x N x ; NH 3 is used as the nitrogen feedstock, CH 4 , C 2 H 4 , and C 2 H 2 are considered as carbon feedstocks. e Effect of temperature on the formation energy of C 1−x N x . Results for temperatures from 500 to 1300 K are presented; f The effect of pressure on the formation energy of C 1−x N x . Results for different ratios of pressures of C feedstock to H 2 pressures and ratios of pressures of N feedstocks to H 2 pressures are presented.
feedstock. The C feedstocks considered are CH 4 , C 2 H 4 , and C 2 H 2 .
We can see that use of C 2 H 2 makes the free energy curve flatter than with CH 4 or C 2 H 4 . This means the formation of C 1−x N x with high N concentration and pyridinic N is more likely in this case. These predictions are consistent with previous experimental observations. For example, Wei et al. found that using CH 4 and NH 3 as the feedstock, the synthesized NGs have both pyridinic and graphitic N 24 , while Luo et al. observed the synthesized NGs were composed purely of pyridinic N by changing the feedstock to C 2 H 4 and NH 3 25 . Equations (2) and (3) demonstrate that the growth temperature can also be used to tune the structures of C 1−x N x by changing the chemical potential of C and N. This is demonstrated in Fig. 5e where the effect of temperature on a system with CH 4 and NH 3 feedstock and typical experimental pressures is shown. Higher temperatures lead to the production of C 1−x N x with an increased percentage of graphitic N and decreased N-doping concentration. This has been observed in a previous research where the percentage of graphitic N increases with the temperature, and the N concentration of the NG decreases with the temperature 26,27 . For example, Zhang et al. and Guo et al. synthesized NG with high N concentration and quite precise doping at low temperatures, and they found the samples contain abundant pyridinic N 28,29 . The pressure also has significant effect on the formation energies of the C 1−x N x structures. Compared with the case where the partial pressures of H 2 , C and N feedstocks are fixed as 10 −5 bar (black line + circle in Fig. 5f), decreasing the pressure ratio of C feedstock and H 2 (P C =P H2 = 0.1, blue line + triangular in Fig. 5f) results in smaller slope of the line, which means the formation of C 1−x N x structures with high N-doping concentration and more pyridinic N. However, increasing the pressure ratio of C feedstock and H 2 (P C =P H2 P CmHn =P H2 ¼ 10, blue line + pentagon in Fig. 5f)) promotes the formation of C 1−x N x structures with low N-doping concentration and more graphitic N. In contrast, decreasing the pressure ratio of N feedstock and H 2 ( P N =P H2 P N k H l =P H2 ¼ 0:1, red line + rectangular in Fig. 5f) favors the formation of C 1−x N x structures with low N-doping concentration and more graphitic N, while increasing the pressure ratio of N feedstock and H 2 (P N =P H2 ¼ 10, red line + star in Fig. 5f) favors the formation of C 1−x N x structure with high N-doping concentration and more pyridinic N.
Electronic properties of C 1−x N x The structure of 2D C 1−x N x has important effect on its properties. The electronic properties of graphitic NG and pyridinic NG were studied by both Perdew-Burke-Ernzerhof (PBE) and HSE06 calculations. For 2D C 1−x N x structures with graphitic N, most structures are metallic except C 12 N and C 3 N, which are semiconductors with medium band gaps ( Supplementary Fig.  11). The 2D C 1−x N x structures with pyridinic N, C 12 N, C 8 N, C 6 N, and C 10 N 3 have the special graphene-like Dirac cone band structures, while the other structures are semiconductors with a direct bandgap ( Supplementary Fig. 12). To obtain more accurate bandgaps for the C 1−x N x structures, the HSE06 functional was used to calculate the bandgaps of C 12 N, C 3 N, C 2 N, and CN, of which C 3 N and C 2 N have been synthesized experimentally. Table 1 shows the calculated bandgaps for these materials together with the experimental results. The results of the HSE06 calculations indicate that C 3 N (x = 0.25) composed of graphitic N has a bandgap of 1.22 eV. Experimentally, the measured bandgaps of C 3 N are highly dependent on the flake size of the materials. When the size of C 3 N quantum dots (QDs) varies from 1.8 to 5.5 nm, the bandgap changes from 2.74 to 1.57 eV 20,21 . The calculated bandgap of C 2 N (x = 0.33), which is composed of pyridinic N, is 2.46 eV, and the experimentally measured bandgaps are between 1.69 and 2.8 eV when the size of C 2 N QDs changes from 3.8 to 4.8 nm 30,31 . The HSE06 calculations demonstrate that C 12 N (x = 0.08) composed of graphitic N has a bandgap of 0.99 eV and CN (x = 0.50) composed of pyridinic N has a bandgap of 3.46 eV (Table 1 and Supplementary Fig. 13).
In addition, we found the carrier mobilities, μ 2D , of structures composed of graphitic N (e.g., C 3 N) are much higher than the structures composed of pyridinic N (e.g., C 2 N), (see Supplementary Note 2, Table 2, and Supplementary Fig. 14). These studies demonstrate that controlling the structure of C 1−x N x is an important way to obtain carbon-nitride materials with desired properties.
In conclusion, by comparing the formation energies of graphitic and pyridinic N under different N concentrations, we found that graphitic and pyridinic N have similar formation energies in structures with low N-doping concentration. However, increasing the N-doping concentration leads to a high probability of formation of C 1−x N x composed of purely pyridinic N. The low Ndoping concentration of graphene in previous experiments can be attributed to the low formation energies of NG with low N concentration. Our theoretical calculations demonstrate that the doping concentration can be tuned by choosing the feedstock and growth temperature and pressure.

Structure searching
The structures of C 1−x N x for various values of x were predicted using the local PSO algorithm, as implemented in the crystal structure analysis by particle swarm optimization software 16 . Structure prediction was for a fixed cell of C 1−x N x with no more than 30 atoms and the population size is set to 30. For each step of the searching simulation, 80% of the predicted structures passed to the next step the other 20% of the structures were randomly generated. The structural searching simulations for each system were stopped after~35 generations (1050 generated structures). Based on the PSO search results, ten to fifteen different structures of each C 1−x N x Table 1. The calculated bandgap of C 12 N (x = 0.08), C 3 N (x = 0.25), C 2 N (x = 0.33), and CN (x = 0.50).  , m* is the effective mass, E l is the deformation potential constant and μ 2D is the carrier mobility.
were selected for further structural relaxation using DFT calculations as implemented in Vienna ab initio simulation package 32,33 .

First-principles calculations
For the DFT calculations, the projector-augmented-wave method was used to mimic the ionic cores 34,35 . The generalized gradient approximation (GGA) with the PBE exchange-correlation function was used with the plane-wave cutoff energy set at 400 eV for all calculations 36 . The bandgaps of the C 1−x N x structures were obtained using the nonlocal hybrid functional (HSE) 37 , where the percentage (known as the mixing parameter α) of the semilocal GGA exchange potential was replaced by screened Fock exchange 36 . The space between the C 1−x N x layers was set to be at least 15 Å to eliminate the interaction between the layers. The geometries of the structures were relaxed until the force on each atom was less than 0.01 eV Å −1 , and the energy convergence criterion of 1 × 10 −5 eV was met. The Brillouin zone was represented by a Monkhorst-Pack special k-point mesh (details are given in Supplementary Note 3) for the geometry optimization of C 1−x N x structures 38 .