where N X is the density of sites at which X can form, g X,q is the degeneracy of the defect charge state (e.g. spin degeneracy), k is the Boltzmann constant, T is the temperature, and ∆E X q f is the formation energy of defect X in charge state q . Defect formation energies are calculated as