ReflectiveBounds¶
- class openxps.bounds.ReflectiveBounds(lower, upper, unit)[source]¶
A reflective boundary condition. The dynamical variable collides elastically with the upper and lower bounds and is reflected back into the range.
- Parameters:
lower (float) – The lower bound for the dynamical variable.
upper (float) – The upper bound for the dynamical variable.
unit (cvpack.units.units.Unit) – The unit of measurement of the bounds. If the bounds do not have a unit, use
dimensionless.
Example
>>> import openxps as xps >>> from openmm import unit >>> bounds = xps.ReflectiveBounds(1, 10, unit.angstrom) >>> bounds == xps.ReflectiveBounds(0.1, 1, unit.nanometer) True >>> print(bounds) ReflectiveBounds(lower=1.0, upper=10.0, unit=A)
Methods
- leptonExpression(variable)[source]¶
Return a lepton expression representing the transformation from an unwrapped variable to a wrapped value under the boundary conditions.
- Parameters:
variable (str) – The name of the variable in the expression.
- Returns:
A string representing the transformation.
- Return type:
str
Example
>>> import openxps as xps >>> from openmm import unit >>> periodic = xps.bounds.PeriodicBounds(-180, 180, unit.degree) >>> print(periodic.leptonExpression("x")) (scaled_x-floor(scaled_x))*360.0-180.0; scaled_x=(x+180.0)/360.0 >>> reflective = xps.bounds.ReflectiveBounds(1, 10, unit.angstrom) >>> print(reflective.leptonExpression("y")) min(wrapped_y,1-wrapped_y)*18.0+1.0; wrapped_y=scaled_y-floor(scaled_y); scaled_y=(y-1.0)/18.0
- wrap(value, rate)[source]¶
Wrap a value around the bounds and adjust its rate of change.
- Parameters:
value (float) – The unwrapped value, in the same unit of measurement as the bounds.
rate (float) – The rate of change of the unwrapped value, in the same unit of measurement as the bounds divided by a time unit.
- Returns:
float – The wrapped value, in the same unit of measurement as the bounds.
float – The adjusted rate of change of the wrapped value, in the same unit of measurement as the original rate.
- Return type:
tuple[float, float]