xnn.common.models.electrostatics#
Point-charge electrostatics shared by the charge-predicting models.
Per-atom Coulomb energies of partial charges, in eV for charges in units of
e and distances in Angstrom, in the forms the models need:
coulomb_direct(): the plain1/rsum over every pair of a molecular structure (no cutoff; the pairs come fromall_pairs());coulomb_dsf(): the damped shifted-force truncation of Fennell and Gezelter (J. Chem. Phys. 124, 234104, 2006) over a neighbor list, which gives a continuous energy and force at a finite cutoff and so serves periodic structures (images in the neighbor list) and large molecules;coulomb_ewald(): the Ewald sum of a periodic structure, theerfc-screened real-space part over the neighbor list plus the reciprocal sum over the lattice vectors within a spherical cutoff (reciprocal_lattice()), with the self and neutralizing-background corrections;coulomb_pme(): the same with the reciprocal part on a charge mesh (smooth particle-mesh Ewald,pme).
The Ewald parameters come from ewald_parameters(): for a real-space
cutoff r_c and a target relative accuracy eps the splitting parameter
is alpha = sqrt(-ln eps) / r_c (the screened pair term is eps of its
bare value at the cutoff) and the reciprocal cutoff k_c = 2 alpha sqrt(-ln
eps) (the Gaussian factor of the reciprocal sum is eps at k_c), the
balance of Kolafa and Perram that the reference AIMNet2 calculator and
nvalchemiops use as well; xnn fixes r_c to the model’s neighbor-list
radius instead of choosing it per structure, so the graph the data pipeline
builds is the one the sum needs.
Every function returns the energy as a per-atom share (half of every pair
term on each of its atoms, the reciprocal energy as q_i phi_i / 2) so
the callers’ node_energy stays additive, and accumulates the pair and
reciprocal sums in float64 whatever the dtype of the charges. Used by
AIMNet2; the all-pairs enumeration also by
BAMBOO, the reciprocal lattice also by the
periodic EEQ charges of D4 (eeq).
Module Attributes
Coulomb constant |
|
Largest |
Functions
|
All ordered intra-structure atom pairs |
|
Per-atom share of the all-pairs Coulomb energy of molecular structures. |
|
Per-atom share of the damped shifted-force Coulomb energy over a neighbor list. |
|
Per-atom Ewald Coulomb energies of one periodic structure, in eV. |
|
Per-atom particle-mesh Ewald Coulomb energies of one periodic structure, in eV. |
|
Self and neutralizing-background terms per atom, float64. |
|
The PME mesh |
|
Splitting parameter and reciprocal cutoff for a real-space cutoff and an accuracy. |
|
Per-atom share of the screened real-space sum |
|
Per-atom reciprocal-space energies |
|
The reciprocal lattice vectors |