Package ffx.potential.openmm
Class OpenMMDualTopologyEnergy
java.lang.Object
ffx.potential.DualTopologyEnergy
ffx.potential.openmm.OpenMMDualTopologyEnergy
- All Implemented Interfaces:
CrystalPotential
,OptimizationInterface
,Potential
,LambdaInterface
,OpenMMPotential
-
Nested Class Summary
Nested classes/interfaces inherited from interface ffx.numerics.Potential
Potential.STATE, Potential.VARIABLE_TYPE
-
Constructor Summary
ConstructorsConstructorDescriptionOpenMMDualTopologyEnergy
(MolecularAssembly topology1, MolecularAssembly topology2, UnivariateSwitchingFunction switchFunction, Platform requestedPlatform) Constructor for DualTopologyEnergy. -
Method Summary
Modifier and TypeMethodDescriptiondouble
energy
(double[] x) This method is called repeatedly to compute the function energy.double
energy
(double[] x, boolean verbose) This method is called repeatedly to compute the function energy.double
energyFFX
(double[] x) Compute the energy using the pure Java code path.double
energyFFX
(double[] x, boolean verbose) Compute the energy using the pure Java code path.Returns the Context instance.getForceFieldEnergy
(int topology) Get the OpenMMEnergy for the specified topology.getMolecularAssembly
(int topology) Get the MolecularAssembly.getOpenMMState
(int mask) Create an immutable OpenMM State.Get a reference to the System instance.boolean
Update active atoms.void
setCoordinates
(double[] x) Coordinates for active atoms in units of Angstroms.void
setVelocity
(double[] v) Velocities for active atoms in units of Angstroms.void
updateContext
(String integratorName, double timeStep, double temperature, boolean forceCreation) Create an OpenMM Context.void
updateParameters
(Atom[] atoms) Update parameters if the Use flags and/or Lambda value has changed.Methods inherited from class ffx.potential.DualTopologyEnergy
dEdLZeroAtEnds, destroy, energyAndGradient, energyAndGradient, energyFactory, getAcceleration, getCoordinates, getCrystal, getd2EdL2, getdEdL, getdEdXdL, getDualTopologyAtom, getDualTopologyAtoms, getDualTopologyIndex1, getDualTopologyIndex2, getEnergyTermState, getForceFieldEnergy1, getForceFieldEnergy2, getLambda, getMass, getNumberOfAtoms, getNumberOfVariables, getNumSharedVariables, getPreviousAcceleration, getScaling, getSwitch, getTopologyScale, getTotalEnergy, getUnderlyingPotentials, getVariableTypes, getVelocity, mapToDualTopologyIndex, setAcceleration, setCrystal, setEnergyTermState, setLambda, setParallel, setPreviousAcceleration, setPrintOnFailure, setScaling
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ffx.numerics.OptimizationInterface
scaleCoordinates, scaleCoordinatesAndGradient, unscaleCoordinates
Methods inherited from interface ffx.numerics.Potential
getConstraints, writeAdditionalRestartInfo
-
Constructor Details
-
OpenMMDualTopologyEnergy
public OpenMMDualTopologyEnergy(MolecularAssembly topology1, MolecularAssembly topology2, UnivariateSwitchingFunction switchFunction, Platform requestedPlatform) Constructor for DualTopologyEnergy.- Parameters:
topology1
- aMolecularAssembly
object.topology2
- aMolecularAssembly
object.switchFunction
- aUnivariateSwitchingFunction
object.requestedPlatform
- aPlatform
object.
-
-
Method Details
-
energy
public double energy(double[] x) This method is called repeatedly to compute the function energy.- Specified by:
energy
in interfaceOptimizationInterface
- Overrides:
energy
in classDualTopologyEnergy
- 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 interfaceOptimizationInterface
- Overrides:
energy
in classDualTopologyEnergy
- 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 coordinatesverbose
- 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 interfaceOptimizationInterface
- Overrides:
setCoordinates
in classDualTopologyEnergy
- Parameters:
x
- Atomic coordinates active atoms.
-
setVelocity
public void setVelocity(double[] v) Velocities for active atoms in units of Angstroms.- Specified by:
setVelocity
in interfacePotential
- Overrides:
setVelocity
in classDualTopologyEnergy
- Parameters:
v
- Velocities for active atoms.
-
getMolecularAssembly
Get the MolecularAssembly.- Parameters:
topology
- The topology index (0 for topology 1, 1 for topology 2).- Returns:
- a
MolecularAssembly
object for topology 1.
-
getForceFieldEnergy
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
Update parameters if the Use flags and/or Lambda value has changed.- Specified by:
updateParameters
in interfaceOpenMMPotential
- Parameters:
atoms
- Atoms in this list are considered.
-
getContext
Returns the Context instance.- Specified by:
getContext
in interfaceOpenMMPotential
- 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 interfaceOpenMMPotential
- 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
Create an immutable OpenMM State.State.free() must be called to free OpenMM memory.
- Specified by:
getOpenMMState
in interfaceOpenMMPotential
- Parameters:
mask
- The State mask.- Returns:
- Returns the State.
-
getSystem
Get a reference to the System instance.- Specified by:
getSystem
in interfaceOpenMMPotential
- Returns:
- a reference to the OpenMMSystem.
-
setActiveAtoms
public boolean setActiveAtoms()Update active atoms.- Specified by:
setActiveAtoms
in interfaceOpenMMPotential
- Returns:
- True if there are inactive atoms.
-