Class OpenMMDualTopologyEnergy

java.lang.Object
ffx.potential.DualTopologyEnergy
ffx.potential.openmm.OpenMMDualTopologyEnergy
All Implemented Interfaces:
CrystalPotential, OptimizationInterface, Potential, LambdaInterface, OpenMMPotential

public class OpenMMDualTopologyEnergy extends DualTopologyEnergy implements OpenMMPotential
  • Constructor Details

  • Method Details

    • energy

      public double energy(double[] x)
      This method is called repeatedly to compute the function energy.
      Specified by:
      energy in interface OptimizationInterface
      Overrides:
      energy in class DualTopologyEnergy
      Parameters:
      x - Input parameters.
      Returns:
      Function value at x.
    • energy

      public double energy(double[] x, boolean verbose)
      This method is called repeatedly to compute the function energy. The verbose flag may not be used by all implementations.
      Specified by:
      energy in interface OptimizationInterface
      Overrides:
      energy in class DualTopologyEnergy
      Parameters:
      x - Input parameters.
      verbose - Display extra information.
      Returns:
      Function value at x
    • energyFFX

      public double energyFFX(double[] x)
      Compute the energy using the pure Java code path.
      Parameters:
      x - Atomic coordinates.
      Returns:
      The energy (kcal/mol)
    • energyFFX

      public double energyFFX(double[] x, boolean verbose)
      Compute the energy using the pure Java code path.
      Parameters:
      x - Input atomic coordinates
      verbose - Use verbose logging.
      Returns:
      The energy (kcal/mol)
    • setCoordinates

      public void setCoordinates(double[] x)
      Coordinates for active atoms in units of Angstroms.
      Specified by:
      setCoordinates in interface OptimizationInterface
      Overrides:
      setCoordinates in class DualTopologyEnergy
      Parameters:
      x - Atomic coordinates active atoms.
    • setVelocity

      public void setVelocity(double[] v)
      Velocities for active atoms in units of Angstroms.
      Specified by:
      setVelocity in interface Potential
      Overrides:
      setVelocity in class DualTopologyEnergy
      Parameters:
      v - Velocities for active atoms.
    • getMolecularAssembly

      public MolecularAssembly getMolecularAssembly(int topology)
      Get the MolecularAssembly.
      Parameters:
      topology - The topology index (0 for topology 1, 1 for topology 2).
      Returns:
      a MolecularAssembly object for topology 1.
    • getForceFieldEnergy

      public ForceFieldEnergy getForceFieldEnergy(int topology)
      Get the OpenMMEnergy for the specified topology.
      Parameters:
      topology - The topology index (0 for topology 1, 1 for topology 2).
      Returns:
      The OpenMMEnergy for the specified topology.
    • updateParameters

      public void updateParameters(@Nullable Atom[] atoms)
      Update parameters if the Use flags and/or Lambda value has changed.
      Specified by:
      updateParameters in interface OpenMMPotential
      Parameters:
      atoms - Atoms in this list are considered.
    • getContext

      public OpenMMContext getContext()
      Returns the Context instance.
      Specified by:
      getContext in interface OpenMMPotential
      Returns:
      context
    • updateContext

      public void updateContext(String integratorName, double timeStep, double temperature, boolean forceCreation)
      Create an OpenMM Context.

      Context.free() must be called to free OpenMM memory.

      Specified by:
      updateContext in interface OpenMMPotential
      Parameters:
      integratorName - Integrator to use.
      timeStep - Time step.
      temperature - Temperature (K).
      forceCreation - Force a new Context to be created, even if the existing one matches the request.
    • getOpenMMState

      public OpenMMState getOpenMMState(int mask)
      Create an immutable OpenMM State.

      State.free() must be called to free OpenMM memory.

      Specified by:
      getOpenMMState in interface OpenMMPotential
      Parameters:
      mask - The State mask.
      Returns:
      Returns the State.
    • getSystem

      public OpenMMSystem getSystem()
      Get a reference to the System instance.
      Specified by:
      getSystem in interface OpenMMPotential
      Returns:
      a reference to the OpenMMSystem.
    • setActiveAtoms

      public boolean setActiveAtoms()
      Update active atoms.
      Specified by:
      setActiveAtoms in interface OpenMMPotential
      Returns:
      True if there are inactive atoms.