SOAP descriptor

class mlptrain.descriptor.soap_descriptor.SoapDescriptor(elements: Sequence[str] | None = None, r_cut: float = 5.0, n_max: int = 6, l_max: int = 6, average: str | None = 'inner')

Bases: Descriptor

SOAP Descriptor Representation.

__init__(elements: Sequence[str] | None = None, r_cut: float = 5.0, n_max: int = 6, l_max: int = 6, average: str | None = 'inner')

SOAP Descriptor Representation.

Initializes a SOAP descriptor for computing the Smooth Overlap of Atomic Positions (SOAP) representation.

Parameters:
  • elements (Optional[Sequence[str]]) – Atomic species (e.g., [‘H’, ‘O’]) for which the SOAP descriptor is computed. If None, elements will be inferred from input configurations.

  • r_cut (float) – Cutoff radius (Å) for considering atomic neighbors, defining the spatial range for SOAP calculations.

  • n_max (int) – Number of radial basis functions, affecting the resolution in the radial direction.

  • l_max (int) – Maximum degree of spherical harmonics, controlling the angular resolution.

  • average (Optional[str]) – Averaging mode for the SOAP descriptor: - “inner” (default): Averages SOAP vectors before computing the power spectrum. - “outer”: Computes the power spectrum for each atom, then averages. - None: No averaging, returns per-atom descriptors.

compute_representation(configurations: Configuration | ConfigurationSet) ndarray

Create a SOAP vector using dscribe (https://github.com/SINGROUP/dscribe) for a set of configurations

soap_vector(config) -> [[v0, v1, ..]]

soap_vector(config1, config2) -> [[v0, v1, ..],

[u0, u1, ..]]

soap_vector(configset) -> [[v0, v1, ..], ..]

Returns: np.ndarray: SOAP descriptor matrix of shape (m, n), where:

  • m is the number of input configurations.

  • n is the descriptor dimensionality, dependent on n_max and l_max.

kernel_vector(configuration: Configuration, configurations: ConfigurationSet, zeta: int = 4) ndarray

Calculate the kernel matrix between a set of configurations where the kernel is:

\[K(p_a, p_b) = (p_a . p_b / (p_a.p_a x p_b.p_b)^1/2 )^ζ\]
Parameters:

zeta – Power to raise the kernel matrix to

Returns:

Vector, shape = len(configurations)

Return type:

(np.ndarray)