xnn.dnn.fast.acsf_direct#

The gradient of the atom-centered symmetry functions, written out (HDNNP on CPUs).

The reference (AtomCenteredSymmetryFunctions) gets the forces from an autograd pass through its radial and angular blocks. Here, with the networks’ gradient lam = dE / dG of every atom and symmetry function, the derivative of sum(lam * G) in the edge vectors is formed in one pass over the edges and triplets: each function’s slope in its distances and angle, as the reference’s formulas give them, contracted with lam of its center. The function types 1, 2, 3 and 9 (the factorized angular functions) with any cutoff kind; evaluation only. forward_direct() serves a standalone 2G HDNNP on a CPU (see ForceStressOutput).

Functions

angular_columns(feat, table, sp, n)

The factorized angular functions (types 3 and 9) of every atom (n D,) from angular_table(): each function reads its factors' product of its center and neighbor species pair.

angular_gradients(feat, vec, r, he, dhe, sp, ...)

d sum(lam G) / d v of the factorized angular functions (types 3 and 9) for the first and second edge vector of every triplet, (T, 3) each.

angular_raw(feat, vec, sp, src, e1, e2, ...)

angular_table() from the edge vectors.

angular_table(feat, vec, r, he, dhe, sp, ...)

Every triplet's products of angular and radial factors summed per center and neighbor species pair, (n S^2, (nA + 1) nR).

applies(feat)

Whether the written-out gradient covers feat (no type 8) and torch.compile produces CPU code.

cutoff_slope(r, kind, r_cut, r_inner, exponent)

cutoff_function() and its slope in r.

edge_gradient(feat, vec, sp, src, dst, e1, ...)

d sum(lam G) / d vec per edge (E, 3): the radial functions' and, with angular, the angular functions' of the triplets (e1, e2).

forward_direct(model, data)

A 2G HDNNP on a CPU with its forces and "virial" (dE / d(strain)) from the written-out gradient: the symmetry functions on the compiled blocks without autograd, the networks' gradient dE / dG by autograd, and edge_gradient() compiled.

radial_slopes(feat, r, sp, src, dst, lam)

d sum(lam G) / dr of the radial functions (types 1 and 2), per edge (E,); lam is (N D,).

triplets(edge_index, n, vec, reach)

The triplets of the edges edge_index (rows of vec), as build_triplets() gives them, generated in a compiled call; with reach, only those whose third side is shorter.