Package ffx.potential.constraint
Class SettleConstraint
java.lang.Object
ffx.potential.constraint.SettleConstraint
- All Implemented Interfaces:
Constraint
SETTLE triatomic distance constraints, intended for rigid water models.
S. Miyamoto and P.A. Kollman, "SETTLE: An Analytical Version of the SHAKE and RATTLE Algorithm for Rigid Water Models", Journal of Computational Chemistry, Vol. 13, No. 8, 952-962 (1992)
- Since:
- 1.0
- Author:
- Michael J. Schnieders, Jacob M. Litman
-
Method Summary
Modifier and TypeMethodDescriptionvoid
applyConstraintToStep
(double[] xPrior, double[] xNew, double[] masses, double tol) Applies this Constraint in the context of a partially calculated MD time-step.void
applyConstraintToVelocities
(double[] x, double[] v, double[] masses, double tol) Applies this Constraint to velocities, ensuring relative velocities are perpendicular to constrained bonds, etc., without affecting positions.int[]
Returns the atomic XYZ indices of all Atoms constrained.boolean
constraintSatisfied
(double[] x, double tol) Checks if this Constraint is satisfied.boolean
constraintSatisfied
(double[] x, double[] v, double xTol, double vTol) Checks if this Constraint is satisfied.int
Returns the number of degrees of freedom this Constraint constrains.static SettleConstraint
settleFactory
(Angle a012) Constructs a SETTLE constraint from an angle and its two bonds.
-
Method Details
-
settleFactory
Constructs a SETTLE constraint from an angle and its two bonds. Factory used mostly to avoid a leaking-this scenario, as this method also passes the new SETTLE constraint to a012.- Parameters:
a012
- Angle to construct a SETTLE constraint from.- Returns:
- New SettleConstraint.
-
applyConstraintToStep
public void applyConstraintToStep(double[] xPrior, double[] xNew, double[] masses, double tol) Description copied from interface:Constraint
Applies this Constraint in the context of a partially calculated MD time-step. All arrays are globally indexed (i.e. includes all system atoms, not just the constrained ones).If there is no prior step (e.g. a newly loaded system that has not yet been rigidified), xPrior and xNew can be copies of each other when passed to the method.
xPrior corresponds to atomCoordinates in the OpenMM constraint code. Ours will be in Angstroms, not nm. xNew corresponds to atomCoordinatesP in the OpenMM constraint code. Ours will be in Angstroms, not nm.
- Specified by:
applyConstraintToStep
in interfaceConstraint
- Parameters:
xPrior
- Atomic coordinates prior to the time-step to be constrained.xNew
- Atomic coordinates after the time-step; updated in-place to satisfy the constraint.masses
- Masses.tol
- Acceptable constraint tolerance for numerical methods, as a fraction of bond length.
-
applyConstraintToVelocities
public void applyConstraintToVelocities(double[] x, double[] v, double[] masses, double tol) Description copied from interface:Constraint
Applies this Constraint to velocities, ensuring relative velocities are perpendicular to constrained bonds, etc., without affecting positions. All arrays are globally indexed (i.e. includes all system atoms, not just the constrained ones).Our positions will be in Angstroms, and velocities in Angstroms/ps, compared to the OpenMM nm and nm/ps.
- Specified by:
applyConstraintToVelocities
in interfaceConstraint
- Parameters:
x
- Atomic coordinates (unchanged).v
- Velocities (updated in-place to satisfy constraints).masses
- Masses.tol
- Acceptable constraint tolerance for numerical methods; likely in Angstroms/ps
-
constrainedAtomIndices
public int[] constrainedAtomIndices()Description copied from interface:Constraint
Returns the atomic XYZ indices of all Atoms constrained. Guaranteed to be unique. The primary assumption will be that variables are in sets of 3x Cartesian coordinates.- Specified by:
constrainedAtomIndices
in interfaceConstraint
- Returns:
- All indices of constrained Atoms.
-
constraintSatisfied
public boolean constraintSatisfied(double[] x, double tol) Description copied from interface:Constraint
Checks if this Constraint is satisfied.- Specified by:
constraintSatisfied
in interfaceConstraint
- Parameters:
x
- Input coordinates to check.tol
- Numerical tolerance as a fraction of bond stretch.- Returns:
- Whether this Constraint is satisfied.
-
constraintSatisfied
public boolean constraintSatisfied(double[] x, double[] v, double xTol, double vTol) Description copied from interface:Constraint
Checks if this Constraint is satisfied. Also checks velocities; bond constraints, for example, require that relative velocity be orthogonal to the bond. If the velocities vector is null or the tolerance is zero, velocity checks are skipped.- Specified by:
constraintSatisfied
in interfaceConstraint
- Parameters:
x
- Input coordinates to check.v
- Input velocities to check. If null, velocity check disabled.xTol
- Numerical tolerance for bond lengths.vTol
- Numerical tolerance for velocity checks (typically in degrees). If zero, velocity check disabled.- Returns:
- Whether this Constraint is satisfied.
-
getNumDegreesFrozen
public int getNumDegreesFrozen()Description copied from interface:Constraint
Returns the number of degrees of freedom this Constraint constrains.- Specified by:
getNumDegreesFrozen
in interfaceConstraint
- Returns:
- Number of frozen DoF.
-