xnn.common.models.dispersion_fast.d4_direct#
D4 on CPUs with its forces and stress formed without autograd, in PyTorch.
The reference (DFTD4) gets its forces from an autograd pass through
every tensor operation of the evaluation. Here the derivatives are written out, as dftd4 does: the
two coordination numbers with their slope per edge, the EEQ charges of each molecule from the dense
linear system and, for the gradient, its adjoint solve, the dynamic polarizabilities with their
derivatives in the coordination number and the charge, the two-body energies with their slope in
the distance and in the polarizabilities, and the three-body term from the compiled tiles of
atm_cpu with their gradient (C6 of the neutral atoms).
For a cell the EEQ matrix is the reference’s Ewald sum; its derivative in the positions and the
cell, contracted with the adjoint and the charges, is the one autograd pass left, over that matrix
alone (the tail correction likewise over its own formula). Evaluation only: the outputs carry no
autograd graph.
Molecules up to DENSE_ATOMS atoms in the dense EEQ regime take the dense path (d4_dense()):
one EEQ system for the batch, the pairs i < j and the triangles of atoms, in one compiled call.
Module Attributes
Most atoms of a molecule for the dense path (every pair and triangle of atoms in one compiled call). |
Functions
|
|
|
D4 of a batch (molecules and cells of the dense EEQ regime) with its forces and stress: the energies per atom and per structure |
|
Whether |