Hellmann-Feynman Forces in Plane-Wave DFT
In ab initio molecular dynamics, structure optimization, and vibrational analysis, the ability to compute the analytic forces on each atom is crucial. Computing forces via finite differences—displacing each atom and re-running the self-consistent field cycle—is prohibitively expensive: for a supercell with atoms, it requires SCF calculations. The Hellmann-Feynman theorem provides the solution: at SCF convergence, the atomic forces follow directly from the self-consistent wavefunction and charge density, with no additional eigenvalue computation needed. This page derives the forces from first principles, explains how they decompose into Ewald, local, and nonlocal contributions, and describes KRONOS's implementation and validation against finite differences.
The Hellmann-Feynman Theorem
The Hellmann-Feynman theorem states that for an eigenstate of a parametrized Hamiltonian ,
provided the wavefunction is an eigenstate of the parametrized Hamiltonian. The key insight is that the wavefunction derivative term cancels identically at convergence:
Since , the first and third terms give , which cancels. Only the middle term survives.
Application to atomic forces: For the total energy as a function of ionic positions (holding the electron density fixed on the Born-Oppenheimer surface, i.e., SCF converged), the force on atom is
For plane-wave DFT with pseudopotentials, this partitions into three physically distinct contributions: Ewald ion-ion repulsion, local pseudopotential, and nonlocal pseudopotential forces. Each has a different functional form and implementation path.
Force Components: The Total Force
The total force on atom decomposes as
This decomposition holds exactly for norm-conserving pseudopotentials under the Hellmann-Feynman approximation (Pulay forces vanish; see §7). PAW introduces augmentation-charge contributions, which are handled separately. All equations below work in Rydberg atomic units, consistent with KRONOS source code.
Ewald Ion-Ion Forces
The ionic configuration energy is computed via the Ewald sum, which partitions the long-range Coulomb repulsion into a short-range real-space sum and a long-range reciprocal-space sum to accelerate convergence:
where are ionic charges (from pseudopotentials), is the Ewald screening parameter (typically chosen for equal convergence of both sums), , and ranges over lattice vectors.
Real-space contribution: The force from the real-space sum is straightforward differentiation:
Using (the chain rule and product rule), the force magnitude along the direction decays exponentially for short distances but remains for distances beyond the Ewald cutoff—hence the need for the reciprocal-space sum to capture distant periodic images.
Reciprocal-space contribution: The reciprocal-space Ewald energy is
Differentiating with respect to :
When summed over all atoms, the reciprocal-space contribution vanishes by charge neutrality (the structure factor for sums to zero for neutral systems); for a single atom, it is nonzero and essential.
Implementation: KRONOS computes both real and reciprocal contributions in src/potential/forces.cpp::ewald_forces(). The algorithm:
- Real-space loop: all pairs with .
- Reciprocal-space loop: all vectors up to the wavefunction cutoff, using cached structure factors .
The total Ewald force on atom is .
Local Pseudopotential Forces
The local pseudopotential contributes an energy-density term, , where depends on atomic positions through the superposition of spherically symmetric potentials centered at each atom.
In G-space, expands as
with Fourier components
where is the zeroth-order spherical Bessel function (spherical symmetry ensures only appears).
The local energy and its gradient are
Physical interpretation: The factor comes from differentiating the structure factor with respect to position. The force is proportional to the gradient of the local potential convolved with the electron density in G-space.
Numerical implementation: KRONOS precomputes the Fourier-transformed local pseudopotential via spherical Bessel transform at initialization and caches it. At each SCF step, the density is available on the finer density grid (controlled by ). The force is computed as a loop over vectors, accumulating . Cost: .
Nonlocal Pseudopotential Forces
The nonlocal pseudopotential is expressed in the Kleinman-Bylander separable form as
where is a projector centered at atom .
The total electronic energy includes the nonlocal contribution
where the projections are and the prefactor accounts for double occupancy (spin for closed-shell systems).
Force calculation: Differentiating with respect to (remembering that both and the projections depend on position), the Hellmann-Feynman theorem gives
\mathbf{F}_a^\mathrm{NL} = -2\sum_{n\mathbf{k}} w_\mathbf{k} f_{n\mathbf{k}} \sum_{lm,ij} D_{ij}^{l,a} \, \mathrm{Re}\left[ p_{lm,i}^{a,\ast}(\mathbf{k}) \left\langle \psi_{n\mathbf{k}} | \nabla_a \beta_{lm,j}^a \right| \psi_{n\mathbf{k}} \right\rangle \right].
Here, the projector gradient is computed in reciprocal space. For a projector expanded as
the spatial gradient picks up an extra factor of from the plane-wave exponential:
In practice, the projections are computed as inner products of wavefunctions with the Fourier-transformed projectors. The force requires an additional set of projections, , which are accumulated during the wavefunction-projector contraction.
Implementation in KRONOS: The function nonlocal_forces() in src/potential/forces.cpp orchestrates:
- For each k-point, compute the standard projections .
- Compute gradient projections: for each projector and k-point.
- Accumulate force via the formula above, summing over all occupied bands.
- Weight by Fermi occupations and k-point weights .
Cost per k-point: , dominated by the BLAS inner products.
XC and Hartree Forces
The exchange-correlation energy and Hartree energy depend on the electron density . The chain rule gives
However, at SCF convergence, the density is stationary with respect to variations of the wavefunction (the variational principle). The Hellmann-Feynman theorem ensures that the implicit wavefunction derivative cancels, leaving only explicit dependencies. For a local potential like or , the explicit dependence on vanishes—only the density varies, and that variation is already captured through the stationarity condition. Thus, XC and Hartree forces contribute zero explicitly in the Hellmann-Feynman approximation (they are included implicitly through the SCF convergence condition).
This simplification—that local potentials require no special force term—is one of the key advantages of plane-wave codes over other methods.
Pulay Forces: Why They Vanish
In methods where the basis set depends on atomic positions (e.g., atom-centered Gaussian orbitals in LCAO), the basis set itself changes when atoms move, introducing additional "Pulay" or "BFGS" force terms. Mathematically,
which vanishes when the basis is orthonormal and independent of atomic coordinates.
In plane-wave codes, the basis is a fixed, infinite set of plane waves that does not depend on (only the cell shape and k-points affect it, through FFT grids and Brillouin zone symmetry). Therefore, Pulay forces vanish identically, and the Hellmann-Feynman formula becomes exact. This architectural advantage—that basis-set incompleteness errors in forces are eliminated—makes plane-wave DFT forces highly reliable.
Force Symmetrization
After computing the raw Hellmann-Feynman forces from the SCF density, numerical noise and floating-point rounding accumulate. A symmetry-enforcing post-processing step cleans up the forces and ensures they respect the point-group symmetry of the crystal.
Algorithm:
- Use spglib to identify the space-group operations that leave the crystal structure invariant.
- For each symmetry operation , map atom to its image atom (possibly related by translation).
- Transform the force under the symmetry operation: .
- Average the forces over all symmetry-equivalent images.
Result: The symmetrized force on atom is
where the sum is over all symmetry operations and is the image of under .
Conservation: By construction, symmetrization conserves the total force on the unit cell: (up to small numerical noise). This is a consequence of translational invariance: displacing the entire cell should produce no net force.
Implementation: In KRONOS, symmetrize_forces() (in src/io/symmetry.cpp) applies this post-processing. The symmetrized forces are used for geometry optimization and MD, improving stability by removing spurious asymmetries.
Finite-Difference Validation
The most stringent test of force accuracy is finite-difference validation: compute the energy for small ionic displacements and compare with the analytic Hellmann-Feynman force.
Procedure:
- For atom and Cartesian direction (x, y, or z), displace by a.u. (or smaller).
- Run SCF to convergence at the displaced geometry; record .
- Compute numerical derivative: .
- Compare with analytic force from the Hellmann-Feynman calculation at .
- Compute relative error: .
KRONOS results: For silicon diamond at Ry with Gamma-point sampling, displacing a single atom by 0.01 fractional units (approximately 0.025 bohr along the lattice vector) yields agreement to 5 significant figures: Ry/bohr for forces in the range Ry/bohr. This validates the Ewald, local, and nonlocal force components jointly.
Expected accuracy: For high-quality calculations (fine k-point sampling, large cutoffs), forces agree to – Ry/bohr. At lower cutoffs or coarser sampling, Ry/bohr is typical. The finite-difference displacement should be small enough to probe the linear regime ( bohr) but large enough to keep numerical error below the analytic error ( bohr for double precision).
Geometry Optimization and Molecular Dynamics
The forces computed via Hellmann-Feynman are fed into two main applications:
-
Geometry optimization (structural relaxation): KRONOS uses the BFGS algorithm (in
src/solver/vc_relax.cpp) to minimize the total energy by moving atoms along the negative gradient . The Hessian (second-derivative matrix) is approximated using previous steps, and ions are moved until the maximum force drops below a tolerance (typically Ry/bohr) and the energy change stabilizes. -
Molecular dynamics: At fixed temperature, ions are advanced using the Verlet or velocity-Verlet algorithm, with forces as acceleration. KRONOS's MD infrastructure is under development (v0.2 roadmap).
In both cases, accurate, stable forces are essential for reliable predictions.
How KRONOS Implements Forces
The orchestration happens in compute_forces() (main dispatcher in src/solver/scf.cpp):
compute_forces(const SCFState& scf_state, const Crystal& crystal, ...)
|
+-- ewald_forces(crystal)
| [real-space + reciprocal-space ion-ion repulsion]
|
+-- local_pp_forces(scf_state.density, crystal)
| [gradient of local pseudopotential energy, G-space loop]
|
+-- nonlocal_forces(scf_state.wavefunctions, scf_state.eigenvalues, crystal)
| [projector overlaps with wavefunction gradients, BLAS]
|
+-- symmetrize_forces(forces, crystal)
[spglib-based averaging over symmetry operations]
The output is a vector of forces in Ry/bohr. For variable-cell relaxation, stress components are computed similarly (derivative of energy with respect to cell deformation) and passed to the BFGS optimizer alongside atomic forces.
References
- Hellmann, H. Einführung in die Quantenchemie. Deuticke, Leipzig (1937). [Original statement of the theorem.]
- Feynman, R. P. "Forces in molecules." Phys. Rev. 56, 340–343 (1939). [Quantum mechanical derivation and application to molecular geometry.]
- Ihm, J., Zunger, A. & Cohen, M. L. "Momentum-space formalism for the total energy of solids and the equation of state." J. Phys. C: Solid State Phys. 12, 4409–4422 (1979). [Pseudopotential forces in plane waves; local and nonlocal contributions clearly separated.]
- Martin, R. M. Electronic Structure: Basic Theory and Practical Methods. Cambridge University Press (2004). [Chapter 9: Forces and stresses in DFT; comprehensive treatment of all force components.]
- Gonze, X., Kresse, G., et al. "Recent developments in the ABINIT software package." Comp. Phys. Commun. 205, 106–131 (2016). [Section on forces, symmetrization, and validation in modern plane-wave codes.]