xnn.dnn.fast.aev_kernels#

Triton kernels and autograd functions of the AEV fast path (see xnn.dnn.fast.aev).

Imported only when the fast path runs, so that triton is needed only there.

The radial term sums g_l(r_e) = p exp(-eta_l (r_e - Rs_l)^2) fc(r_e) over the edges of a center into the block of the neighbor’s species; the angular term sums g_l = A_l(theta_t) R_l(r1_t, r2_t) over the neighbor pairs of a center into the block of their species pair, with A_l = ((1 + cos(theta - theta_s,l)) / 2)^zeta_l and R_l = 2 exp(-eta_l ((r1 + r2) / 2 - Rs_l)^2) fc(r1) fc(r2) (the ANI form, the 2^(1-zeta) folded in). The kernels take the per-edge distances and the per-triplet (r1, r2, theta); the geometry before them (norms, the angle) stays in PyTorch.

Every term has four kernels: the sums (one program per center over its edges or triplets in center order, accumulated in registers, so no atomic adds and the same result in every run), the gradient with respect to the inputs (one program per block of edges or triplets), and the two derivatives of that gradient, with respect to the incoming gradient (the sums again, of the first partial derivatives along a tangent) and with respect to the inputs (second partial derivatives). The gradient is therefore differentiable once, which is what a force loss needs for training.

Module Attributes

BLOCK

Edges or triplets per program of the gradient kernels.

BLOCK_FACTORED

Triplets per program of the factored angular gradient (its tiles are three-dimensional).

Classes

AngularFunction(*args, **kwargs)

The angular AEV (N, NB P) from the triplets' (r1, r2, theta) (center order).

AngularGradFunction(*args, **kwargs)

The gradient of AngularFunction with respect to (r1, r2, theta), differentiable once.

AngularSpec(etas, zetas, rs, ts, n_pairs, cutoff)

The constants of an angular term from the axes of its grid (eta, zeta, Rs, theta_s).

RadialFunction(*args, **kwargs)

The radial AEV (N, S P) from the edge distances (E,).

RadialGradFunction(*args, **kwargs)

The gradient of RadialFunction with respect to the distances, differentiable once.

RadialSpec(eta, rs, n_species, prefactor, cutoff)

The constants of a radial term: lane tables (P,), species count, prefactor, cutoff.