xnn.dnn.featurizers.acsf.AtomCenteredSymmetryFunctions#

class xnn.dnn.featurizers.acsf.AtomCenteredSymmetryFunctions(species, cutoffs, functions, mode='none', scale_range=(0.0, 1.0))[source]#

Bases: Featurizer

Behler atom-centered symmetry functions, a separate list per element.

Parameters:
  • species (sequence of int or str) – The elements; the descriptor rows of atoms of other elements are zero.

  • cutoffs (sequence of dict) – The cutoff functions, each {"kind", "r_cut"} plus r_inner (cosine, tanh, tanh_approx) or exponent (polynomial); functions refer to them by position.

  • functions (sequence of dict) – The symmetry functions, each with element, type (1, 2, 3, 8 or 9), neighbors (one element for types 1 and 2, two for the angular types, in any order), cutoff (index into cutoffs, default 0) and the parameters of its type: eta and rs (2), eta, lambda and zeta (3 and 9), theta_s and eta in degrees (8), n_features (1). An element’s features keep the order of the list.

  • mode (str, optional) – Scaling mode, one of SCALING_MODES, by default "none".

  • scale_range (tuple of float, optional) – (s_min, s_max) of the "range" mode, by default (0, 1).

Variables:
  • species (list[int]) – The elements.

  • n_features (dict[int, int]) – Number of features of every element.

  • cutoff (float) – Neighbour-list radius, the largest cutoff.

  • stat_avg (stat_min, stat_max,) – Scaling statistics (n_species, output_dim).

property output_dim: int#

Length of the (zero-padded) descriptor, the largest feature count of an element.

Type:

int

raw(data)[source]#

The unscaled descriptor (N, output_dim) (zero beyond each element’s features).

Parameters:

data (AtomicGraph)

Return type:

Tensor

scaling()[source]#

The (shift, factor) of G' = (G - shift) * factor, each (n_species, output_dim).

Return type:

tuple[Tensor, Tensor]

forward(data)[source]#

The scaled descriptor (N, output_dim); columns beyond an element’s features are zero.

Parameters:

data (AtomicGraph) – Atomic graph providing atomic numbers, edge index and edge vectors.

Returns:

Per-atom descriptors.

Return type:

Tensor

fit_scaling(graphs, mode=None)[source]#

Set stat_min, stat_max and stat_avg from the atoms of graphs.

Parameters:
  • graphs (iterable of AtomicGraph) – Training structures (single graphs or batches).

  • mode (str, optional) – Also switch the scaling mode.

Return type:

None