NoBounds

class openxps.bounds.NoBounds(lower, upper, unit)[source]

Boundary condition indicating no confinement for a dynamical variable.

Parameters:
  • lower (float) – A typical low value for the dynamical variable, not an actual bound.

  • upper (float) – A typical high value for the dynamical variable, not an actual bound.

  • 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
>>> import yaml
>>> from openmm import unit
>>> bounds = xps.NoBounds(0, 1, unit.dimensionless)
>>> print(bounds)
NoBounds(lower=0.0, upper=1.0, unit=dimensionless)
>>> assert yaml.safe_load(yaml.safe_dump(bounds)) == bounds

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]