where E tot (X q ) and E tot (host) are the total energies of a defect supercell and the defect-free supercell respectively. µ i is the atomic chemical potential of species i and n i is the number of atoms of species i which have been added (n i > 0) or removed (n i < 0) to form the defects. µ i is subject to thermodynamic constraints and can be used to describe experimental conditions. µ e is the electronic chemical potential (i.e. the Fermi level), referenced to the valence band maximum (VBM) of the host (E vbm ). ∆ q is a correction term to align the electrostatic potentials of the defect-free and defect supercells and to account for the finitecell-size effect on the total energies of charged defects. The Freysoldt, Neugebauer and Van de Walle (FNV) charge correction scheme was used. This involved computing the static dielectric constant (ϵ 0 ) with contributions from high-frequency electronic/optical (ϵ optic ) and low-frequency lattice/ionic (ϵ ionic ) contributions: ϵ 0 = ϵ optic + ϵ ionic . (see Table -S3)