Package ffx.potential.constraint
Class ShakeChargeConstraint
java.lang.Object
ffx.potential.constraint.ShakeChargeConstraint
- All Implemented Interfaces:
Constraint
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
applyChargeConstraintToStep
(double[] x, double[] afric, double[] masses, double dt) This method follows the SHAKE Charge Constraint laid out in Appendix B of Donnini, Serena, et al.void
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.
-
Constructor Details
-
ShakeChargeConstraint
public ShakeChargeConstraint(int nConstraints, int c, double tol)
-
-
Method Details
-
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.
-
applyChargeConstraintToStep
public void applyChargeConstraintToStep(double[] x, double[] afric, double[] masses, double dt) This method follows the SHAKE Charge Constraint laid out in Appendix B of Donnini, Serena, et al. "Charge-neutral constant pH molecular dynamics simulations using a parsimonious proton buffer." Journal of chemical theory and computation 12.3 (2016): 1040-1051. https://pubs.acs.org/doi/epdf/10.1021/acs.jctc.5b01160- Parameters:
x
-afric
-masses
-dt
-
-
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.
-