# Determining Fermi energy in density functional theory

Fermi energy is affected by the temperature and whether the material is an insulator/semiconductor/metal, but how is the Fermi energy determined in DFT calculations and how reliable are the obtained values?

• I made a small edit, I dont think there is a need to get different answers for different flavors of DFT. I think that will come naturally as people talk about improvements or problems. Oct 14, 2020 at 13:59
• @TristanMaxson alright, makes sense. Oct 14, 2020 at 14:00
• @Jack The fermi energy in semiconductors is not well defined in DFT. I do think we have a question somewhere on this but I don't have the time to look for it Jan 15 at 19:29

The Fermi energy is defined implicitly, by requiring that the total of the band occupancies $$f$$ is the number of electrons, $$N$$:

$$\sum_{b=0}^{N_b}f_b=N\tag{1}\label{occ}$$

where $$N_b$$ is the number of bands in the calculation. The occupancy is computed from

$$f_b = f\left(\frac{\epsilon_b-E_F}{\sigma}\right)\tag{2}\label{smearing}$$

where $$f$$ is the smearing function (e.g. Gaussian, Fermi-Dirac, Methfessel-Paxton), $$\sigma$$ is the smearing width, $$\epsilon_b$$ is the band eigenvalue, and $$E_F$$ is the Fermi energy. Only the latter of these is unknown.

A simple approach is to use a bisection search. To start with, we need to bracket the true $$E_F$$; as an example, you could try setting $$E_F$$ to the minimum computed Kohn-Sham eigenvalue, and then to the maximum computed Kohn-Sham eigenvalue. There are much better choices of course, but this is a simple approach and it does work (it just takes more steps than a better choice). Once you've bracketed the real answer, you use a standard bisection search to narrow the bracket until you've determined $$E_F$$ to your desired accuracy.

Note that this method also demonstrates why $$E_F$$ is not well-defined for semiconductors or insulators: any value in the band-gap gives the same occupancies (to within machine precision), apart from a small region where the smearing function has pushed some weight into the band-gap.

• But bisection also converges so rapidly (logarithmic time) that one can easily afford to make a poor guess for the search interval! Apr 8 at 15:53
• Unfortunately, the iterations can be relatively expensive in a periodic system for a large, parallel calculation, so savings are usually worthwhile. Apr 19 at 23:43
• I'm not sure I follow. This is a simple arithmetic function, and the parameter is found by bisection. Even a simple Octave implementation should converge in a matter of milliseconds for tens of thousands of entries...? Apr 21 at 19:39
• It's the iteration count and communication cost which cause the problems. If you gather everything onto one process then the computation is quick, but if you do it "properly" and distribute it over Brillouin zone points and bands, then the reductions over the processes can get quite expensive. Apr 21 at 22:37
• But you still need to communicate the orbital energies. When you have them, determining the chemical potential is so quick that you can just run it on all processes, no? Apr 22 at 19:54

Usually, it is assumed that the Fermi energy is the energy of the highest occupied electronic state. It is well defined for metals with partially filled bands. For semiconductors and dielectrics, however, there may be a discrepancy between different software packages, since the Fermi energy can correspond to the center of the bandgap at $$\pu{0 K}$$ in the case of an undoped semiconductor or it can be at the top of the valence band. The former convention pins the Fermi energy to the energy of a state which has the occupation probability of $$0.5$$ even at $$T>\pu{0 K}$$.

• But in metals one has to use fractional occupations. Is it even well defined which orbitals are occupied and which are not? Oct 15, 2020 at 23:06
• @SusiLehtola Dealing with fractional occupations (and thus some fictitious or real electronic temperature) means that one considers a quantum mechanical ensemble average (where the systems averaged over do have integer occupation numbers). The Fermi level is the inflection point of this distribution. In the ensemble sense occupation numbers are well defined for metals. Apr 15 at 20:26
• +1 @freude for pointing out code-ambiguities wrt. Fermi levels in insulators and semiconductors. On top of that, only in an ideal crystal will the Fermi level be exactly midgap. In a real material, the slightest degree of doping (i.e. impurities and other defects) will very sensitively push the Fermi level towards the valence or conduction band edge. For a careful analysis and DFT-aided interpretation of experiments, one should consider that the Fermi level could potentially be anywhere between valence band maximum and conduction band minimum with high sensitivity to synthesis conditions. Apr 15 at 20:32

This has been answered very well already but just to add a practical note: For semiconductors, Vasp places the Fermi level at the valence band maximum ($$\pm$$ smearing energy) whereas Quantum Espresso or GPAW place it at the center of the gap. If you use another code then it's advisable to double-check what convention/algorithm it uses.