ls_mlkit.util.nma.anm module

class ls_mlkit.util.nma.anm.ANM(atoms: Tensor, force_field: ForceField, masses=None, device='cuda', node_mask: Tensor = None)[source]

Bases: object

Anisotropic Network Model.

Parameters:
  • hessian – tensor, shape=``(…, n*3, n*3)``, dtype=float The Hessian matrix for this model. Each dimension is partitioned in the form [x1, y1, z1, ... xn, yn, zn]. This is not a copy: Create a copy before modifying this matrix.

  • masses – tensor, shape=(…, n), dtype=float The mass for each atom, None if no mass weighting is applied.

compute_hessian(coord: Tensor, force_field: ForceField, device, use_cell_list=False, node_mask: Tensor = None)[source]

Compute the Hessian matrix for atoms with given coordinates and the chosen force field.

Parameters:
  • coord – tensor, shape=(…, n, 3), dtype=float The coordinates.

  • force_field – ForceField, natoms=(…, n) The ForceField that defines the force constants.

  • use_cell_list – bool, optional If true, a cell list is used to find atoms within cutoff distance instead of checking all pairwise atom distances. This significantly increases the performance for large number of atoms, but is slower for very small systems. If the force_field does not provide a cutoff, no cell list is used regardless.

  • node_mask – tensor, shape=(…, n), dtype=long, optional, 1 for valid nodes, 0 for invalid nodes

Returns:

tensor, shape=(…, n*3, n*3), dtype=float

The computed Hessian matrix. Each dimension is partitioned in the form [x1, y1, z1, ... xn, yn, zn].

pairstensor, shape=(len(…) + 2, m), dtype=int

Indices for interacting atoms, i.e. atoms within cutoff_distance.

Return type:

hessian

eigen(epsilon=1e-07)[source]

Compute the Eigenvalues and Eigenvectors of the Hessian matrix. The first six Eigenvalues/Eigenvectors correspond to trivial modes (translations/rotations) and are usually omitted in normal mode analysis.

Returns:

tensor, shape=(…, n*3), dtype=float

Eigenvalues of the Hessian matrix in ascending order.

eig_vectorstensor, shape=(…, n*3, n*3), dtype=float

Eigenvectors of the Hessian matrix. Eigenvectors will have the same dtype as the Hessian matrix and will contain the eigenvectors as its columns.

Return type:

eig_values

get_displacements_from_normal_modes(indexes: list[int])[source]

Get the displacement vectors for the given normal modes.

Parameters:

indexes – list of integers, the indexes of the normal modes.

Returns:

tensor of shape (…, 3n, len(indexes)), where n is the number of atoms.

Return type:

displacement_vectors

property hessian
property masses
ls_mlkit.util.nma.anm.N_A = 6.02214076e+23

Boltzmann distribution $$ P(x) propto exp left(-frac{1}{2k_BT}(x-x_0)^T H(x-x_0)right) $$ Multi-dimensional Gaussian distribution $$ P(x) propto exp left(-frac{1}{2}(x-mu)^T Sigma^{-1}(x-mu)right) $$