xnn.dnn.featurizers.symmetry_functions#

Atom-centered symmetry functions (Behler-Parrinello / ANI style).

Standalone, independently usable featurizers:

sf = RadialSymmetryFunctions(species=[1, 6, 8], cutoff=6.0)
desc = sf(graph)            # (N, sf.output_dim) invariant per-atom descriptor

They are element-resolved: contributions from neighbours are bucketed by the neighbour’s chemical species (and, for the angular term, by the unordered pair of neighbour species), which is what gives the descriptor chemical awareness.

Two knobs make the same math cover both the original Behler-Parrinello (BP, 2007) convention and the ANI / NeuroChem convention used by torchani (see Smith et al. 2017, and aiqm/torchani):

  • prefactor on the radial term – 1.0 for BP (eqn 3 of the ANI paper as written), 0.25 for ANI/NeuroChem (torchani multiplies the radial term by 0.25; it is a constant absorbed by the network’s first layer and does not change expressiveness).

  • cos_factor applied to cos(theta) before acos in the angular term – 1.0 for BP, 0.95 for ANI/NeuroChem (torchani scales the cosine by 0.95 so acos never sees exactly +-1, where its gradient is infinite).

With prefactor=0.25 and cos_factor=0.95 these featurizers reproduce torchani.AEVComputer element-for-element for the same parameter grid.

Classes

AngularSymmetryFunctions(species[, cutoff, ...])

ANI-style angular AEV term, resolved by unordered neighbour-species pair.

RadialSymmetryFunctions(species[, cutoff, ...])

Behler G2 radial symmetry functions, resolved by neighbour species.