xnn.hybnn.models.byteff_kernels#

Fused GPU kernels of periodic ByteFF-Pol’s neighbor pairs (the fast path of molecular dynamics steps).

The real-space pairs of ByteFFPol in a cell (repulsion, dispersion and charge transfer of the pairs beyond 1,5, real-space Ewald electrostatics of every pair, the charges’ field and the mutual-induction ladders) as two Triton kernels with the numbers of the eager function _pol_real_space to round-off:

  • the forward walks the compressed rows of a step plan’s pairs (pair_rows()), one program per atom, and sums the atom’s half of every pair energy and its field in registers: no atomic adds; each pair’s two ladders are written once, from the row of its first atom;

  • the backward is one pass over the pairs: the gradient of the pair vectors from the gradients of the per-atom energies, the field and the ladders, through d D_n / dR = R D_(n+1) of the Ewald, Coulomb and Thole ladders. It is differentiable once: molecular dynamics, not training.

Imported only on CUDA devices, so that triton is needed only there.

Functions

pol_real_space(r, i, k, beyond, atoms, rows, ...)

The fused pairs of periodic ByteFF-Pol (see PolRealSpace): per-atom energies (N, 4), the field (N, 3) and the ladders D1, D2 (M,).

Classes

PolRealSpace(*args, **kwargs)

Per-atom energies (N, 4), the charges' field (N, 3) and the mutual ladders f1, f2 (M,) of the pairs (i, k) with vectors r (pos[k] - pos[i]), as _pol_real_space of byteff; the gradient reaches r only.