ExtendedSpaceState¶
- class ufedmm.ExtendedSpaceState(variables, state)[source]¶
An extension of the openmm.State class.
Methods
- getDynamicalVariables()[source]¶
Gets the values of the extended-space dynamical variables.
- Return type:
list(float)
- Raises:
Exception – If positions were not requested in the
context.getState()call.
Example
>>> import ufedmm >>> import numpy as np >>> model = ufedmm.AlanineDipeptideModel() >>> integrator = ufedmm.CustomIntegrator(300, 0.001) >>> args = [-np.pi, np.pi, 50, 1500, model.phi, 1000] >>> s_phi = ufedmm.DynamicalVariable('s_phi', *args) >>> s_psi = ufedmm.DynamicalVariable('s_psi', *args) >>> context = ufedmm.ExtendedSpaceContext( ... [s_phi, s_psi], model.system, integrator ... ) >>> context.setPositions(model.positions) >>> state = context.getState(getPositions=True) >>> [float(x) for x in state.getDynamicalVariables()] [-3.141592653589793, -3.141592653589793]
- getPositions(asNumpy=False, extended=False, split=True)[source]¶
Gets the positions of all physical particles and optionally also gets the positions of the extra particles from which the extended-space dynamical variables are computed.
- Keyword Arguments:
asNumpy (bool, default=False) – Whether to return Numpy arrays instead of lists of openmm.Vec3.
extended (bool, default=False) – Whether to include the positions of the extra particles from which the extended-space dynamical variables are computed.
split (bool, default=True) – Whether to return the positions of the physical particles and the positions of the extra particles separately.
- Returns:
list(openmm.Vec3) or numpy.ndarray – If extended=False or split=False.
list(openmm.Vec3) or numpy.ndarray, list(float) or numpy.ndarray – If extended=True and split=True.
- Raises:
Exception – If positions were not requested in the
context.getState()call.
- getVelocities(asNumpy=False, extended=False, split=False)[source]¶
Gets the velocities of all physical particles and optionally also gets the velocities of the extra particles associated to the extended- space dynamical variables.
- Keyword Arguments:
asNumpy (bool, default=False) – Whether to return Numpy arrays instead of lists of openmm.Vec3.
extended (bool, default=False) – Whether to include the velocities of the extra particles.
split (bool, default=False) – Whether to return the velocities of the physical particles and the x velocities of the extra particles separately. Only used if extended=True.
- Returns:
list(openmm.Vec3) – If asNumpy=False, and either extended=False or split=False.
numpy.ndarray – If asNumpy=True, and either extended=False or split=False.
list(openmm.Vec3), list(float) – If asNumpy=False, extended=True, and split=True.
numpy.ndarray, numpy.ndarray – If asNumpy=True, extended=True, and split=True.
- Raises:
Exception – If velocities were not requested in the
context.getState()call.