ls_mlkit.util.nma.force_fields module¶
- class ls_mlkit.util.nma.force_fields.ForceField[source]¶
Bases:
objectSubclasses of this abstract base class define the force constants of the modeled springs between atoms in a Elastic network model.
...is arbitrary number of dimensions, for example, batch size.- Parameters:
n – int, the number of atoms
m – int, the number of edges
cutoff_distance – float or None The interaction of two atoms is only considered, if the distance between them is smaller or equal to this value. If
None, the interaction between all atoms is considered.natoms – […] or None The number of atoms in the model. If a
ForceFielddoes not depend on the respective atoms, i.e. atom_i and atom_j is unused inforce_constant(), this attribute isNoneinstead.contact_shutdown – Tensor, shape=(…, n), dtype=float, optional Indices that point to atoms, whose contacts to all other atoms are artificially switched off. If
None, no contacts are switched off.contact_pair_off – Tensor, shape=(…, m, 2), dtype=int, optional Indices that point to pairs of atoms, whose contacts are artificially switched off. If
None, no contacts are switched off.contact_pair_on – Tensor, shape=(…, m, 2), dtype=int, optional Indices that point to pairs of atoms, whose contacts are are established in any case. If
None, no contacts are artificially switched on.
- property contact_pair_off¶
- property contact_pair_on¶
- property contact_shutdown¶
- property cutoff_distance¶
- abstractmethod force_constant(atom_i: Tensor, atom_j: Tensor, sq_distance: Tensor)[source]¶
Get the force constant for the interaction of the given atoms.
- ABSTRACT:
Override when inheriting.
- Parameters:
atom_i – Tensor, shape=(len(…) + 2, m), len(…)=macro_shape, dtype=int The indices to the first and second atoms in each interacting atom pair.
atom_j – Tensor, shape=(len(…) + 2, m), len(…)=macro_shape, dtype=int The indices to the first and second atoms in each interacting atom pair.
sq_distance – Tensor, shape=(m), dtype=float The distance between the atoms indicated by atom_i and atom_j.
Notes
Implementations of this method do not need to check whether two atoms are within the cutoff distance of the
ForceField: The given pairs of atoms are limited to pairs within cutoff distance of each other. However, if cutoff_distance isNone, the atom indices contain the Cartesian product of all atom indices, i.e. each possible combination.
- property natoms¶
- class ls_mlkit.util.nma.force_fields.HinsenForceField(cutoff_distance: float = None)[source]¶
Bases:
ForceFieldThe Hinsen force field was parametrized using the Amber94 force field for a local energy minimum, with crambin as template. In a strict distance-dependent manner, contacts are subdivided into nearest-neighbour pairs along the backbone (r < 4 Å) and mid-/far-range pair interactions (r >= 4 Å). Force constants for these interactions are computed with two distinct formulas. 2.9 Å is the lowest accepted distance between
CAatoms. Values below that threshold are set to 2.9 Å.- Parameters:
cutoff_distance – float, optional The interaction of two atoms is only considered, if the distance between them is smaller or equal to this value. By default all interactions are included.
- property cutoff_distance¶
- force_constant(atom_i: Tensor, atom_j: Tensor, sq_distance: Tensor)[source]¶
Calculate force constants using the Hinsen force field parameters.
- Parameters:
atom_i – Tensor, indices of first atoms
atom_j – Tensor, indices of second atoms
sq_distance – Tensor, squared distances between atom pairs
- Returns:
Force constants for each atom pair
- Return type:
Tensor
- class ls_mlkit.util.nma.force_fields.InvariantForceField(cutoff_distance: float)[source]¶
Bases:
ForceFieldThis force field treats every interaction with the same force constant.
- Parameters:
cutoff_distance – float The interaction of two atoms is only considered, if the distance between them is smaller or equal to this value.
- property cutoff_distance¶
- force_constant(atom_i: Tensor, atom_j: Tensor = None, sq_distance: Tensor = None)[source]¶
Calculate force constants for atom interactions.
- Parameters:
atom_i – Tensor, shape=(len(…) + 2, m), len(…)=macro_shape, dtype=int
atom_j – Tensor, shape=(len(…) + 2, m), len(…)=macro_shape, dtype=int
sq_distance – Tensor, shape=(m), dtype=float