Package ffx.openmm

Class HarmonicBondForce

java.lang.Object
ffx.openmm.Force
ffx.openmm.HarmonicBondForce
Direct Known Subclasses:
UreyBradleyForce

public class HarmonicBondForce extends Force
This class implements an interaction between pairs of particles that varies harmonically with the distance between them. To use it, create a HarmonicBondForce object then call addBond() once for each bond. After a bond has been added, you can modify its force field parameters by calling setBondParameters(). This will have no effect on Contexts that already exist unless you call updateParametersInContext().
  • Constructor Details

    • HarmonicBondForce

      public HarmonicBondForce()
      Create a new HarmonicBondForce.
  • Method Details

    • addBond

      public int addBond(int i1, int i2, double length, double k)
      Add a bond term to the force field.
      Parameters:
      i1 - The index of the first particle connected by the bond.
      i2 - The index of the second particle connected by the bond.
      length - The equilibrium length of the bond, measured in nm.
      k - The harmonic force constant for the bond, measured in kJ/mol/nmˆ2.
      Returns:
      The index of the bond that was added.
    • destroy

      public void destroy()
      Destroy the force.
      Specified by:
      destroy in class Force
    • getBondParameters

      public void getBondParameters(int index, com.sun.jna.ptr.IntByReference i1, com.sun.jna.ptr.IntByReference i2, com.sun.jna.ptr.DoubleByReference length, com.sun.jna.ptr.DoubleByReference k)
      Get the force field parameters for a bond term.
      Parameters:
      index - The index of the bond for which to get parameters.
      i1 - The index of the first particle connected by the bond (output).
      i2 - The index of the second particle connected by the bond (output).
      length - The equilibrium length of the bond, measured in nm (output).
      k - The harmonic force constant for the bond, measured in kJ/mol/nmˆ2 (output).
    • getBondParameters

      public void getBondParameters(int index, IntBuffer i1, IntBuffer i2, DoubleBuffer length, DoubleBuffer k)
      Get the force field parameters for a bond term.
      Parameters:
      index - The index of the bond for which to get parameters.
      i1 - The index of the first particle connected by the bond (output).
      i2 - The index of the second particle connected by the bond (output).
      length - The equilibrium length of the bond, measured in nm (output).
      k - The harmonic force constant for the bond, measured in kJ/mol/nmˆ2 (output).
    • getNumBonds

      public int getNumBonds()
      Get the number of bonds.
      Returns:
      The number of bonds.
    • setBondParameters

      public void setBondParameters(int i, int i1, int i2, double length, double k)
      Set the force field parameters for a bond term.
      Parameters:
      i - The index of the bond for which to set parameters.
      i1 - The index of the first particle connected by the bond.
      i2 - The index of the second particle connected by the bond.
      length - The equilibrium length of the bond, measured in nm.
      k - The harmonic force constant for the bond, measured in kJ/mol/nmˆ2.
    • setUsesPeriodicBoundaryConditions

      public void setUsesPeriodicBoundaryConditions(boolean periodic)
      Set whether this force should apply periodic boundary conditions when calculating displacements.
      Parameters:
      periodic - If true, periodic boundary conditions will be applied.
    • updateParametersInContext

      public void updateParametersInContext(Context context)
      Update the parameters in the OpenMM Context.
      Parameters:
      context - The OpenMM Context.
    • usesPeriodicBoundaryConditions

      public boolean usesPeriodicBoundaryConditions()
      Check if the force uses periodic boundary conditions.
      Overrides:
      usesPeriodicBoundaryConditions in class Force
      Returns:
      True if the force uses periodic boundary conditions.