xnn.ffnn.models.geometry#

Shared bonded-term geometry for fixed-topology force fields.

Minimum-image displacement vectors, the dihedral cosine and a differentiable-at-zero geometric mean, used by every fixed-topology model (OPLS, DREIDING). All functions operate on a batched AtomicGraph plus explicit atom-index tensors, so bonded terms are correct for molecules wrapped across periodic boundaries while gradients still flow to positions and cell.

Functions

dihedral_cos(data, idx)

Cosine of the dihedral angle over each atom quadruple.

geometric_mean(x, y)

Geometric mean with a differentiable zero (for zero-LJ hydrogens).

pair_vectors(data, a, b)

Minimum-image displacement vectors pos[b] - pos[a].