Package ffx.numerics

Interface Constraint

All Known Implementing Classes:
CcmaConstraint, SettleConstraint, ShakeChargeConstraint

public interface Constraint
Defines a set of geometric constraints that must be applied self-consistently.
Since:
1.0
Author:
Jacob M. Litman, Michael J. Schnieders
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
  • Method Details

    • applyConstraintToStep

      void applyConstraintToStep(double[] xPrior, double[] xNew, double[] masses, double tol)
      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.

      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

      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. 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.

      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

      int[] constrainedAtomIndices()
      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.
      Returns:
      All indices of constrained Atoms.
    • constraintSatisfied

      boolean constraintSatisfied(double[] x, double tol)
      Checks if this Constraint is satisfied.
      Parameters:
      x - Input coordinates to check.
      tol - Numerical tolerance as a fraction of bond stretch.
      Returns:
      Whether this Constraint is satisfied.
    • constraintSatisfied

      boolean constraintSatisfied(double[] x, double[] v, double xTol, double vTol)
      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.
      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

      int getNumDegreesFrozen()
      Returns the number of degrees of freedom this Constraint constrains.
      Returns:
      Number of frozen DoF.