Class RestrainPosition

All Implemented Interfaces:
BondedEnergy, LambdaInterface, ROLS, Serializable, Cloneable, Comparable<BondedTerm>, MutableTreeNode, TreeNode

public class RestrainPosition extends BondedTerm implements LambdaInterface
Restrain the position of atoms to their initial coordinates.
Since:
1.0
Author:
Michael J. Schnieders
See Also:
  • Constructor Details

    • RestrainPosition

      public RestrainPosition(Atom[] atoms, double[][] equilibriumCoordinates, double forceConst, double flatBottom, boolean lambdaTerm)
      Restrain atoms to a position in the global coordinate frame.
      Parameters:
      atoms - The atoms to restrain.
      equilibriumCoordinates - The equilibrium coordinates.
      forceConst - The force constant in kcal/mol/A^2.
      flatBottom - The flat bottom radius in Angstroms.
      lambdaTerm - If true, apply lambda to this restraint.
  • Method Details

    • getAtoms

      public Atom[] getAtoms()
      Returns a copy of the atoms array.
      Overrides:
      getAtoms in class BondedTerm
      Returns:
      Copy of the atom array.
    • getForceConstant

      public double getForceConstant()
      Returns the force constant in kcal/mol/Angstrom^2.
      Returns:
      a double.
    • getLambda

      public double getLambda()
      Get the current value of the state variable.
      Specified by:
      getLambda in interface LambdaInterface
      Returns:
      state
    • setLambda

      public void setLambda(double lambda)
      Set the current value of the state variable. May be ignored if lambda is not being applied.
      Specified by:
      setLambda in interface LambdaInterface
      Parameters:
      lambda - a double.
    • getNumAtoms

      public int getNumAtoms()
      getNumAtoms.
      Returns:
      a int.
    • getEquilibriumCoordinates

      public double[][] getEquilibriumCoordinates()
      Returns the original coordinates of this restraint, indexed by atoms then x,y,z. This is the opposite order of the internal storage.
      Returns:
      Original coordinates [atoms][xyz]
    • getd2EdL2

      public double getd2EdL2()
      Get the 2nd partial derivative of the energy with respect to lambda.
      Specified by:
      getd2EdL2 in interface LambdaInterface
      Returns:
      d2EdL2
    • getdEdL

      public double getdEdL()
      Get the partial derivative of the energy with respect to lambda.
      Specified by:
      getdEdL in interface LambdaInterface
      Returns:
      dEdL
    • getdEdXdL

      public void getdEdXdL(double[] gradient)
      Get the gradient of dEdL with respect to each parameter.
      Specified by:
      getdEdXdL in interface LambdaInterface
      Parameters:
      gradient - - A double array of length the number of parameters in the model (commonly 3 * number of atoms).
    • energy

      public double energy(boolean gradient, int threadID, AtomicDoubleArray3D grad, AtomicDoubleArray3D lambdaGrad)
      Calculates energy and gradients for this coordinate restraint.
      Specified by:
      energy in interface BondedEnergy
      Parameters:
      gradient - Calculate gradients
      threadID - The thread ID.
      grad - a AtomicDoubleArray3D object.
      lambdaGrad - a AtomicDoubleArray3D object.
      Returns:
      Energy in the coordinate restraint
    • parseRestrainPositions

      public static RestrainPosition[] parseRestrainPositions(MolecularAssembly molecularAssembly)
    • parseRestrainPosition

      public static RestrainPosition parseRestrainPosition(String line, Atom[] atoms, boolean useLambda)
      Parse a Restrain-Position line and return a RestrainPosition instance.
      Parameters:
      line - The restraint line.
      atoms - The atoms in the system.
      useLambda - If true, apply lambda to this restraint.
      Returns:
      A RestrainPosition object.