Abstract Collective Variables¶
Overview
Abstract base class for defining collective variables |
|
|
Collective variable that specifies a Cartesian Axis in addition. |
|
Collective variable that takes group of length 2. |
|
Collective variable that takes group of length 3. |
|
Collective variable that takes group of length 4. |
Details
Abstract base classes for collective variables.
- class pysages.colvars.core.CollectiveVariable(indices, group_length=None)¶
Abstract base class for defining collective variables
When defining a new collective variable. Override the constructor if you need to enforce any invariant over the indices (it can otherwise be omitted).
- Parameters:
indices (Union[list[int], list[tuple(int)]]) – Must be a list or tuple of atoms (integers or ranges) or groups of atoms. A group is specified as a nested list or tuple of atoms.
group_length (Optional[int]) – Specify if a fixed group length is expected.
- property multicomponent¶
Indicates whether the collective variable is tensor valued or not.
- abstract property function¶
Returns an external method that implements the actual computation of the collective variable.
- class pysages.colvars.core.AxisCV(indices, axis, group_length=None)¶
Collective variable that specifies a Cartesian Axis in addition.
- Parameters:
indices (list[int], list[tuple(int)]) – Must be a list or tuple of atoms (integers or ranges) or groups of atoms. A group is specified as a nested list or tuple of atoms.
axis (int) – Index of the Cartesian coordinate: 0 (X), 1 (Y), 2 (Z)
group_length (int, optional) – Specify if a fixed group length is expected.
- class pysages.colvars.core.TwoPointCV(indices)¶
Collective variable that takes group of length 2.
- Parameters:
indices (list[tuple(int)]) – Must be a group (size 2) of atoms. A group is specified as a nested list or tuple of atoms.
- class pysages.colvars.core.ThreePointCV(indices)¶
Collective variable that takes group of length 3.
- Parameters:
indices (list[tuple(int)]) – Must be a group (size 3) of atoms. A group is specified as a nested list or tuple of atoms.
- class pysages.colvars.core.FourPointCV(indices)¶
Collective variable that takes group of length 4.
- Parameters:
indices (list[tuple(int)]) – Must be a group (size 4) of atoms. A group is specified as a nested list or tuple of atoms.
- pysages.colvars.core.multicomponent(cls)¶
Class decorator for multi-component (tensor-valued) collective variables. By default CVs are assumed to be scalar-valued functions, so multi-component ones have to be annotated as such.
Example
>>> from pysages.colvars.core import TwoPointCV, multicomponent >>> @multicomponent >>> class Displacement(TwoPointCV): >>> def function(self): >>> return lambda r1, r2: r2 - r1
- pysages.colvars.core.build(cv: CollectiveVariable, *cvs: CollectiveVariable, differentiate: bool = True)¶
Jit compile and stack collective variables.
- Parameters:
cv (CollectiveVariable) – Collective Variable object to jit compile.
cvs (list[CollectiveVariable]) – Sequence of Collective variables that get stacked on top of each other.
differentiate (bool = True) – Indicates whether to differentiate the collective variables.
- Returns:
Jit compiled function, that takes a snapshot object, and access its positions and indices. With this information the collective variables (and their derivatives if differentiate is True) are computed and returned.
- Return type:
Callable[Snapshot]