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 TypeMethodDescriptiondoubleenergy(double[] x) This method is called repeatedly to compute the function energy.doubleenergy(double[] x, boolean verbose) This method is called repeatedly to compute the function energy.doubleenergyFFX(double[] x) Compute the energy using the pure Java code path.doubleenergyFFX(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.booleanUpdate active atoms.voidsetCoordinates(double[] x) Coordinates for active atoms in units of Angstroms.voidsetVelocity(double[] v) Velocities for active atoms in units of Angstroms.voidupdateContext(String integratorName, double timeStep, double temperature, boolean forceCreation) Create an OpenMM Context.voidupdateParameters(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, setScalingMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ffx.numerics.OptimizationInterface
scaleCoordinates, scaleCoordinatesAndGradient, unscaleCoordinatesMethods 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- aMolecularAssemblyobject.topology2- aMolecularAssemblyobject.switchFunction- aUnivariateSwitchingFunctionobject.requestedPlatform- aPlatformobject.
-
-
Method Details
-
energy
public double energy(double[] x) This method is called repeatedly to compute the function energy.- Specified by:
energyin interfaceOptimizationInterface- Overrides:
energyin 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:
energyin interfaceOptimizationInterface- Overrides:
energyin 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:
setCoordinatesin interfaceOptimizationInterface- Overrides:
setCoordinatesin classDualTopologyEnergy- Parameters:
x- Atomic coordinates active atoms.
-
setVelocity
public void setVelocity(double[] v) Velocities for active atoms in units of Angstroms.- Specified by:
setVelocityin interfacePotential- Overrides:
setVelocityin 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
MolecularAssemblyobject 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:
updateParametersin interfaceOpenMMPotential- Parameters:
atoms- Atoms in this list are considered.
-
getContext
Returns the Context instance.- Specified by:
getContextin 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:
updateContextin 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:
getOpenMMStatein interfaceOpenMMPotential- Parameters:
mask- The State mask.- Returns:
- Returns the State.
-
getSystem
Get a reference to the System instance.- Specified by:
getSystemin interfaceOpenMMPotential- Returns:
- a reference to the OpenMMSystem.
-
setActiveAtoms
public boolean setActiveAtoms()Update active atoms.- Specified by:
setActiveAtomsin interfaceOpenMMPotential- Returns:
- True if there are inactive atoms.
-