Introduction

Gastric cancer (GC) is one of the most common cancers worldwide, ranking fourth in incidence and second as the leading cause of cancer-related deaths worldwide1. Over the past several decades many improvements have been made towards timely diagnosis however, GC is often diagnosed at an advanced stage when the prognosis becomes challenging1. Annually, GC results in 1.1 million new cases and 770,000 deaths, with projections indicating a rise to approximately 1.8 million new cases and 1.3 million deaths by 20402.

The routine diagnostic methods for GC, including gastroscopy and tissue biopsy, are highly invasive and inconvenient for patients1. Breathomics (breath analysis/diagnosis) is a rapidly emerging area in diagnosis science and is greatly used to diagnose patients suffering from a variety of diseases including cancer. It is well known that explicit volatile organic compounds (VOCs) are produced in each type of cancer because of certain metabolic and biochemical progressions2. Novel pathology indicates that the detection of VOCs should be on the list of early diagnosis of several diseases. Besides, efficient detection of VOCs related to GC is not only a non-invasive method but also a cost-effective and proficient way for the timely diagnosis2,3,4,5,6.

Considerable research efforts have been focused on both identifying the fingerprints VOCs and developing biosensors with high sensitivity at the order of part per billion (ppb), and operation under ambient conditions. On the experimental side, Mochalski et al. used gas chromatography with mass spectrometric detection to identify VOCs associated with GC, such as carbon disulfide, pyridine, 3-methy-2-butanone and 2-pentanone7. Huang et al. used gas chromatography-mass spectrometry with tabular SERS sensor for the detection of eight VOCs, including butanone, methylglyoxal, n-hexanal, n-decanal, cyclohexanone, n-pentanal, n-octanal, and benzaldehyde, with descending order of relevance to GC8. Perfecto et al. reported a nanocomposite of ZnO hollow spheres with NiS nanosheets to detect the butanone with high selectivity in a humid environment9. Another study by Hong et al. used mass spectrometry to identify seven GC-related VOCs, such as acetone, isoprene, 1,3-dioxolan-2-one, phenol, meta-xylene, 1,2,3-trimethylbenzene, and Phenyl acetate10. Very recently, Mochalski et al. presented a more rigorous experimental study on the detection of five VOCs, namely pyridine, ethyl acetate, acetoin, 2,3-butanedione, and 3-methyl-1-butanol, associated with GC11. On the computational side, Bac et al. performed ab -initio calculations for the detection of butanone using graphene monolayer12. Furthermore, Bhuvaneswari et al. used first-principles calculations for the selective detection of butanone and 2-pentanone on β-Tellurene monolayer13.

A revolutionary change in materials science occurred in 2004 by Novoselov and Geim14 in their successful synthesis of a 2D monolayer of graphene using the exfoliation of graphite. The invention not only granted them the Nobel Prize in physics in the year 2010 but also paved the way for the birth of a new world of 2D materials enriched with exciting inventions and discoveries15. Many novel fascinating 2D materials (e.g., transition metal dichalcogenides “TMD”16,17, MXenes18,19, and porous carbon nitrides20,21,22) have been successfully synthesized. Single atom catalysis (SAC) has proven as a powerful method in tuning the properties of 2D materials towards specific applications, such as electro-catalysis in energy conversion23,24,25,26,27,28,29, gas sensing30,31,32, energy storage33,34,35,36, and biosensor applications37,38,39,40.

The idea of exploring selective detection of VOCs was explored in many recent investigations. For instance, recently, the detection of VOCs related to lung cancer was explored using functionalized Ti3C2Tx MXenes (Tx = O, F, S, and OH)41. The adsorption properties of six VOCs were studied versus those of the interfering air molecules (N2, O2, CO2 and H2O). The Ti3C2O2 MXenes yielded the optimal adsorption selectivity toward the VOCs. Although all the molecules exhibited physisorption-type interactions with the MXenes, the VOCs’ adsorption energies were much stronger than those of the interfering air molecules. The strong physisorption coupling was attributed to the enhanced van der Waals (vdW) interactions between the VOCs and the polar surface of Ti3C2O2 MXene41. The contrast between the VOCs and air molecules is that the polar surface of MXene can induce many electric dipole moments in many localities in the VOCs and, consequently, stronger vdW interactions get triggered. When the vdW interactions become strong enough, they can affect the states at the Fermi level of the substrate to the extent of affecting the transport properties and enhancing the sensor response41,42.

Recently synthesized, porous carbon nitrides22 emerged as novel 2D materials with great potential to stably embed transition/light metal atoms in relatively big pores to pave the way for promising hydrogen storage, VOCs’ detection, and battery applications. Calculating the cohesive energy, Cai et al.22 corroborated the experimental stability of many synthesized structures as well as predicted many others to be possible for future synthesis. The authors also demonstrated the relevance of C3N2 as a suitable anode material for lithium-ion battery application22. Another study led by Kang43 reported a successful fabrication of carbon-nitride nanoribbon (CNR) composed of 4-5-6-8 membered rings. Subsequently, Mortazavi et al.44 performed DFT simulations on the same CNR structure in pristine and N-doped forms using HSE06 hybrid functional and reported a direct bandgap energy of 1.25 eV. Of course, the embedment of TM atoms in the pores should metallize the structure as it will be presented in this investigation and that would suit the biosensing applications.

Motivated by the above-mentioned features, we propose exploring TM-SAC embedment in pores of novel N-CNRs to assess the sensing properties of seven VOCs related to GC biomarkers, namely: (i) 2-pentanone “C5H10O”, (ii) butanone “C4H8O”, (iii) isoprene “C5H8”, (iv) methylglyoxal “C3H4O2”, (v) n-decanal “C10H20O”, (vi) n-pentanal “C5H10O”, and (vii) pyridine “C5H5N”. We assess the catalytic responses of embedding four TM-SAC atoms (Mn, Fe, Co, Ni) in N-CNRs for the selective detection of mentioned VOCs as compared to the interfering air molecules (N2, O2, H2O, CO2) to study the main factors controlling the sensor responses and consequently the selectivity. To the best of our knowledge, this is a pioneer computational work to explore the TM-SAC functionalization of the newly synthesized N-CNRs aiming at the selective detections of VOCs related to GC biomarkers. Toward this aim, we employ the state-of-the-art method, based upon the vdW-corrected spin-polarized DFT, as incorporated in the “Vienna Ab-initio Simulation Package” (VASP). We first demonstrate the stability of TM-SAC embedment in the pores of N-CNRs, then we calculate the spin-polarized bands, partial and total density of states (PDOS & TDOS), charge transfer using Bader charge analysis, and the work function. We will show that the metal doping of N-CNRs would lead to the metallization of N-CNRs and this should suit the biosensing applications. The selective adsorptions of VOCs are corroborated by the adsorption energy and change in electronic and magnetic properties as well as change in work function approaches. The TM-doped N-CNRs will be proven suitable for the detection of GC biomarkers.

Results and discussion

VOCs adsorption on pristine CNRs

The relaxed structure of N-CNRs, spin-polarized band structure and projected density of states are given in Fig. 1a–c, which clearly shows a paramagnetic semiconductor character with a bandgap energy \(\:{E}_{g}\) = 0.59 eV, which is consistent with the theoretical value of 0.59 eV reported by Mortazavi44 using the same GGA-PBE method. It is well known that GGA underestimates \(\:{E}_{g}\) and the inclusion of hybrid functional, such as HSE06, can yield the experimental value of 1.40 eV43. However, hybrid functional calculations are computationally expensive. The primitive cell has a lattice constant a = 16.190 Å, and a C-C-bond-length of 1.494 Å which are in good agreement with literature44.

For assessing the active site for the VOCs adsorption on N-CNRs, many positions were considered, as shown in Fig. 2, and the adsorption of nitrogen (N2) molecule was used for locating the suitable positions. The \(\:{E}_{ads}\:\)values on the considered sites are shown in Fig. 2; Table 1. Among all, a large pore (labelled “a” in Fig. 2) with N-CNRs yields the strongest \(\:{E}_{ads}\) value of -0.547 eV. Therefore, this site is considered for the adsorption of the VOCs and the interfering air molecules. Before adsorption, all the VOCs are relaxed and optimized structures are shown in Fig. S1 (supplementary information), which are consistent with literature7,8,9,10,11,12,13. Afterwards, atomic relaxations of the VOCs on the N-CNRs are performed by introducing each of the former on site “a” on the latter as shown in Fig. 3. Several possible interactions on N-CNRs with \(\:{E}_{ads}\) values are shown in Table 1 and displayed in Fig. 4. The \(\:{E}_{ads}\) values are on the weaker side, especially in comparison to the interfering air molecules, thus not suitable for practical sensing applications.

Fig. 1
figure 1

Pristine carbon nanoribbon C48N4: (a) Optimized atomic structure in primitive cell (top and side views). (b) Band structure. (c) Spin-polarized partial density of states (PDOS). The Fermi level is taken as a reference (\(\:{E}_{F}\) = 0).

Fig. 2
figure 2

Tested sites for active adsorption of N2 gas molecule on carbon nanoribbon C48N4 and their corresponding adsorption energies (\(\:{E}_{ads}\)).

Table 1 Adsorption energy (\({E}_{ads}\)), Magnetization (M) and the absolute value of change of magnetization (|ΔM|) for the seven VOCs, related to GC biomarkers, on pristine and TM-doped N-CNRs.

It is worth stating that appropriate adsorption of the incident species is critical for the enhanced sensitivity of any sensor. Thus, VOCs must adsorb on N-CNRs with \(\:{E}_{ads}\) values capable of altering the electronic and magnetic properties of the latter. At the same time, \(\:{E}_{ads}\) should not be so strong that the desorption of the VOCs is impossible and the nanosensor becomes irreversible. Ideally, the \(\:{E}_{ads}\) VOCs should be between strong physisorption and weak chemisorption. Considering this, selected TMs (Co, Fe, Mn, Ni) have been incorporated into N-CNRs for the adsorption of VOCs on TMs-N-CNRs.

Adsorption of VOCs on TM-doped N-CNRs

To obtain TM-doped N-CNRs, selected TMs (Co, Fe, Mn, Ni) are adsorbed on N-CNRs at different binding sites and the corresponding binding energies (\(\:{E}_{bind}\)) are calculated. We observe that regardless of any initial configuration, all the TMs stabilize in the big pore of N-CNRs with significantly strong \(\:{E}_{bind}\) values of -6.00, -5.217, -5.594, and − 5.916 eV for Co, Fe, Mn, and Ni, respectively (Fig. S2). Strong \(\:{E}_{bind}\) values confirm isolated dispersion of incident TMs over N-CNRs without clustering. Furthermore, the thermal stability of TMs-N-CNRs is confirmed through ab initio molecular dynamics (AIMD) simulations at 1000 K and the systems remained stable for 9 picoseconds. The relaxed structures of TMs-N-CNRs are shown in Fig. S3 (supplementary information). It is worth noting that the TMs doping induced magnetism and more importantly changed the character of TMs-N-CNRs from paramagnetic semiconductor to ferromagnetic metal, as displayed by the spin-polarized band structures and PDOS in Fig. S4 (supplementary information).

After obtaining the relaxed geometries, we introduce each of the VOCs on TM-doped N-CNRs and the systems are completely optimized until the global minimum energy is achieved. Figure 5; Table 1 show the calculated \(\:{E}_{ads}\) values for the seven VOCs on TM-doped N-CNRs. It clearly shows that TMs-N-CNRs enhanced \(\:{E}_{ads}\) to the limit to achieve selective adsorption of VOCs as compared to the interfering air molecules. Particularly, Fe-doped N-CNR (N-CNR: Fe) results in the strongest \(\:{E}_{ads}\) values of -0.802, -0.899, -1.566, -1.260, -1.482, -1.057, and − 0.674 eV for 2-pentanone, butanone, isoprene, methylglyoxal, N-decanal, N-pentanal, and pyridine, respectively.

Fig. 3
figure 3

Atomically relaxed structures of the seven VOCs, related to GC, on nitrogen functionalized CNRs: (a) 2-pentanone “C5H10O”, (b) Butanone “C4H8O”, (c) Isoprene “C5H8”, (d) Methylglyoxal “C3H4O2”, (e) N-decanal “C10H20O”, (f) N-pentanal “C5H10O”, (g) Pyridine “C5H5N”. Color code: C (brown), H (pink), O (red), N (green).

Fig. 4
figure 4

Adsorption energies of seven VOCs, related to GC biomarkers, on nitrogen functionalized CNRs (N-CNRs).

Fig. 5
figure 5

Adsorption energies of seven VOCs, related to GC, on pristine and TM-doped M@CNRs (with TM = Mn, Fe, Co, and Ni).

The Selectivity of the TM-doped N-CNRs based nano-sensor is studied by comparing the\(\:{\:E}_{ads}\) values of VOCs with those of interfering air molecules. For example, we find that the common molecules, H2O and N2 result in \(\:{E}_{ads}\) values of -0.613, and − 0.547 eV, respectively. Whereas all the VOCs yield stronger \(\:{E}_{ads}\) values on TM-doped N-CNRs. Particularly, isoprene, methylglyoxal, N-decanal, and N-pentanal yield much stronger adsorption character, which indicates their selective detection in the presence of interfering air molecules. These \(\:{E}_{ads}\) are promising and cause measurable changes in the electronic and magnetic properties of N-CNR: Fe, which is a prerequisite for an efficient sensing mechanism.

Band structures and density of states (DOS)

Based on the adsorption mechanism, four VOCs, namely, isoprene, methylglyoxal, N-decanal, and N-pentanal possess \(\:{E}_{ads}\) > 1.00 eV on N-CNR: Fe, as shown in Table 1. Therefore, we considered only these VOCs for further analysis. Nevertheless, the electronic structures, spin-polarized bands, partial density of states (PDOS), and relaxed configurations of all the seven VOCs on N-CNR: Fe are presented in Fig. 6. In the band structures, the bands of spin-down states are in solid orange lines while those of spin-up states are in dotted black curves.

Before the adsorption of the VOCs, the spin-polarized band structure and PDOS of N-CNR: Fe, presented in Fig. 6, clearly shows a half-metallicity, where spin-down states are semiconducting (\(\:{E}_{g}^{\downarrow\:}\) = 0.227 eV) and spin-up states are metallic (see Table 2). The near Fermi states look hybrid due to covalent character mixing between C(p) and Fe(d) states. After the VOCs adsorption the band structures of N-CNR: Fe exhibit some changes especially near the Fermi level. The common trends caused by VOCs adsorptions can be summarized as follows: (i) Half metallicity is maintained with spin-up states being semiconducting while spin-down being metallic (see Table 2), but the characters of contributing states have changed. (ii) Mainly the valence-band maximum (VBM) and the conduction-band minimum (CBM) states in the spin-up semiconducting states are attributed to carbon C(p) orbitals, while the metallic spin-down states are attributed to Fe(d) orbitals more than C(p) orbitals. Such characteristics should be attributed to the strong charge exchange between VOCs and N-CNR: Fe, where the former is playing the role of oxidizing molecules. Table 2 shows the charge exchange calculated by Bader charge analysis to be about Δq = -0.207 e, -0.447 e, -0.251 e and − 0.115 e for isoprene, methylglyoxal, N-decanal, and N-pentanol, respectively. (iii) The atomic structures shown in Fig. 6b, c, d, e display two chemisorption and two physisorption processes, respectively.

Table 2 Adsorption energy (\({E}_{ads}\)), adsorption distance (d), Bandgap energies of spin-up and spin-down states (\({E}_{g}^{spin-up}\) and \({E}_{g}^{spin-down}\)), charge transfer (Δq), and recovery time (τ) of the seven VOCs, related to GC, and interfering air molecules on Fe-doped carbon nanoribbon (N-CNRs:Fe).

It is important to explain the existence of half-metallicity in the N-CNR: Fe, which has a length of a = 16.190 Å and under a periodic boundary that is within the critical length for ferromagnetic interactions with the mirror images of the Fe dopants. Such ferromagnetic coupling (FMC) should be the reason for the half-metallicity. In our recent work on TMs embedded C2N, we estimated the critical length for the existence of FMC interactions to be about \(\:{L}_{c}\approx\:\) 21–29 Å45. The half metallicity in the case of Fe embedment in C2N big pore was observed in double atom catalyst (DAC) and was attributed to both FMC interactions with images of DAC through PBCs and the synergetic effects45. Another study46 reported half-metallicity in TM-doped transition metal dichalcogenides (TMDs) (MoX2, X = S, Se) monolayers. Specifically, half-metallicity existed in small-sized samples of (Mn, Fe, and Ni)-doped MoS2 and (V, Mn, Fe, and Co)-doped MoSe2 when the supercells were smaller than 6 × 6 primitive cells. Thus, the present findings of half-metallicity are in excellent agreement with literature45,46. It is worth mentioning that half-metallicity exists in N-CNR: Fe even after the adsorption of VOCs, therefore it should not be considered as a parameter of selectivity.

Charge density difference (CDD) and work function

Figure 7 illustrates the charge-density difference (CDD) before and after the adsorption of VOCs in N-CNR: Fe. The gain (deficit) in charge is indicated by yellow (cyan) color. The charge transfer is calculated using the Bader analysis and results are shown in Table 2. The atomic relaxations are associated with charge transfers from the N-CNR: Fe to VOCs. As Fe in N-CNR: Fe is contributing with major states at Fermi level, all the VOCs and interfering air molecules seem to act as oxidizing entities. Moreover, stronger adsorption is associated with the greater charge transfer from N-CNR: Fe to the VOCs. Amongst the four VOCs predicted to have the highest selectivity, methylglyoxal is distinguished having a chemisorption, forming a chemical bond with N-CNR: Fe (d = 1.89 Å) and resulting in the highest charge transfer (Δq = -0.447 e). Figure 8 displays the results of absolute values of \(\:{E}_{ads}\) and charge transfer of the studied VOCs and interfering air molecules on N-CNR: Fe.

Among all, isoprene, methylglyoxal, N-decanal, and N-pentanal show enhanced selectivity. Figure 9 displays the work functions (ϕ) of N-CNR: Fe before and after the adsorption of VOCs. With a clear distinction, the methylglyoxal results into the largest ϕ. This is consistent with the large charge transfer accumulated by methylglyoxal from N-CNR: Fe. It seems that the electrons build up a strong bond between methylglyoxal and the N-CNR: Fe and the effects on Fermi states should be the largest. Hence, such strong interaction would have the largest effect on transport properties and consequently the sensor response.

Fig. 6
figure 6

Atomically relaxed structures of seven VOCs, related to GC biomarkers, on N-CNR: Fe (Top and side views) and partial density of states (PDOS): (a) 2-pentanone “C5H10O”, (b) Butanone “C4H8O”, (c) Isoprene “C5H8”, (d) Methylglyoxal “C3H4O2”, (e) N-decanal “C10H20O”, (f) N-pentanal “C5H10O”, (g) Pyridine “C5H5N”. In band structures spin-up and spin-down states are shown in solid-orange and small-dashed black lines, respectively. In both bands and PDOS, the Fermi level is taken as an energy reference (EF = 0). Color code for atoms: C (brown), O (red), N (green), and H (pink).

Fig. 7
figure 7

Charge density difference (CDD) showing the bond characteristics of maximally localized Wannier functions (MLWFs) of the seven VOCs, related to GC biomarkers, on N-CNRs: Fe. Yellow and Cyan iso-surfaces indicate charge aggregation and depletion, respectively. The iso-surfaces level is 0.03 e/Bohr3.

Fig. 8
figure 8

Summary of absolute values of adsorption energies and charge transfers of seven VOCs, related to GC biomarkers, and interfering air molecules on N-CNR:Fe.

Fig. 9
figure 9

Work function (in eV units) before (horizontal dashed line) and after (histograms) the adsorption of seven VOCs, related to GC biomarkers, on N-CNR: Fe.

Half-metallicity, recovery time, and selectivity

The embedment of TMs on N-CNRs has induced several changes in the electronic and magnetic properties. After the doping, N-CNR: Fe transforms not only into ferromagnetic metallic but also with half-metallic characters. As elaborated above, the origins of the half-metallicity characters are attributed to the existence of FMC between the TMs and their mirror images45,46. Half-metallicity is a fundamental property required in spintronic device applications and it takes place when one spin state is metallic while the other is semiconducting (i.e., the electric current becomes spin-polarized). Table 2 shows \(\:{E}_{g}\) of spin-up and spin-down states before and after the adsorption of the VOCs and interfering air molecules on N-CNR: Fe. It seems that half metallicity is rebooted as being mainly controlled by FMC interactions. Before the adsorption of the VOCs, spin-up states in N-CNR: Fe are conductive while the spin-down states are semiconducting with an indirect \(\:{E}_{g}^{\downarrow\:}\) of 0.227 eV. After the adsorptions of VOCs and air molecules, N-CNR: Fe remains half-metallic and persists to maintain the spin-down metallic and spin-up is semiconducting with also an indirect \(\:{E}_{g}^{\uparrow\:}\) of 0.281–0.331 eV, as shown in Table 2. It appears that TM-doped N-CNRs induced magnetism (magnetization values are given in Table 1) rather than half-metallicity, however, both properties remain rebooted and do not get perturbed by the VOCs adsorption, especially in the TM-doped samples, which are used as adsorbent substrates. Notably, there are two VOCs (butanone and methylglyoxal) that can induce magnetizations of 1.02 µB and 2.12 µB into the pristine samples. Otherwise, all VOCs would not change the magnetic states of the doped sample and the half-metallicity characters are rebooted.

An important parameter for reversible sensing is the recovery time (\(\:\tau\:\)). Table 2 shows the recovery times for all the seven VOCs and four interfering molecules. It is evident from Eq. (5) that \(\:\tau\:\) mainly depends on \(\:{E}_{ads}\) values. Among the studied VOCs, isoprene, and methylglyoxal result in comparatively strong \(\:{E}_{ads}\) values of -1.566 and − 1.260 eV, respectively and the corresponding \(\:\tau\:\) values are significantly high. However, it is worth mentioning that \(\:\tau\:\) values are calculated under visible-light exposure and at room temperature (300 K). At elevated temperatures, \(\:\tau\:\) values could be significantly reduced to a reasonable range.

Conclusions

Spin-polarized DFT calculations were employed to study the adsorption properties of the seven VOCs related to GC versus four interfering air molecules (N2, O2, H2O, CO2) on a recently synthesized CNRs composed of 4-5-6-8-membered rings. The adsorptions of the VOCs on nitrogen functionalized CNRs, (N-CNRs) yielded weak \(\:{E}_{ads}\) values. To enhance the adsorption mechanism and selectivity, selected TMs (Co, Fe, Mn, Ni) were embedded in the central pore of N-CNRs to form N-CNRs: TM. It was observed that incorporations of all the TMs improved the adsorption mechanism, however N-CNR: Fe enhanced the \(\:{E}_{ads}\) values to -0.802, -0.899, -1.566, -1.260, -1.482, -1.057, and − 0.674 eV for 2-pentanone, butanone, isoprene, methylglyoxal, N-decanal, N-pentanal, and pyridine, respectively. Although N-CNR: Fe absorbed all the VOCs appropriately, enhanced selectivity was observed for isoprene, methylglyoxal, N-decanal, and N-pentanal. Suitable \(\:{E}_{ads}\) values coupled with measurable changes in the electronic and magnetic properties, which were calculated through band structures, the density of states, work function and charge transfer analysis, authenticated the potential of N-CNR: Fe as an efficient biosensor towards GC-related VOCs.

Computational method

We employed DFT as incorporated in the Vienna Ab-initio Simulation Package (VASP)47 to study the adsorption of seven VOCs related to GC, versus interfering air molecules (N2, O2, H2O, CO2) on CNRs, and TM-doped N-CNRs. It can be seen in Fig. 1a that N-CNR has a rectangular-lattice primitive cell. Vacuum spaces of 10 Å and 15 Å were inserted along y and z directions, respectively, to ensure the isolation from the mirror images produced by periodic boundary conditions. Linearized augmented plane wave (LAPW) was used as a basis set with an energy cut off 500 eV, while Perdew-Burke-Ernzerhof (PBE)48 was used to describe the exchange-correlation functional within the generalized gradient approximation (GGA). To describe the van der Waals interactions, we used Grimme’s DFT-D3 scheme49. In the Brillouin zone integration, we used the special-point technique of Monkhorst-Pack50, with k-point grids of 3 × 1 × 1 and 5 × 1 × 1 for atomic relaxation and density of states calculations, respectively. As convergence criteria, we used tolerances of 10−6 eV and 10 meV/Å for energy and forces, respectively. For charge transfer, Bader charge analysis used51 and charge-density difference (CDD) incorporated in VASP.

Based on total energy calculations, binding energy (\(\:{E}_{bind}\)) of embedment of TMs (Co, Fe, Mn, Ni) in N-CNRs was calculated by the following,

$$E_{{bind}} = E_{{TMs - N@CNRs}} - E_{{N@CNRs}} - E_{{TMs}}$$
(1)

where the first, second, and third terms represent the total energies of N-CNRs loaded with TMs, bare N-CNRs, and TMs, respectively.

The adsorption energy (\(\:{E}_{ads}\)) of the VOCs and interfering air molecules on TM-doped N-CNRs were calculated using the following formula:

$$E_{{ads}} = E_{{TMs - N@CNRs - gas}} - E_{{TMs - N@CNRs}} - E_{{gas}}$$
(2)

where first, second, and third terms represent total energies of TM-doped N-CNRs loaded with VOCs/air molecules, bare TM-doped N-CNRs and those of VOCs/air molecules, respectively.

The magnetization can be calculated using the results of spin-polarized TDOS as follows52.

$$M = \mu _{B} \int\limits_{{ - \infty }}^{{E_{F} }} {\left[ {G_{{tot}}^{ \uparrow } \left( E \right) + G_{{tot}}^{ \downarrow } \left( E \right)} \right]dE}$$
(3)

where \(\:{E}_{F}\) is Fermi energy, \(\:{G}_{tot}^{\uparrow\:}\left(E\right)\) and \(\:{G}_{tot}^{\downarrow\:}\left(E\right)\) are spin-polarized TDOS of spin-up and spin-down states, respectively, while \(\:{\mu\:}_{B}\) stands for Bohr’s magneton. It should be emphasized that it is customary to present \(\:{G}_{tot}^{\downarrow\:}\left(E\right)\) negative and the total density of states \(\:{{G}_{tot}\left(E\right)=G}_{tot}^{\uparrow\:}\left(E\right)-{G}_{tot}^{\downarrow\:}\left(E\right)\) to be normalized to yield the total number of valence electrons in the system (N):

$$N = \mathop \int \limits_{{ - \infty }}^{{E_{F} }} \left[ {G_{{tot}}^{ \uparrow } \left( E \right) - G_{{tot}}^{ \downarrow } \left( E \right)} \right]dE$$
(4)

For example, before the incorporation of the TM catalyst the C48N4H12 nanoribbon, comprised of 64 atoms, should contain a total of 224 electrons (48 C + 4 N + 12 H = 48 × 4 + 4 × 5 + 12 × 1 = 224 electrons). Within VASP, the pseudopotentials of the TM-SAC atoms describe the outer shells of electrons (e.g., Mn, Fe, Co, and Ni contain 3s53, 3dX, with X = 5, 6, 7, 8, respectively). So, the valence electrons of these respective TM-SAC atoms should be 7, 8, 9, and 10, respectively. Consequently, the total number of electrons in the system should be 231–234 electrons, respectively.

To assess whether the gas sensor should be reusable or disposable, it is important to calculate the recovery time. Within the framework of the conventional transition-state theory, recovery time can be expressed as follows54:

$$\tau = \upsilon _{o}^{{ - 1}} {\text{exp}}\left[ { - \frac{{E_{{ads}} }}{{k_{B} T}}} \right]$$
(5)

where \(\:{E}_{ads}\), \(\:{k}_{B}\) and T are the adsorption energy, Boltzmann constant (8.62 × 10−5 eV/K) and the absolute temperature, respectively. υ0 is the attempt frequency having values 1012 and 1016 Hz under visible and UV light situations, respectively55,56. In this investigation, we used the value υ0 = 1012 Hz to estimate the recovery time under exposure to visible light and in ambient conditions.