xnn.common.models.pme#
Smooth particle-mesh Ewald reciprocal sums (Essmann and co-workers, 1995).
J. Chem. Phys. 103, 8577 (1995).
The reciprocal-space part of an Ewald sum through a charge mesh: the point
charges are spread onto a regular grid of the unit cell with cardinal
B-splines of order p (eq 4.1 of the paper, the weights M_p(u - k) of
the scaled fractional coordinate u), the grid is Fourier transformed, and
the structure factor is recovered from the transform through the Euler
exponential spline coefficients b_i(m_i) (eq 4.4), so that
E_rec = 1 / (2 pi V) sum_{m != 0} exp(-pi^2 m^2 / alpha^2) / m^2 B(m) |F(Q)(m)|^2
with B(m) = prod_i |b_i(m_i)|^2 (eq 4.7). The per-atom energies come from
the reciprocal potential interpolated back onto the atoms with the same
splines, E_i = q_i phi(r_i) / 2, which sum to E_rec. Everything is
written in differentiable tensor operations, so forces (through the spline
weights and the charges) and the stress (through the cell) follow from
autograd, and the functions compile under TorchScript.
The mesh size follows the production heuristic K_i = 2 alpha L_i / (3
eps^(1/5)) rounded up to a power of two (the same choice as the reference
AIMNet2 calculator), which covers both the Gaussian truncation and the
spline aliasing error at the target relative accuracy eps. The B-spline
coefficients are the exact ones of the paper (the discrete Euler spline),
not the continuous sinc^p approximation some codes use; the two agree
to the aliasing error the mesh heuristic controls.
Functions
|
|
|
Cardinal B-spline weights |
|
The wave vectors of a mesh in FFT order: |
|
Mesh dimensions for a target accuracy: |
|
Per-atom reciprocal-space energies of one periodic structure, |
|
|
|
|
|
Charges on the mesh by B-spline assignment (paper eq 4.6). |