DynamicalVariable¶
- class ufedmm.DynamicalVariable(id, min_value, max_value, mass, temperature, colvars, potential, periodic=True, sigma=None, grid_size=None, **parameters)[source]¶
An extended phase-space variable, whose dynamics is coupled to that of one of more collective variables of a system.
The coupling occurs in the form of a potential energy term involving this dynamical variable and its associated collective variables.
The default potential is a harmonic driving of the type:
\[V(s, \mathbf r) = \frac{\kappa}{2} [s - q(\mathbf r)]^2\]where \(s\) is the new dynamical variable, \(q(\mathbf r)\) is its associated collective variable, and \(kappa\) is a force constant.
- Parameters:
id (str) – A valid identifier string for this dynamical variable.
min_value (float or unit.Quantity) – The minimum allowable value for this dynamical variable.
max_value (float or unit.Quantity) – The maximum allowable value for this dynamical variable.
mass (float or unit.Quantity) – The mass assigned to this dynamical variable, whose unit of measurement must be compatible with unit.dalton*(unit.nanometers/X)**2, where X is the unit of measurement of the dynamical variable itself.
temperature (float or unit.Quantity) – The temperature of the heat bath attached to this variable.
colvars (
CollectiveVariableor list thereof) – Either a single colective variable or a list.potential (float or unit.Quantity or str) – Either the value of the force constant of a harmonic driving potential or an algebraic expression giving the energy of the system as a function of this dynamical variable and its associated collective variable. Such expression can also contain a set of global parameters, whose values must be passed as keyword arguments (see below).
- Keyword Arguments:
periodic (bool, default=True) – Whether the collective variable is periodic with period L=max_value-min_value.
sigma (float or unit.Quantity, default=None) – The standard deviation. If this is None, then no bias will be considered.
grid_size (int, default=None) – The grid size. If this is None and sigma is finite, then a convenient value will be automatically chosen.
**parameters – Names and values of global parameters present in the algebraic expression defined as potential (see above).
Example
>>> import openmm >>> import ufedmm >>> from openmm import unit >>> cv = ufedmm.CollectiveVariable('psi', openmm.CustomTorsionForce('theta')) >>> cv.force.addTorsion(0, 1, 2, 3, []) 0 >>> mass = 50*unit.dalton*(unit.nanometer/unit.radians)**2 >>> K = 1000*unit.kilojoules_per_mole/unit.radians**2 >>> Ts = 1500*unit.kelvin >>> ufedmm.DynamicalVariable( ... 's_psi', -180*unit.degrees, 180*unit.degrees, mass, Ts, cv, K ... ) <s_psi in [-3.141592653589793, 3.141592653589793], periodic, m=50, T=1500>
Methods
- evaluate(x, Lx)[source]¶
Computes the value of this dynamical variable for a given x coordinate and a given length of the simulation box in the x direction.
- Parameters:
x (float or unit.Quantity) – The x coordinate.
Lx (float or unit.Quantity) – The length of the simulation box in the x direction.
- Return type:
float