Solution (source code)

= Solution

<Density functional theory> replaces the interacting many-electron <ground state> <wavefunction> by its spatial density $n(\mathbf r)$. For fixed interaction and a nondegenerate ground state, the <Hohenberg-Kohn theorem> fixes the external potential up to an additive constant. If two distinct potentials gave the same density, their strict variational energy inequalities would sum to the contradiction $E_0+E'_0<E_0+E'_0$.

The <density functional variational principle> minimizes
$$
E_v[n]=F[n]+\int v(\mathbf r)n(\mathbf r)\,d^3r,\qquad
F[n]=\min_{\Psi\to n}\langle\Psi|T+W|\Psi\rangle,
$$
over admissible densities of the correct particle number. The universal $F$ contains the kinetic and interaction energies. This is exact in principle; an explicit useful functional is the practical difficulty.<Inhomogeneous electron gas by Pierre Hohenberg and Walter Kohn>[1964: density-potential uniqueness and density variational principle]{ref}

The <Kohn-Sham equations> introduce noninteracting orbitals with the same density and decompose $F=T_s+E_H+E_{\rm xc}$. With $n=\sum_i f_i|\phi_i|^2$,
$$
\left[-\frac{\hbar^2\nabla^2}{2m_e}+v+v_H[n]+v_{\rm xc}[n]\right]\phi_i=\epsilon_i\phi_i,\qquad
v_H=\frac{e^2}{4\pi\epsilon_0}\int\frac{n(\mathbf r')}{|\mathbf r-\mathbf r'|}\,d^3r',\quad
v_{\rm xc}=\frac{\delta E_{\rm xc}}{\delta n}.
$$
The <exchange-correlation functional> includes exchange, correlation and the interacting kinetic-energy correction relative to $T_s$. Guess a density, construct the potentials, solve and occupy orbitals, then mix and iterate to <self-consistent field> convergence. The <local density approximation> uses $E_{\rm xc}^{\rm LDA}=\int n\epsilon_{\rm xc}^{\rm uniform}(n)\,d^3r$; a <generalized gradient approximation> also depends on density gradients.

\b[Kohn–Sham orbital energies are not generally excitation energies], and their sum double counts interactions. The <Kohn-Sham energy double-counting correction> is
$$
\boxed{E=\sum_i f_i\epsilon_i-E_H+E_{\rm xc}-\int n v_{\rm xc}\,d^3r,}
$$
with ion–ion energy added for a total crystal energy. Approximate functionals can miss self-interaction cancellation, band gaps and strong correlation; convergence alone does not prove the global ground state.<Self-Consistent Equations Including Exchange and Correlation Effects by Walter Kohn and Lu Jeu Sham>[1965: auxiliary noninteracting system and effective density-dependent equations]{ref}