xnn.common.models.dispersion_fast.d3_direct#
D3 on CPUs with its forces and stress formed without autograd, in PyTorch.
The reference (DFTD3) gets its forces and stress from an autograd
pass through every tensor operation of the evaluation. Here the derivatives are written out: the
coordination numbers with their slope per edge, the Gaussian reference weights with their slope
in the coordination number, the pair C6 with their derivatives in both coordination numbers, the
pair energies with their slope in the distance, and the three-body term from the compiled tiles of
atm_cpu with their gradient
(three_body_direct()). The derivatives through the
C6 collect on the coordination numbers, which carry them to the edges; the edge gradient gives the
forces and the strain derivative (the stress). Evaluation only: the outputs carry no autograd graph.
Molecules up to DENSE_ATOMS atoms take the dense path (d3_dense()): the same derivatives over
every pair i < j and every triangle of atoms, in one call compiled with torch.compile, which leaves no
per-call work in Python beyond the call itself.
Module Attributes
Neighbors per tile of the three-body term for molecules (fastest at 81 and 375 atoms on one and eight threads). |
|
Neighbors per tile for cells (their centers have many neighbors, which fill large tiles). |
|
Most atoms of a molecule for the dense path (every pair and triangle of atoms in one compiled call). |
|
Most atoms of a batch of several molecules for the dense paths. |
|
thread start-up would cost more than it saves). |
|
Inductor options of the dense paths' compiled calls. |
Functions
|
|
|
D3 of a batched graph with its forces, no autograd: the energies per atom and per structure |
|
Whether the dense paths serve |
|
Whether no structure of |
|
The key of |