where E[X q ] is the energy of the supercell with defect X in the charge state q, E(pristine) is the energy of the pristine (non-defective) supercell. ni and μi are the number and the chemical potentials of the species added or subtracted, respectively and εVB is the valence band energy of the pristine system. The last two terms of Eq (1) represent the energy to the exchange electrons with the Fermi level of the system (εF).