xnn.common.models.electrostatics.coulomb_direct#
- xnn.common.models.electrostatics.coulomb_direct(charges, pos, batch, k_e=14.39964547846902, num_graphs=0, damping_midpoint=0.0, damping_steepness=0.0, dense=False)[source]#
Per-atom share of the all-pairs Coulomb energy of molecular structures.
E_i = (k_e / 2) sum_{j != i} q_i q_j / r_ijover the atoms of the same structure, summing tok_e sum_{i<j} q_i q_j / r_ij. The pair terms are accumulated in float64 whatever their dtype. With a positivedamping_steepnessbevery pair term is multiplied by the Fermi function1 / (1 + exp(b (a - r_ij)))of midpointa, which attenuates the short-range pairs.- Parameters:
charges (Tensor) – Partial charges
(N,).pos (Tensor) – Positions
(N, 3); the pair distances are formed in the charges’ dtype.batch (Tensor) – Structure index per atom
(N,).k_e (float, optional) – The Coulomb constant (an argument so the function compiles under TorchScript), by default
COULOMB_CONSTANT.num_graphs (int, optional) – Number of structures, when the caller knows it: one structure sums its pair matrix directly (no host synchronization for the pair list), by default 0 (unknown).
damping_midpoint (float, optional) – Distance
awhere the damping is one half, by default 0.0.damping_steepness (float, optional) – Steepness
bof the damping in inverse length, by default 0.0 (no damping).dense (bool, optional) – Sum several structures over a masked
(N, N)pair matrix (dense_pairs()) instead of a pair list, which reads no count back from the device (a captured evaluation), by defaultFalse.
- Returns:
Per-atom energies
(N,)in eV, float64.- Return type:
Tensor