mlcolvar.core.transform.descriptors.CoordinationNumbers¶
- class mlcolvar.core.transform.descriptors.CoordinationNumbers(group_A: list, group_B: list, cutoff: float, n_atoms: int, PBC: bool, cell: float | list, mode: str, scaled_coords: bool = False, switching_function=None, dmax: float = None)[source]¶
Bases:
TransformCoordination number between the elements of two groups of atoms from their positions
- __init__(group_A: list, group_B: list, cutoff: float, n_atoms: int, PBC: bool, cell: float | list, mode: str, scaled_coords: bool = False, switching_function=None, dmax: float = None) Tensor[source]¶
Initialize a coordination number object between two groups of atoms A and B.
- Parameters:
group_A (list) – Zero-based indices of group A atoms
group_B (list) – Zero-based indices of group B atoms
cutoff (float) – Cutoff radius for coordination number evaluation
n_atoms (int) – Total number of atoms in the system
PBC (bool) – Switch for Periodic Boundary Conditions use
cell (Union[float, list]) – Dimensions of the real cell, orthorombic-like cells only
mode (str) – Mode for cutoff application, either: - ‘continuous’: applies a switching function to the distances which can be specified with switching_function keyword, has stable derivatives - ‘discontinuous’: set at zero everything above the cutoff and one below, derivatives may be be incorrect
scaled_coords (bool) – Switch for coordinates scaled on cell’s vectors use, by default False
switching_function (_type_, optional) – Switching function to be applied for the cutoff, can be either initialized as a switching_functions/SwitchingFunctions class or a simple function, by default None
dmax (float, optional) – Distance at which, if set, the switching function will be forced to be zero by strecthing it and shifting it, by default None.
- Returns:
Coordination numbers of elements of group A with respect to elements of group B
- Return type:
torch.Tensor
Methods
__init__(group_A, group_B, cutoff, n_atoms, ...)Initialize a coordination number object between two groups of atoms A and B.
compute_coordination_number(pos)forward(pos)Define the computation performed at every call.
- forward(pos)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- setup_from_datamodule(datamodule)¶
Initialize parameters based on pytorch lighting datamodule.
Attributes
T_destination
call_super_init
dump_patches
training