DFT introduction #3 (short lecture)


Team Rutgers

(Michele, Ezekiel & Valeria)

Rutgers University-Newark

An interactive session

Retrieve this presentation at:


https://github.com/asesma-org/miniASESMA2026/

mini ASESMA 2026 \(\bullet\) Accra, Ghana \(\bullet\) June 17, 2026

Goal of this lecture#

  • Understand occupations (aufbau and smearing)

  • Understand and code the Self-Consistent Cycle (SCF)

  • Band structure / DOS

Split into N groups#

  • Assign number 1-N to each student

  • Groups sit together

  • Possibly have 1 instructor per group

The KS equations#

\[-\frac{1}{2}\nabla^2 \phi_k(r) + v_s(r) \phi_k(r) = \varepsilon_k \phi_k(r)\]

In discretized form#

\[ \color{green}{\mathbb{HC}=\mathbb{SC\varepsilon}} \]

How can we solve it?#


\(\mathbb{H}\) depends on \(v_s(r)\) which depends on \(n(r)\)#

What \(n(r)\) should we use to evaluate \(\mathbb{H}\)?
  • uniform density

  • sum of atomic densities (SAD), usually taken from the pseudopotential

But this is only a guess...

The Self-Consistent Field (SCF) loop#

In QEpy and QE, the SCF is a basic workflow#

  • QE handles it via the card &control

  • QEpy via the equivalent card in the options dictionary, like this:

qe_options = {}
qe_options['&control'] = {}
qe_options['&control']['calculation'] = 'scf'

The SCF threshold#

\(\tau\) usually is in units of energy. Appropriate convergence conditions are

\[ \int \left|n_{\mathrm{in}}(r)-n_{\mathrm{out}}(r)\right|\,dr < \tau \]
\[ \int \frac{ \bigl(n_{\mathrm{out}}(r)-n_{\mathrm{in}}(r)\bigr) \bigl(n_{\mathrm{out}}(r')-n_{\mathrm{in}}(r')\bigr) }{ |r-r'| } \,dr\,dr' < \tau \]
\(\longrightarrow\) this is the condition adopted by QE

Challenge 1#

  • The electron density

Derive the equation for obtaining the electron density from the basis functions \(\{\chi_k(r)\}\) and the wavefunction coefficients \(\{C_{ki}\}\). Use the expression

\[ n(r) = \sum_k^N |\phi_k(r)|^2, \text{ assume for simplicity } \phi_k(r)\in \mathbb{R} \]

Occupation numbers#

The usual equation (remember (N) is the number of electrons):

\[ n(r)=\sum_{k=1}^{N}\left|\phi_k(r)\right|^2 \qquad \longrightarrow \qquad \text{Aufbau occupations} \]

For nonzero \(T\), or for small gaps \(\left(E_g \ll 1\right)\), where the SCF procedure may have difficulty converging:

\[ n(r) = \sum_k f_k \left|\phi_k(r)\right|^2, \qquad \sum_k f_k = N \]
where \(f_k\) are called occupation numbers.

For solids, the need for (k)-point sampling often requires smearing:

\[ n(r) = \sum_k \sum_{\nu \in \mathrm{FBZ}} f_{k\nu}\left|\phi_{k\nu}(r)\right|^2, \qquad \sum_{k,\nu} f_{k\nu}=N \]

Challenge 2: what are these \(f_k\)?#

  • Code your own Fermi-Dirac smearing function to generate occupation numbers \(\{f_k\}\) given orbital energies \(\{\varepsilon_k\}\)

Consider a set of eigenvalues, \(\{\varepsilon_k\}\) coming from \(\color{green}{\mathbb{HC}=\mathbb{SC\varepsilon}}\). Evaluate the Fermi-Dirac distribution and impose \(\sum_k f_k = N\). Feel free to use AI to help you code it. Justify and explain your code to a tutor.

import matplotlib.pyplot as plt
import numpy as np
x=np.linspace(start=-10,stop=10,num=100)
tau = 0.5
plt.plot(x,(1+np.exp((x-0)/tau))**(-1))
[<matplotlib.lines.Line2D at 0x138595a50>]
_images/610fb50e13c7411bb3ca199077b857b66ac6006f30c3eabd753221a3c236bd9d.png
Now time for hands-on activities: "SCF with QEpy" (and have QE solve it!)