# How to interpret defect formation energy diagram?

Why are formation energy diagrams typically plotted as a function of Fermi energy, and how should one interpret the changes in the x-axis before the charge state changes in these diagrams?

Figure source: 10.1103/PhysRevB.77.245202

# Why defect formation energy is plotted against $$E_F:$$

Let's go step-by-step. First, let us look at the Defect Formation Energy (DFE) formula: $$E_f^D(q,E_F) = E^D(q)-E^{\mathrm{host}}-\sum n_i\mu_i + q(E_F + E_{\mathrm{VBM}}^{\mathrm{host}}) +E^{\mathrm{FNV}}_{\mathrm{corr}}(q)\tag{1}$$ Notice that for a defect $$D$$ with a fixed charge state $$q$$, the formation energy depends on only the Fermi level $$E_F$$, and nothing else. See this and this answers to know more about each of the terms of this equation. Here, I compacted all the correction terms to $$E^{FNV}_{corr}(q)$$ since this depends only on $$q$$ (not on $$E_F$$). Now, you can see why the DFE curves are straight line in the $$E_f^D$$ vs $$E_F$$ plot. This is because straight lines follow $$y=mx+c$$ equation and (1) can be expressed in this form where: $$y = E_f^D(q,E_F) \\ m = q \tag{2} \\ x = E_F \\ c = E^D(q)-E^{\mathrm{host}}-\sum n_i\mu_i + qE_{\mathrm{VBM}}^{\mathrm{host}} + ^{\mathrm{FNV}}_{\mathrm{corr}}$$ So, now you see why we plot the DFE as a function of the Fermi energy because this is the only free variable for a particular charge state. If you have more than one charge state (which you should typically have), you will find plots like below.

# Interpreting DFE diagram

Now to answer how you can interpret these diagrams, let us understand how the slope of the curve depends on $$q$$ and what formation energy means. You will readily notice that $$q$$ itself denotes the slope [from eq. (2)]. So from left to right, an upward slope is for $$n$$-type defects and a downward slope is for $$p$$-type defects. A horizontal line in DFE diagram signifies a neutral defect. Now, formation energy can be thought of as the energy change associated with the creation of a defect from the host. So, a neutral defect has the same formation energy regardless of the position of the Fermi level while other type of defect can have increasing/decreasing formation energy with respect to the Fermi level. Notice that you will have all the charge states in the entire graph but during final plot, we only plot the lowest lying charge states in the each region which shows the most favorable charge states.

Now to interpret the example you have shown in your post:

Firstly, I have an objection since the oxygen-poor case have formation energy curves in the negative formation energy region. To the best of my understanding, negative formation energy does not make any sense and maybe the authors went too far in the chemical potential limit such that this happened whereas chemical potentials should only be manipulated in such a way that only the positive formation energy remains. You will see in the literature, some author simply sets the lower limit of y-axis to 0. For example see Figure 2(d) of this paper - Kavanagh et al., (2024). doped: Python toolkit for robust and repeatable charged defect supercell calculations. Journal of Open Source Software, 9(96), 6433 which introduces a code to perform defect formation energy calculation. However, this objection is not grave and the plot can be still interpreted since such correction would only shift the whole graph a little above.

I will not interpret all the curves but let us pick one: the oxygen vacancy in $$\mathrm{ZnO}$$, i.e., $$V_{\mathrm{O}}$$. You can notice that in the oxygen-poor case the formation energy of such a vacancy is lower than the formation energy in the oxygen-rich case. This is due to the fact that when there are lots of oxygen in the environments, it is more difficult to form an oxygen vacancy. But when there are almost no oxygen, formation of oxygen vacancies are easier (less energy is required). You can see the same trend in $$V_{\mathrm{Zn}}$$ since oxygen-poor case means zinc-rich case and vice-versa.