pymatgen-analysis-defects icon indicating copy to clipboard operation
pymatgen-analysis-defects copied to clipboard

Wrong definition of nᵢ and misleading “+” sign in Σ nᵢ μᵢ (`formation-energy.ipynb`)

Open Luftalian opened this issue 7 months ago • 1 comments

Where the issue appears

In the file, the formation-energy formula is written as

E^f[X^q] = E_{\\rm tot}[X^q] - E_{\\rm tot}[{\\rm bulk}] + \\sum_i n_i \\mu_i + qE_{\\rm F} + \\Delta^q \\,

and nᵢ is described as “the number of atoms of type i in the defect”.


What’s wrong

  1. Sign of the chemical-potential term Most published works place a minus sign in front of Σ nᵢ μᵢ. Example (Eq. 15 in Oba & Kumagai, Appl. Phys. Express 11, 060101 (2018), DOI 10.7567/APEX.11.060101):

$$ \Delta E_{\mathrm{f}}[D^{q}] = E[D^{q}] + E_{\mathrm{c}}[D^{q}] - E_{\mathrm{p}} - \sum_{i} \Delta N_{i} \mu_{i} + q\bigl(\varepsilon_{\mathrm{VBM}} + \Delta\varepsilon_{\mathrm{F}}\bigr) $$

where

  • $E[D^q]$ – total energy of the supercell containing defect $D^q$
  • $E_{\mathrm{c}}[D^q]$ – finite-size correction for charge state $q$
  • $E_{\mathrm{p}}$ – total energy of the perfect-crystal supercell
  • $\Delta N_i$ – difference in atom count of species $i$ ($>0$ for added atoms, $<0$ for removed atoms)
  • $\mu_i$ – chemical potential of species $i$
  • $q$ – defect charge (in |e| units)
  • $\varepsilon_{\mathrm{VBM}}$ – valence-band-maximum level of the perfect crystal
  • $\Delta\varepsilon_{\mathrm{F}}$ – Fermi level relative to the VBM

With a “+” sign, vacancy and interstitial formation energies are inverted.

  1. Definition of nᵢ nᵢ is not the absolute number of atoms in the defective cell. It is the difference between defective and perfect supercells:

$$ n_i = N_i^{\text{defect}} - N_i^{\text{bulk}},\qquad n_i > 0 ;(\text{added atoms}),; n_i < 0 ;(\text{removed atoms}). $$


Suggested fix

- $$E^f[X^q] = E_{\\rm tot}[X^q] - E_{\\rm tot}[{\\rm bulk}] + \\sum_i n_i \\mu_i + qE_{\\rm F} + \\Delta^q \\,$$
+ $$E^f[X^q] = E_{\\rm tot}[X^q] - E_{\\rm tot}[{\\rm bulk}] - \\sum_i n_i \\mu_i + qE_{\\rm F} + \\Delta^q \\,$$

- $n_i$ is the number of atoms of type $i$ in the defect,
+ $n_i = N_i^{\\rm defect} - N_i^{\\rm bulk}$ (positive for added atoms, negative for removed atoms),

I can submit a PR if the maintainers agree.

Luftalian avatar May 22 '25 02:05 Luftalian

Hi @Luftalian, thanks for reporting. I have not touch this repo much over the last few months due to bandwidth. I plan on doing some maintenance in the next couple of days and will incorporate this.

jmmshn avatar May 23 '25 01:05 jmmshn