1 Introduction

Half-metallic (HM) ferromagnets [1, 2] have arisen significant interest in the field of spintronics because they have only one electron spin channel at the level of Fermi energy. This leads to 100% polarization of spin carriers [3]. Significant attention has been paid towards understanding the mechanism behind HM magnetism and their implication on various physical properties [4,5,6,7,8,9,10]. It is highly desirable to explore new ferromagnetic (FM) HM materials with simple structures that are compatible with III–V and II–VI semiconductors such as GaAs and similar compounds [11, 12]. Ab initio calculations on the NiMnSb compound of the half-Heusler family illustrated that the first half-metal properties can be predicted through band structure calculation [13]. Recently, using first-principle calculations, the structural stability and mechanical and electronic properties of the MgN compound in different phases have been reported by Benaissa et al. [14]. By considering the phonon dynamics of this compound, they showed that the MgN compound is dynamically stable and a HM ferromagnet in the NaCl and ZB phases.

The alkaline earths pnictides [15], carbides [16], and nitrides [17], which contain neither transition metals nor rare earth ions with HM character, exhibit a different mechanism of magnetism. This is related to the s and p atomic orbitals and not the d or f atomic orbitals. The ferromagnetic coupling mechanism in this class of materials is different from the double exchange and p-d exchange mechanism that are important in 3d magnetic compounds [18,19,20].

In recent years, a number of studies have been carried out on several binary alkaline earth metal nitrides and carbides [16, 21,22,23,24,25,26,27,28,29,30,31]. Alkaline earth metal carbides are interesting from a fundamental perspective due to their unusual and varied properties. In contrast to the alkaline earth metal nitrides, they have received comparatively little attention. However, these d0-type ferromagnetic materials, such as BaN [21,22,23,24,25,26] and BaC [16, 22, 27,28,29,30,31], are promising candidates as spintronic materials. A clear understanding of the mechanism and the universality behind d0 ferromagnetism is still unavailable. The magnetic and structural properties of IIA–V-type nitrides have been reported by Volnianska et al. [24]. Using density functional theory, the mechanical properties of CaN, SrN, and BaN compounds have been reported by Sharifzadeh et al. [25]. Using ab initio calculations, Sieberer et al. [26] studied the HM ferromagnetism in tetrahedrally coordinated compounds of the I/II–V elements. HM ferromagnetism in binary alkaline earth metal carbides (CaC, SrC, and BaC) under pressure have been studied using ab initio method by Dong and Zhao [27] for the NaCl phase. The HM sp-electron ferromagnets of the SrC and BaC compounds in the NaCl, CsCl, ZB, and NiAs phases were investigated by Gao et al. [28]. The magnetic stability of HM zinc blende CaC and similar compounds have been reported by Dong et al. [29] using first-principle and Monte Carlo calculations. Recently, using first-principle calculations, the effects of electron and hole doping on magnetic properties of SrC and BaC in the zinc-blende phase have been reported by Dong and Zhao [31]. The HM ferromagnetism in SrC, BaC, and MgC compounds was reported by Zhang and Yan [16] in the wurtzite phase.

Several studies have been carried out on the structural, electronic, and magnetic properties of the BaN and BaC compounds. However, little is known about the vibrational, mechanical, and thermodynamic properties of these compounds. Using first-principle calculations, the structural, electronic, and magnetic properties in different phases were evaluated for the BaN and BaC compounds. The mechanical stability and thermal properties were evaluated to provide a comprehensive understanding on the nature and behavior of these BaN and BaC compounds in various phases. Also, this study focused on the BaN and BaC compounds due to their potential as p-type magnetic systems. The computational method is described in Section 2. Results are presented and discussed in Section 3. The concluding remarks is summarized in Section 4.

2 Computational Method

Ab initio total energy calculations within the density functional theory (DFT) approach [32] were performed [33] using the full-potential linearized augmented plane wave plus local orbitals method with the WIEN2K package [34]. The exchange-correlation energy was described using the generalized gradient approximation (GGA) with the PBEsol prescription [35] and the modified Becke–Johnson approach (mBJ) [36]. The orbitals, charge density, and potential were expanded using spherical harmonics in the muffin-tin spheres. Plane waves were used in the description of the interstitial region.

The atomic electronic configurations used in this study are Ba: [Xe] 6s2, N: [He] 2s22p3, and C: [He] 2s22p2. The special k-points sampling of 11 × 11 × 11 for cubic (CsCl, NaCl, and ZB), 10 × 10 × 13 for tetragonal (P4/nmm), 14 × 14 × 7 for hexagonal NiAs, 13 × 13 × 7 for hexagonal WZ, and 9 × 10 × 14 for orthorhombic (Pnma) were used for the Brillouin zone (BZ) integration to determine converged energies and forces. The value of 9.0 for the RMT × KMAX was used for all the phases studied. The self-consistent calculations were converged up to 0.01 mRy. The muffin-tin (MT) radii of 2.45 bohr for Ba atom and 1.95 bohr for both C and N atoms were adopted. The total energy was minimized with respect to the electronic and spin configuration using the spin-polarized calculations. The total density of states (DOS) was obtained using the modified tetrahedron method [37] with a dense mesh of 12 × 16 × 24 for the Pnma phase and 17 × 17 × 17 k-points for the NaCl and ZB phases. The bulk modulus was determined by fitting the total energy versus volume using the Murnaghan [38] equation of states.

The mechanical properties of the BaN and BaC compounds in the Pnma, NaCl, ZB, and WZ phases were carried out using the supercell approach in the framework of Hellmann–Feynman theorem [39] as implemented in WIEN2K code [34]. This involves the evaluation of the forces due to the finite displacement of an atom from its equilibrium position. The PHONOPY package [40] was used to evaluate the phonon frequencies. To the best of our knowledge, no experimental data have been reported for the Pnma, NaCl, ZB, and WZ phases in the literature. In this study, the 2 × 2 × 2, 1 × 1 × 1, and 2 × 2 × 1 supercells for cubic (NaCl and ZB), Pnma, and WZ phases, respectively, were adopted with a displacement amplitude of 0.02 bohr. To avoid errors in the electronic and phonon density of state calculation, a dense mesh of 50 × 50 × 50 Monkhorst–Pack sampling set were used [41]. The mechanical properties including the elastic constants (Cij) and lattice dynamics (phonon spectrum) are of fundamental importance when considering the phase stability at a given pressure and temperature.

3 Results

3.1 Structural Properties

The total energy as a function of volume per formula unit in the seven phases (NaCl, CsCl, ZB, WZ, NiAs, P4/nmm, and Pnma) for the ferromagnetic (FM) and non-magnetic (NM) configurations are presented in Fig. 1. The ground state properties of the BaN and BaC compounds in different phases and two magnetic configurations (FM and NM) were obtained by fitting the calculated values with the Murnaghan equation of states [38]. The NaCl phase in the FM configuration was obtained as the most stable phase for the BaN compound, while the CsCl phase in the NM configuration was found to be the most stable structure for the BaC compound. In Tables 1 and 2, the lattice constants, bulk moduli, pressure derivative of the bulk moduli, cohesive energies, and energies of formation were presented. For all phases considered, the calculated lattice parameter of the BaN is smaller than that of the BaC compound, while the bulk modulus of the BaN is larger than that of the BaC compound. We found that the calculated value for the bulk modulus in the BaC compound is approximately 30% smaller than that obtained for the BaN compound. The lower value of the bulk modulus for the BaC compound when compared to the BaN compound is inconsistent with the bulk modulus decrease when the ionic radius of the anion increases [42]. Tables 1 and 2 also show that BaN has smaller lattice constant and larger bulk modulus than BaC, because nitrogen has one more valence electron than does carbon so that the p-d bonding strength in BaN is higher than that in BaC. Other theoretical calculations [43] agree well with this trend in other compounds, where the most obvious trend in the carbides and nitrides based transition elements is that the bulk modulus increases dramatically, as the number of valence electrons increases. This result may indicate that the additional electron of nitrogen with respect to carbon contribute in the bonding charge of the BaN and strengthen it.

Fig. 1
figure 1

a, b Total energies as functions of volume per formula unit for the non-magnetic (NM) (dashed lines) and ferromagnetic (FM) (solid lines) states of the BaN (left side) and BaC (right side) compounds using the GGA-PBEsol in the NaCl (B1), CsCl (B2), ZB (B3), WZ (B4), NiAs (B81), tetragonal (P4/nmm), and Pnma phases

Table 1 GGA-PBEsol calculations of the lattice parameters (a in Å, b/a, c/a), bulk moduli (B in GPa), their pressure derivatives (B′), optimized Wyckoff positions (x, z), cohesive energy (Ecoh in eV/atom), and (ΔH in eV/atom) of the non-magnetic (NM) and ferromagnetic (FM) states of BaN compound given in different phases (NaCl (B1), CsCl (B2), ZB (B3), WZ (B4), NiAs (B81), tetragonal (P4/nmm), and Pnma structures) and compared to other theoretical studies
Table 2 GGA-PBEsol calculations of the lattice parameters (a in Å, b/a, c/a), bulk moduli (B in GPa), their pressure derivatives (B′), optimized Wyckoff positions (x, z), and cohesive energy (Ecoh in eV/atom) and (ΔH in eV/atom) of the non-magnetic (NM) and ferromagnetic (FM) states of BaC compound given in different phases (NaCl (B1), CsCl (B2), ZB (B3), WZ (B4), NiAs (B81), tetragonal (P4/nmm), and Pnma structures) and compared to other theoretical studies

The LSDA approach is known to underestimate the lattice parameter and the GGA-PBE approach to overestimate it, whereas the GGA-PBEsol approach is better suited as shown in Tables 1 and 2. Our calculated structural properties using the GGA-PBEsol approach is approximately an average of the LSDA and GGA-PBE approaches reported in the literature. We compared the GGA-PBEsol data obtained in the current study to the theoretical results obtained by different methods, LSDA [21, 22] and GGA-PBE [21, 23,24,25,26] for the BaN compound and LSDA [22] and GGA-PBE [16, 27,28,29,30,31] for the BaC compound; the accuracy of the GGA-PBEsol approach is attributed to the fact that GGA-PBEsol approach was designed to correct the under binding of solids in the GGA-PBE approach [35]; however, for certain compounds, the difference varies from one function to another [44].

We evaluated the formation energy of the BaN and BaC compounds in different phases using the equation below [45,46,47]:

$$ \Delta {H}^{\mathrm{Ba}\mathrm{X}}={E}^{\mathrm{Ba}\mathrm{X}}-{E}^{\mathrm{Ba}}-{E}^{\mathrm{X}}, $$

where EBaX are the first-principle calculated equilibrium total energies of the BaX compounds, EBa and EX are the total energies of the bulk Ba and X per atom, respectively, at ambient pressure which we have evaluated using the bcc phase (Im-3m) for Ba, the hcp phase (P63/mmc) for carbon, and the γ phase (P42/mnm) for the ground state of solid nitrogen [48]. Negative value of formation energy gives an indication that the formation of the BaX compounds is favorable from their constituent elements, whereas positive formation energies imply that the formation is not energetically favorable.

The calculated formation energies for the various phases are reported in Tables 1 and 2 for the BaN and BaC compounds, respectively. The calculated formation energy for the BaN compound in the NaCl phase is − 0.10 eV/atom, which is comparable with that of − 0.55 eV and − 0.37 eV obtained by Yogeswari and Kalpana [22] using LSDA and Volnianska et al. [24] within the GGA approach, respectively. This negative formation energy means that NaCl phase of the BaN compound can be obtained under equilibrium conditions. For BaC compound in the NaCl phase, we obtained a positive value of 1.38 eV/atom, which is in agreement with LSDA calculations of Yogeswari and Kalpana [22].

The cohesive energy of the BaN and BaC compounds, which is the difference between the total energy per atom in the compound and the total energies of the free atoms. The cohesive energies of the BaX (X = N and C) compounds have been computed using the following relation [46, 49, 50]:

$$ {E}_{\mathrm{coh}}^{\mathrm{Ba}\mathrm{X}}=\frac{E_{\mathrm{tot}}^{\mathrm{Ba}\mathrm{X}}-Z\times \left({E}_{\mathrm{tot}}^{\mathrm{Ba}}+{E}_{\mathrm{tot}}^{\mathrm{X}}\right)}{Z}, $$

where Z is the number of the BaX formulas per unit cell, \( {E}_{\mathrm{tot}}^{\mathrm{BaX}} \) is the FM total energy of the BaX compound, and \( {E}_{\mathrm{tot}}^{\mathrm{Ba}} \) and \( {E}_{\mathrm{tot}}^{\mathrm{X}} \) are the energies of the atomic components. The calculated cohesive energies for the BaX (X = N and C) compounds are tabulated in Tables 1 and 2. These energies were found to be in the range 3.56–3.80 eV/atom (3.24–3.50 eV/atom) for the BaN (BaC) compound. The cohesive energy, which represents the amount of energy required to break the compound into isolated atoms, is an indicator of the bond strength. Using cohesive energy as a stability criterion, the NaCl and Pnma phases are the favored phases for these compounds. This is because the NaCl and Pnma phases have the highest values of the cohesive energy, which are 3.80 and 3.50 eV/atom for the BaN and BaC compounds, respectively. The NaCl phase of the BaN and BaC compounds, which is the lowest energy spin-polarized configuration after the Pnma phase, is further investigated along with ZB phase. However, the BaC compound in the CsCl phase is metallic and cannot be a candidate of the HM phase. Also, we found that the differences in cohesive energy among the considered phases for the BaX compounds are remarkably small. This is because the decrease in bond strength with increasing coordination number very nearly cancels the increase in the number of bonds, over a large range of coordination.

Table 3 showed the calculated total magnetic moment of the BaN and BaC compounds and the local magnetic moment of the X (X = N, C) atoms in different phases. All the phases of the BaN and BaC compounds are half-metallic, except for the BaC compound in the CsCl and tetragonal P4/nmm phases. We found that the BaC compound has the highest total magnetic moment of 2 μB in agreement with the first-principle calculations of Refs. [27, 28, 51] and [29,30,31] in the NaCl and ZB phases, respectively. The total spin moments of about 1 μB was obtained for the BaN compound in various phases in agreement with other first-principle calculations of Refs. [21,22,23,24] and [21, 52] in the NaCl and ZB phases, respectively. The induced magnetic moment for the BaX compounds arises largely from the X (N or C) atoms. The Ba atom also provides a minute but non-negligible magnetic moment. The remaining magnetic moment in the BaX compounds is attributed to the interstitial region around the four BaX bonds.

Table 3 The calculated total magnetic moment per formula unit μtot (in μB/cell), the local magnetic moment μN (in μB/atom) of X (N, C) atom, and the energies of spin polarization ΔEFM-NM (in meV/f.u.) of BaN and BaC compounds using GGA-PBEsol in the NaCl, CsCl, ZB, WZ, NiAs, tetragonal (P4/nmm), and Pnma phases compared to other theoretical studies

In addition, the calculated total energy difference between the ferromagnetic and non-magnetic states (ΔEFM-NM) for the BaN and BaC compounds presented in Table 3 are negative for all phases, except for the CsCl phase in the BaC compound. Thus, the ferromagnetic state is more stable than non-magnetic state of the BaN and BaC compounds. The zero total energy differences for the BaC compound in the CsCl phase as shown in Fig. 1 and Table 3 indicate that it is non-magnetic with a total magnetic moment equal to zero.

The pressure-driven phase transitions of the BaN and BaC compounds can be derived from the enthalpy vs pressure curves. The enthalpy vs pressure curves were computed for the most relevant phases of BaX compounds and compared with the newly predicted Pnma phase (see Fig. 2). Figure 2 compared the enthalpy of the previously predicted phases of BaN and BaC compounds found in Refs. [21,22,23,24,25] for BaN and Refs. [22, 27,28,29,30,31] for BaC with respect to the Pnma phase. The figure showed that within the pressure of interest, Pnma is the most dynamically stable phase for both the BaN and BaC compounds. We found a global enthalpy-minimum structure for the BaN and BaC compounds between 0 and 21 GPa (Fig. 2a) and 0 and 6 GPa (Fig. 2b), respectively.

Fig. 2
figure 2

Pressure dependence of enthalpies of different structures of a BaN and b BaC, with the Pnma phase as the zero-enthalpy reference

3.2 Dynamic and Thermal Properties

To investigate the dynamic response of the BaX (X = N and C) compounds in different phases, we presented the calculated phonon dispersion curves along the high symmetry lines in the Brillouin zone as well as the corresponding phonon total and projected density of states (DOS) in the Pnma, NaCl, ZB, and WZ phases in Figs. 3 and 4. At the theoretical equilibrium volume of the BaX compounds, all phonon modes are stable in the Pnma, NaCl, and ZB phases except for the WZ phase. From the phonon dispersion plots of Figs. 3 and 4, there are no observed imaginary modes (negative frequencies) in the Brillouin zone of the BaX compounds in the Pnma, NaCl, and ZB phases. This implies that the BaX compounds are dynamically stable in these phases. The phonon dispersion of the BaN and BaC compounds (see Figs. 3d and 4d) for the WZ phase showed soft phonon modes with imaginary frequencies around the Γ-point. This indicates that the WZ phase is dynamically unstable and would transform to a stable phase. These dynamical instabilities are present in the lowest acoustic phonon branches around the Γ-point. For the BaN (BaC) compounds, respectively, clear direct frequency gap (Γ → Γ) of about 40 cm−1 (45 cm−1) for Pnma, and indirect frequency gaps (Γ → X) 37 cm−1 (46 cm−1) for NaCl and 93 cm−1 (119 cm−1) for ZB are observed between the acoustic and optic branches. No splitting was observed between the longitudinal optical (LO) and transverse optical (TO) modes at the center of the Brillouin zone of the BaN and BaC compounds in the NaCl and ZB phases.

Fig. 3
figure 3

The phonon spectra and total and projected phonon density of states for each atom of the BaN compound calculated using the GGA-PBEsol in the aPnma, b NaCl, c ZB, and d WZ phases

Fig. 4
figure 4

The phonon spectra and total and projected phonon density of states for each atom of the BaC compound calculated using the GGA-PBEsol in the aPnma, b NaCl, c ZB, and d WZ phases

The phonon total and projected density of states (DOS) of the BaN and BaC compounds are presented in the right panels of Figs. 3 and 4. The Ba atom contributes mainly to the low frequency modes for all considered phases with minute contribution from nitrogen and carbon atoms, because of their relatively heavier atomic mass. Figures 3 and 4 also show that the high-frequency vibrations in the optical modes of the BaN and BaC compounds are dominated by the nitrogen and carbon atoms, respectively, with minute contribution from the Ba atoms. Based on the above observation, we further evaluated the thermal, magnetic, and electronic properties of the Pnma, NaCl, and ZB phases of the BaX compounds.

The thermal properties of the stable phases of the BaN and BaC compounds are calculated from the phonon DOS. In Fig. 5, we presented the variation of the Helmholtz free energy F, entropy S, and constant-volume heat capacity Cv as a function of temperature. The Debye temperature (ΘD) is determined from phonon density at low frequencies [53]. We observed the presences of curvature at temperature ranges of T < θD (θD = Debye temperature). The θD is determined from phonon vibrations. Also, we found that the energy of entropy increases with temperature, whereas the free energy decreases. The constant-volume heat capacity Cv for the Pnma, NaCl, and ZB phases rapidly increases with increasing temperature below θD (T < θD). At higher temperatures above θD (T > θD), Cv approaches the Dulong–Petit asymptote at around 200 J/mol K for all phases considered.

Fig. 5
figure 5

Temperature dependences of the Helmholtz free energy F, the entropy S, and the constant-volume heat capacity Cv of the BaN (left side) and BaC (right side) compounds in the Pnma, NaCl, and ZB phases

In addition, the computed zero temperature free energy (F) for the Pnma, NaCl, and ZB phases are 18 KJ/mol, 19 KJ/mol, and 20 KJ/mol for BaN and 19 KJ/mol, 19 KJ/mol, and 23 KJ/mol for BaC, respectively. The calculated values of the free energy F at different range of temperatures presented in the Table 4 showed that the BaN and BaC compounds in the Pnma and NaCl phases are more sensitive to the variation of temperature than those in ZB phase.

Table 4 The calculated values of the constant-volume heat capacity Cv (in J/mol K), entropy S (in J/mol K), and Helmholtz free energy F (in KJ/mol) at 0 k, 300 k, and at Debye temperature θD of BaN and BaC compounds in the Pnma, NaCl, and ZB phases

3.3 Elastic Properties

The mechanical stability was evaluated by determining the elastic constants for the Pnma, NaCl, and ZB phases of the BaN and BaC compounds using the Reshak and Jamal [54] method as implemented in WIEN2K code [34]. In Table 5, the calculated elastic constants, Poisson ratio, bulk, shear, and Young moduli computed according to the Hill method [55], for the three considered phases in the BaN and BaC compounds, were presented. The calculated elastic constants of the BaN compound in the NaCl and ZB phases taken from Refs. [21, 25] are also included in Table 5 for comparison. The calculated elastic constants of the BaC compound are smaller than those of the BaN compound. This corrobates the observation of smaller zero pressure bulk modulus in the BaC compound compared to the BaN compound.

Table 5 The calculated elastic constants Cij and elastic moduli B, G, and E (in GPa) and the Poisson’s ratio ν of the BaN and BaC compounds in the Pnma, NaCl, and ZB phases using the GGA-PBEsol at zero pressure. Elastic moduli and Possion’s ratio are given in the Hill approximation. The B/G ratio is also given. Calculated data taken from Refs. [21] [25] for BaN compound are also added for comparison

Elastic stablilty at zero pressure is achieved if the Born stability criteria are fulfilled [56, 57]. For the cubic system, the three Born stability criteria are

$$ {C}_{11}+2{C}_{12}>0;\kern0.5em {C}_{11}-{C}_{12}>0;\kern0.5em {C}_{44}>0 $$
(1)

For the orthorhombic system, the necessary and sufficient Born stability criteria are

$$ {\displaystyle \begin{array}{l}{C}_{11}>0;{C}_{11}{C}_{12}>{C}_{12}^2;{C}_{11}{C}_{22}{C}_{33}+2{C}_{12}{C}_{13}{C}_{23}-{C}_{11}{C}_{23}^2-{C}_{22}{C}_{13}^2-{C}_{33}{C}_{12}^2>0\\ {}{C}_{44}>0;{C}_{55}>0;{C}_{66}>0\end{array}} $$
(2)

The elastic constants for a cubic structure consist of three independent components: C11, C12, and C44, while the orthorhombic structure which has lower symmetry requires nine independent elastic constants: C11, C22, C33, C12, C13, C23, C44, C55, and C66. It is clearly shown that the Born–Huang mechanical stability criteria is satisfied as expressed by Relations (1), (2), and (3) for the cubic, wurtzite, and orthorhombic phases, respectively [58]. This implies that the considered phases for both the BaN and BaC compounds are elastically stable. It is well-known that Poisson’s ratio (ν) varies from 0 to 0.5. Based on the magnitudes of the ν, the bonding character of these compounds can be deduced. For the ν = 0.25, the crystal is ionic. ν ≥ 0.33 suggests the presence of metallic character and ν < 0.25 is indicative of covalent character [59]. The calculated Poisson’s ratio of 0.35, 0.36, and 0.40 for the BaN and 0.34, 0.35, and 0.36 for the BaC compounds in the Pnma, NaCl, and ZB phases, respectively, indicates the presence of metallic character for all the considered phases of the BaN and BaC compounds as shown in Table 5. From the calculated bulk modulus B and shear modulus G, we estimated the shear elastic deformation ratio G/B namely the Pugh ratio [60]. The magnitude of all the ratios as presented in Table 5 is 0.33, 0.63, and 0.20 for the BaN and 0.37, 0.35, and 0.32 for the BaC compounds in the Pnma, NaCl, and ZB phases, respectively. According to the Pugh criteria [60], if G/B < 0.57, the material has a ductile nature, else it is brittle. Frantsevich et al. [61] suggests that ν must be less than 0.26 for a non-brittle material. According to the Pugh criteria, the BaN and BaC compounds are ductile in all the considered phases, except for the BaN compound in the ZB phase which was found to be brittle.

3.4 Band Structures and Density of States

The electronic band structures of the BaN and BaC compounds in the FM configuration are shown in Figs. 6 and 7, respectively, using the GGA-PBEsol and mBJ-GGA-PBEsol exchange-correlation potentials in the Pnma, NaCl, and ZB phases. The calculated band structures for the Pnma, NaCl, and ZB phases using the GGA-PBEsol (dashed line) and the mBJ-GGA-PBEsol (solid line) have similar energy profiles but shifted around the Fermi level. We found that the minority spin (spin down) states exhibit metallic behavior for all phases, whereas the majority spin (spin up) states possess a smaller direct band gap for the BaN and BaC compounds of 1.45 eV (2.40 eV) and 0.95 eV (1.70 eV), respectively, using the GGA-PBEsol (mBJ-GGA-PBEsol) in the Pnma phase. In the NaCl phase, the BaN and BaC compounds showed a larger direct band gap of 1.47 eV (3.44 eV) and 0.98 eV (2.40 eV), respectively, using the GGA-PBEsol (mBJ-GGA-PBEsol) approach. In the ZB phase, the BaN and BaC compounds showed an indirect band gap of 2.26 (5.31) and 1.93 (4.03) eV, respectively, using the GGA-PBEsol (mBJ-GGA-PBEsol).

Fig. 6
figure 6

Comparison of the GGA-PBEsol (dashed line) and mBJ-GGA-PBEsol (solid line) spin-polarized band structures for both majority (left side) and minority (right side) spin channels of the BaN compound in the aPnma, b NaCl, and c ZB phases. The horizontal dashed line indicates the Fermi level

Fig. 7
figure 7

Comparison of the GGA-PBEsol (dashed line) and mBJ-GGA-PBEsol (solid line) spin-polarized band structures for both majority (left side) and minority (right side) spin channels of the BaC compound in the aPnma, b NaCl, and c ZB phases. The horizontal dashed line indicates the Fermi level

Using the GGA-PBEsol approach, the calculated band gaps of the BaN compound was found to be in good agreement with Refs. [21, 26] for the NaCl and ZB phases, respectively. The calculated band gap of the BaC compound is also in good agreement with Refs. [28, 30] for the NaCl and ZB phases, respectively. The HM gap presented in Table 6 was determined as the difference between the valence band maximum of majority spin states with respect to the Fermi level [62]. The calculated HM gaps in the Pnma, NaCl, and ZB phases are larger using the mBJ-GGA-PBEsol compared to GGA-PBEsol approach. The BaN and BaC compounds were found to be promising materials for spintronic applications due to presence of HM gap in their electronic structure. The calculated HM gaps at the equilibrium lattice parameters in the Pnma, NaCl, and ZB phases of the BaN compound are similar to those obtained for the BaC compound as shown in Table 6.

Table 6 The calculated direct energy band gap (Eg in eV) and the half-metallic gap (HM gap in eV) of the BaN and BaC compounds using the GGA-PBEsol and mBJ-GGA-PBEsol in the Pnma, NaCl and ZB phases compared to other theoretical studies

To further understand the physical origin of the ferromagnetic and half-metallic character in the BaX (X = N and C) compounds, a detailed analysis of spin-polarized total (DOS) and orbital-resolved partial (PDOS) density of states was carried out using the GGA-PBEsol and mBJ-GGA-PBEsol approach. The DOS and spin-resolved PDOS of the BaN and BaC compounds in the FM configuration are presented in Figs. 8 and 9, respectively.

Fig. 8
figure 8

The calculated spin-polarized total and partial densities of states of the BaN compound in aPnma, b NaCl, and c ZB phases using the GGA-PBEsol (left side) and mBJ-GGA-PBEsol (right side). The vertical dashed lines indicate the Fermi level. Positive and negative values of the DOS represent the majority and minority spin states respectively

Fig. 9
figure 9

The calculated spin-polarized total and partial densities of states of the BaC compound in aPnma, b NaCl, and c ZB phases using GGA-PBEsol (left side) and mBJ-GGA-PBEsol (right side). The vertical dashed lines indicate the Fermi level. Positive and negative values of the DOS represent the majority and minority spin states respectively

We found that the majority DOS of the BaX compounds showed a gap at the EF, while there is no gap at the minority DOS. Hence, the minority DOS is metallic for Pnma, NaCl, and ZB phases. Thus, for the BaN and BaC compounds at the Fermi level, a 100% spin polarization exists. The PDOS of the N 2p states is very similar to that of the C 2p states as shown in Figs. 8 and 9. The top of the valence band is mainly composed of the N 2p and C 2p states in the BaN and BaC compounds, respectively. The N 2p and C 2p states were found to be responsible for the half-metallicity in BaN and BaC compounds. Also, they are the dominant states around and at the Fermi level of these compounds in the Pnma, NaCl, and ZB phases. The half-metallic gap increases using the mBJ-GGA-PBEsol approach compared to the GGA-PBEsol for the BaN and BaC compounds as shown in Figs. 8 and 9 as well as in Table 6.

In contrast to the GGA approach, the shift at the Fermi level of the N 2p states in BaN compound in the Pnma phase is greater when using mBJ-GGA approach. The peaks just below the Fermi level can be attributed mainly to the contribution from the N 2p and Ba 4d states in both the majority and minority spin channels. Above the Fermi level, the peaks come mainly from the contribution of the N 2p and Ba 4d states. The origin of the opening of the gap is due to the N 2p and Ba 4d orbitals, which confirm the half-metallic nature of this compound (see Fig. 10).

Fig. 10
figure 10

The calculated spin-polarized partial densities of states of the BaN compound in the Pnma phase using mBJ-GGA-PBEsol showing the hybridization of N 2p and Ba 4d states around the Fermi level. The vertical dashed lines indicate the Fermi level. Positive and negative values of the DOS represent the majority and minority spin states respectively

4 Conclusions

First-principle calculation was used to investigate the structural stability and mechanical and electronic properties of BaN and BaC compounds in different phases (NaCl, CsCl, ZB, WZ, NiAs, P4/nmm, and Pnma) using the full-potential linear augmented plane wave plus local orbital method within the GGA-PBEsol and mBJ-GGA-PBEsol approaches. We found that BaN and BaC compounds have a ferromagnetic ground state configuration in the Pnma phase. We obtained that magnetism can be induced in alkaline earth-based light non-magnetic elements such N and C, producing respectively a total magnetic moments of 1 μB and 2 μB in the BaN and BaC compounds. Also, we found that BaN and BaC are half-metallic in the Pnma, NaCl, and ZB phases.

Our computed elastic constants Cij for the Pnma, NaCl, and ZB phases met the criteria for elastic stability. This indicates that the considered phases are elastically stable. In addition, we found that the materials are ductile according to the Pugh criteria.

Considering the phonon dynamics of the BaN and BaC compounds in the Pnma, NaCl, and ZB phases, these structures are dynamically and mechanically stable due to the absence of imaginary modes in phonon dispersion. We predicted a new phase, which is the Pnma phase for the BaN and BaC compounds. This new phase was found to be dynamically and elastically stable. We obtained that the BaN and BaC compounds in WZ phase are dynamically unstable with imaginary modes at the Γ-point. The phonon dispersion curves of the BaN and BaC compounds showed a gap between the optical and acoustical phonons in the Pnma, NaCl, and ZB phases. We showed that the constant-volume heat capacity Cv for the Pnma, NaCl, and ZB phases increases with increasing temperature and approach the Dulong–Petit limits at high temperature. The BaN compound is more sensitive to the variation of temperature than the BaC compound.

We found that the BaN and BaC compounds are half-metallic ferromagnets in the Pnma, NaCl, and ZB phases. The GGA-PBEsol and the mBJ-GGA-PBEsol approximation was used to evaluate the electronic properties. In the spin up states, the BaN and BaC compounds were found to have a direct energy gap in the Pnma (Γ → Γ) and NaCl (X → X) phases, and an indirect gap in the ZB (X → Γ) phase. The magnetic character of the BaN and BaC compounds in the Pnma, NaCl, and ZB phases are attributed mainly to the partially filled 2p orbitals of the N and C atoms.