Hartree Potential and the Poisson Equation
Every self-consistent DFT calculation has to answer the same question at each SCF step: given the current electron density , what classical electrostatic potential does it create? That potential — the Hartree potential — is the dominant mean-field contribution to the effective potential felt by each electron. It is also the term where a plane-wave basis earns its keep most visibly: what is a three-dimensional integral equation in real space becomes a one-line pointwise division in reciprocal space.
All equations below use Rydberg atomic units (, , , ), matching the KRONOS source. The key unit-system consequences: bare Coulomb repulsion between two unit charges is (not ), and the Hartree potential prefactor is (not ). Where a Hartree-unit equivalent is shown for comparison, it is labeled explicitly.
The classical Coulomb integral
The Hartree potential is the electrostatic potential generated by the electron density treated as a classical charge distribution. Each volume element at position carries charge (electrons carry charge in atomic units) and creates a Coulomb potential at . In Rydberg units the Coulomb kernel between two unit charges is , so the total Hartree potential is
In Hartree atomic units the same expression reads (Coulomb kernel is ). The factor of two in the Rydberg form comes directly from in those units; the physics is identical, only the prefactor differs.
is a purely classical, mean-field potential. It contains no exchange (no Pauli exclusion between electrons of the same spin) and no correlation (no correlated motion beyond the average field). Those effects are captured entirely by . The Hartree term is the dominant electron-electron contribution in most systems — orders of magnitude larger than in typical valence electron densities — which makes solving the Poisson equation accurately at every SCF step non-negotiable.
The Poisson equation
The Hartree potential satisfies the Poisson equation. To see why, apply the Laplacian to the convolution integral above. Using the distributional identity (the Green's function of is ), the differentiation collapses the convolution:
The Hartree-unit version is — the standard textbook form from Jackson's Classical Electrodynamics. The factor of two difference is again vs .
Physically this is Gauss's law in differential form: (in Gaussian units), rewritten for the scalar potential . The electron density plays the role of the charge source.
Diagonal in G-space
Solving the Poisson equation directly in real space for a periodic system would require inverting the full Laplacian — a dense operator. In G-space the Laplacian is diagonal: . Taking the Fourier transform of both sides of the Poisson equation,
which rearranges instantly to
The Hartree-unit equivalent, , is the form found in most electronic structure textbooks. In both cases the Poisson solve reduces to a single pointwise division over the G-vector list — work with a tiny prefactor and no FFT required. This is why the Hartree potential update is never a bottleneck even for large supercells.
The density used here lives on the full density FFT grid (controlled by ecutrho), not the smaller wavefunction grid (ecutwfc). This is essential: the density contains Fourier components up to because it is formed from products of wavefunctions, so the Poisson solve must operate on the larger grid. In KRONOS, ecutrho ecutwfc for norm-conserving pseudopotentials (PAW requires ).
The G=0 divergence and charge neutrality
The formula diverges at . This is not a numerical accident — it reflects a genuine physical fact. For an infinite periodic solid, the component of the Coulomb potential measures the energy cost of the net charge in the simulation cell interacting with its own infinite periodic images. That cost is infinite unless the cell is charge-neutral.
Physical resolution: charge neutrality. A real crystal is electrically neutral: the total electronic charge exactly cancels the ionic charge,
where is the number of valence electrons, is the unit cell volume, and is the mean density. KRONOS enforces this as a hard requirement: if the input does not produce a charge-neutral cell (electrons plus pseudopotential valence charges), the calculation aborts.
Numerical convention: set . When the cell is neutral, the infinite divergence at from the Hartree term cancels exactly against the identical divergence from the ionic local potential and the Ewald reciprocal-space sum. These three terms together produce a finite, well-defined total energy. In KRONOS — as in Quantum ESPRESSO and most plane-wave codes — all three contributions are set to zero at individually, and their combined finite remainder is carried through the Ewald correction. Setting is equivalent to choosing the arbitrary zero of electrostatic energy, which has no observable consequence for energy differences or forces.
In hartree.cpp, the implementation checks g2 < 1e-12 and assigns zero explicitly, bypassing the division:
if (g2 < 1.0e-12) {
vhartree[ig] = complex_t{0.0, 0.0};
} else {
vhartree[ig] = prefactor * density_g[ig] / g2;
}
This threshold-based skip also prevents any finite-precision issues from near-zero values near the point.
Hartree energy
The Hartree energy is the classical electrostatic self-energy of the electron charge distribution. It is defined as half the interaction energy of the density with its own Hartree potential (the factor of avoids double-counting each pair of interacting volume elements):
Using Parseval's theorem to convert to G-space (the factor comes from the cell volume normalization of the Fourier transform):
The term is excluded from the sum because by convention. Substituting , this can also be written
which is explicitly real and non-negative — the Hartree energy is always positive, reflecting the repulsive character of electron-electron Coulomb interaction.
FFT normalization note. In the KRONOS FFT convention both density_g and vhartree_g carry a factor of relative to the physics convention (FFTW3 does not normalize its transforms). The product is therefore too large, and HartreeSolver::energy() divides by num_grid * num_grid to recover the correct Rydberg value:
const double n2 = static_cast<double>(num_grid) * static_cast<double>(num_grid);
return 0.5 * volume * esum / n2;
Double-counting in the DFT total energy
The Kohn-Sham band energy is computed by summing the KS eigenvalues. Each eigenvalue is the expectation value of the full effective-potential Hamiltonian — kinetic plus plus plus external. The band energy sum therefore already includes the Hartree potential contribution , which is twice (since ). Similarly, is already inside the eigenvalue sum but is not (the latter is a different functional of ).
To recover the correct total energy from the band sum, both overcounts must be removed. In Rydberg units:
Breaking down each term:
- : sum of KS eigenvalues, includes kinetic + + + external.
- : removes the overcounted half of the Hartree self-energy ( has , so subtracting leaves , the correct contribution).
- : the true XC energy, a functional of the density.
- : removes the XC potential energy that was included in the eigenvalues.
- : classical ion-ion interaction, computed by Ewald summation. See Ewald Summation in the legacy Physics Notes for the derivation; a dedicated page is on the roadmap.
This decomposition is implemented in src/solver/scf.cpp. The Hartree energy is computed after each SCF iteration by HartreeSolver::energy(), and the double-counting correction is applied immediately before writing the total energy to the JSON output.
How KRONOS implements this
The Hartree solver lives in src/potential/hartree.hpp and src/potential/hartree.cpp. The public interface exposes two methods:
-
HartreeSolver::compute(density_g)— takes the electron density in G-space (indexed on the full density grid, i.e.ecutrhoG-vectors), applies with the G=0 guard, and returns as aCVec. -
HartreeSolver::energy(density_g, vhartree_g, volume, num_grid)— computes with the normalization correction described above. The energy loop starts atig = 0but the G=0 term contributes nothing becausevhartree_g[0] = 0.
The returned is added to the local pseudopotential and XC contributions to form the total effective potential , which is then inverse-FFTed to real space for the local Hamiltonian application. Because the Hartree solve is a single pass through G-vectors with no FFT, it is typically less than 0.1% of the total wall time even for large cells.
References
- Martin, R. M. Electronic Structure: Basic Theory and Practical Methods, Cambridge University Press, Ch. 7 (2004) — Hartree energy, double-counting, and the total energy expression.
- Pickett, W. E. "Pseudopotential methods in condensed matter applications", Comput. Phys. Rep. 9, 115 (1989) — comprehensive treatment of the Poisson solve and G=0 convention in plane-wave DFT.
- Jackson, J. D. Classical Electrodynamics, 3rd ed., Wiley, Ch. 1 (1999) — Poisson equation derivation from Gauss's law and the Green's function of the Laplacian.
- Payne, M. C., Teter, M. P., Allan, D. C., Arias, T. A., Joannopoulos, J. D. "Iterative minimization techniques for ab initio total-energy calculations", Rev. Mod. Phys. 64, 1045 (1992) — practical plane-wave implementation of Hartree and double-counting.