BioSimSpace.Metadynamics.CollectiveVariable.Distance#
- class BioSimSpace.Metadynamics.CollectiveVariable.Distance(atom0, atom1, hill_width=0.1000 nm, weights0=None, weights1=None, is_com0=None, is_com1=None, lower_bound=None, upper_bound=None, grid=None, component=None, pbc=True)[source]#
A class for distance based collective variables.
- __init__(atom0, atom1, hill_width=0.1000 nm, weights0=None, weights1=None, is_com0=None, is_com1=None, lower_bound=None, upper_bound=None, grid=None, component=None, pbc=True)[source]#
Constructor.
- Parameters:
atom0 (int, [int, int, …],
Coordinate
) – The atom, group of atoms, or coordinate, that the distance will be measured from.atom1 (int, [int, int, …],
Coordinate
) – The atom, group of atoms, or coordinate, that the distance will be measured to.hill_width (
Length
) – The width of the Gaussian hill used to sample this variable.weights0 ([float]) – A list of weights to be used when computing the center of the first atom group. This is ignored when a single index is passed for ‘atom0’.
weights1 ([float]) – A list of weights to be used when computing the center of the second atom group. This is ignored when a single index is passed for ‘atom1’.
is_com0 (bool) – Whether to compute the center of mass of the first atom group. If True, this option will take precedence over any weights passed in via ‘weights0’.
is_com1 (bool) – Whether to compute the center of mass of the second atom group. If True, this option will take precedence over any weights passed in via ‘weights1’.
lower_bound (
Bound
) – A lower bound on the value of the collective variable.upper_bound (
Bound
) – An upper bound on the value of the collective variable.grid (
Grid
) – The grid on which the collective variable will be sampled. This can help speed up long metadynamics simulations where the number of Gaussian kernels can become prohibitive.component (str) – Whether to use the ‘x’, ‘y’, or ‘z’ component of the distance as the collective variable. If None, then the full Euclidean distance is used.
pbc (bool) – Whether to use periodic boundary conditions when computing the collective variable.
Methods
__init__
(atom0, atom1[, hill_width, ...])Constructor.
getAtom0
()Return the atom, atoms, or coordinate, that the distance will be measured from.
getAtom1
()Return the atom, atoms, or coordinate, that the distance will be measured to.
getCoM0
()Whether to compute the center of mass of the first atom group.
getCoM1
()Whether to compute the center of mass of the first second group.
Whether to use the 'x', 'y', or 'z' component of the distance as the collective variable.
getGrid
()Get the grid on which the collective variable is sampled.
Return the width of the Gaussian hill used to bias this collective variable.
Get the lower bound on the collective variable.
Return whether to take account of periodic boundary conditions when computing the collective variable.
Get the upper bound on the collective variable.
Get the weights to be used when computing the center of the first atom group.
Get the weights to be used when computing the center of the second atom group.
Return the number of components for the collective variable.
setAtom0
(atom0)Set the atom, atoms, or coordinate from which the distance will be measured.
setAtom1
(atom1)Set the atom, atoms, or coordinate to which the distance will be measured.
setCoM0
([is_com])Set whether to compute the center of mass of the first atom group.
setCoM1
([is_com])Set whether to compute the center of mass of the second atom group.
setComponent
([component])Whether to use the 'x', 'y', or 'z' component of the distance as the collective variable.
setGrid
([grid])Set a grid on which the collective variable will be sampled.
setHillWidth
(hill_width)Set the width of the Gaussian hills used to bias this collective variable.
setLowerBound
([lower_bound])Set a lower bound on the value of the collective variable.
Set whether to use periodic_boundaries when calculating the collective variable.
setUpperBound
([upper_bound])Set an upper bound on the value of the collective variable.
setWeights0
([weights0])Set the weights to be used when computing the center of the first atom group.
setWeights1
([weights1])Set the weights to be used when computing the center of the second atom group.
- getAtom0()[source]#
Return the atom, atoms, or coordinate, that the distance will be measured from.
- Returns:
atom0 – The atom, group of atoms, or coordinate, that the distance will be measured from.
- Return type:
int, [int, int, …], [
Length
]
- getAtom1()[source]#
Return the atom, atoms, or coordinate, that the distance will be measured to.
- Returns:
atom1 – The atom, group of atoms, or coordinate, that the distance will be measured to.
- Return type:
int, [int, int, …], [
Length
]
- getCoM0()[source]#
Whether to compute the center of mass of the first atom group. If True, this option will take precedence over any weights that may have been set.
- Returns:
is_com0 – Whether to compute the center of mass of the first atom group.
- Return type:
bool
- getCoM1()[source]#
Whether to compute the center of mass of the first second group. If True, this option will take precedence over any weights that may have been set.
- Returns:
is_com1 – Whether to compute the center of mass of the first atom group.
- Return type:
bool
- getComponent()[source]#
Whether to use the ‘x’, ‘y’, or ‘z’ component of the distance as the collective variable. If unset, then the full Euclidean distance is used.
- Returns:
component – ‘x’, ‘y’, or ‘z’
- Return type:
str
- getGrid()#
Get the grid on which the collective variable is sampled.
- Returns:
grid – The grid on which the collective variable is sampled.
- Return type:
- getHillWidth()[source]#
Return the width of the Gaussian hill used to bias this collective variable.
- Returns:
hill_width – The width of the Gaussian hill.
- Return type:
- getLowerBound()#
Get the lower bound on the collective variable.
- Returns:
lower_bound – The lower bound on the value of the collective variable.
- Return type:
- getPeriodicBoundaries()[source]#
Return whether to take account of periodic boundary conditions when computing the collective variable.
- Returns:
pbc – Whether to use periodic boundaries conditions.
- Return type:
bool
- getUpperBound()#
Get the upper bound on the collective variable.
- Returns:
upper_bound – The upper bound on the value of the collective variable.
- Return type:
- getWeights0()[source]#
Get the weights to be used when computing the center of the first atom group.
- Returns:
weights0 – A list of weights to be used when computing the center of the first atom group.
- Return type:
[float]
- getWeights1()[source]#
Get the weights to be used when computing the center of the second atom group.
- Returns:
weights1 – A list of weights to be used when computing the center of the second atom group.
- Return type:
[float]
- nComponents()#
Return the number of components for the collective variable.
- setAtom0(atom0)[source]#
Set the atom, atoms, or coordinate from which the distance will be measured.
- Parameters:
atom0 (int, [int, int, …], [
Length
]) – The atom, group of atoms, or coordinate, that the distance will be measured from.
- setAtom1(atom1)[source]#
Set the atom, atoms, or coordinate to which the distance will be measured.
- Parameters:
atom1 (int, [int, int, …], [
Length
]) – The atom, group of atoms, or coordinate, that the distance will be measured to.
- setCoM0(is_com=None)[source]#
Set whether to compute the center of mass of the first atom group. If True, this option will take precedence over any weights that may have been set. Can be called with no arguments to clear the data.
- Parameters:
is_com (bool) – Whether to compute the center of mass of each atom group.
- setCoM1(is_com=None)[source]#
Set whether to compute the center of mass of the second atom group. If True, this option will take precedence over any weights that may have been set. Can be called with no arguments to clear the data.
- Parameters:
is_com (bool) – Whether to compute the center of mass of each atom group.
- setComponent(component=None)[source]#
Whether to use the ‘x’, ‘y’, or ‘z’ component of the distance as the collective variable. If unset, then the full Euclidean distance is used. Can be called with no argument to clear the data.
- Parameters:
component (str) – ‘x’, ‘y’, or ‘z’
- setGrid(grid=None)#
Set a grid on which the collective variable will be sampled. Call with no arguments to clear the grid.
- Parameters:
grid (
Grid
) – A grid for the collective variable.
- setHillWidth(hill_width)[source]#
Set the width of the Gaussian hills used to bias this collective variable.
- hill_width
Length
The width of the Gaussian hill.
- hill_width
- setLowerBound(lower_bound=None)#
Set a lower bound on the value of the collective variable.
- Parameters:
lower_bound (
Bound
) – A lower bound on the value of the collective variable.
- setPeriodicBoundaries(pbc)[source]#
Set whether to use periodic_boundaries when calculating the collective variable.
- Parameters:
pbc (bool) – Whether to use periodic boundaries conditions.
- setUpperBound(upper_bound=None)#
Set an upper bound on the value of the collective variable.
- Parameters:
upper_bound (
Bound
) – An upper bound on the value of the collective variable.