Desc#

class mbgdml._gdml.desc.Desc(n_atoms, max_processes=None)[source]#

Generate descriptors and their Jacobians for molecular geometries, including support for periodic boundary conditions.

Parameters:
  • n_atoms (int) – Number of atoms in the represented system.

  • max_processes (int, default: None) – Limit the max. number of processes. Otherwise all CPU cores are used.

d_desc_from_comp(R_d_desc, out=None)[source]#

Convert a compressed representation of a descriptor Jacobian back to its full representation.

The compressed representation omits all zeros and scales with \(N\) instead of \(N(N-1)/2\).

Parameters:
  • R_d_desc (numpy.ndarray or torch.tensor) – Array of size \(M \times N \times N \times 3\) containing the compressed descriptor Jacobian.

  • out (numpy.ndarray or torch.tensor, optional) – Output argument. This must have the exact kind that would be returned if it was not used.

Note

If used, the output argument must be initialized with zeros!

Returns:

Array of size \(M \times N(N-1)/2 \times 3N\) containing the full representation.

Return type:

numpy.ndarray or torch.tensor

d_desc_to_comp(R_d_desc)[source]#

Convert a descriptor Jacobian to a compressed representation.

The compressed representation omits all zeros and scales with \(N\) instead of \(N(N-1)/2\).

Parameters:

R_d_desc (numpy.ndarray) – Array of size \(M \times N(N-1)/2 \times 3N\) containing the descriptor Jacobian.

Returns:

Array of size \(M \times N \times N \times 3\) containing the compressed representation.

Return type:

numpy.ndarray

from_R(R, lat_and_inv=None, max_processes=None)[source]#

Generate descriptor and its Jacobian for multiple molecular geometries in Cartesian coordinates.

Parameters:
  • R (numpy.ndarray) – Array of size \(M \times 3N\) containing the Cartesian coordinates of each atom.

  • lat_and_inv (tuple of numpy.ndarray, default: None) – Tuple of \(3 \times 3\) matrix containing lattice vectors as columns and its inverse.

  • max_processes (int, default: None) – Limit the max number of processes. Otherwise all CPU cores are used. This parameter overwrites the global setting as set during initialization.

Returns:

  • numpy.ndarray – Array of size \(M \times N(N-1)/2\) containing the descriptor representation for each geometry.

  • numpy.ndarray – Array of size \(M \times N(N-1)/2 \times 3N\) containing all partial derivatives of the descriptor for each geometry.

static perm(perm)[source]#

Convert atom permutation to descriptor permutation.

A permutation of \(N\) atoms is converted to a permutation that acts on the corresponding descriptor representation. Applying the converted permutation to a descriptor is equivalent to permuting the atoms first and then generating the descriptor.

Parameters:

perm (numpy.ndarray) – Array of size N containing the atom permutation.

Returns:

Array of size \(N(N-1)/2\) containing the corresponding descriptor permutation.

Return type:

numpy.ndarray