Class QuadTopologyEnergy
- All Implemented Interfaces:
CrystalPotential,OptimizationInterface,Potential,LambdaInterface
- Since:
- 1.0
- Author:
- Jacob M. Litman, Michael J. Schnieders
-
Nested Class Summary
Nested classes/interfaces inherited from interface ffx.numerics.Potential
Potential.STATE, Potential.VARIABLE_TYPE -
Constructor Summary
ConstructorsConstructorDescriptionQuadTopologyEnergy(DualTopologyEnergy dualTopologyA, DualTopologyEnergy dualTopologyB) General structure: first layer will be the "A/B" layer, consisting of the two dual topologies.QuadTopologyEnergy(DualTopologyEnergy dualTopologyA, DualTopologyEnergy dualTopologyB, List<Integer> uniqueAList, List<Integer> uniqueBList) General structure: first layer will be the "A/B" layer, consisting of the two dual topologies. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if dUdL is guaranteed to be zero at 0 and 1.booleandestroy()Destroys this Potential and frees up any associated resources, particularly worker Threads.doubleenergy(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.doubleenergyAndGradient(double[] x, double[] g) This method is called repeatedly to compute the function energy and gradient.doubleenergyAndGradient(double[] x, double[] g, boolean verbose) This method is called repeatedly to compute the function energy and gradient.double[]getAcceleration(double[] acceleration) getAcceleration.double[]getCoordinates(double[] x) Load the current value of the parameters.Get the Crystal instance that specifies the periodic boundary conditions and symmetry.doubleGet the 2nd partial derivative of the energy with respect to lambda.doublegetdEdL()Get the partial derivative of the energy with respect to lambda.voidgetdEdXdL(double[] g) Get the gradient of dEdL with respect to each parameter.Returns the first component DualTopologyEnergy.Returns the second component DualTopologyEnergy.Get the Potential Energy terms that is active.doubleGet the current value of the state variable.double[]getMass()Get the mass of each degree of freedom.intGet the number of variables being operated on.intReturns number of shared variables.double[]getPreviousAcceleration(double[] previousAcceleration) getPreviousAcceleration.double[]Get the problem scaling.doubleGet the total energy of the systemReturns a List of Potentials this Potential depends on with a recursive search, excluding the top level of this call.Get the type of all variables.double[]getVelocity(double[] velocity) getVelocity.voidsetAcceleration(double[] acceleration) setAcceleration.voidsetCoordinates(double[] coordinates) Set the current value of the parameters.voidsetCrystal(Crystal crystal) Set the Crystal instance that specifies the periodic boundary conditions and symmetry.voidSet the Potential Energy terms that should be active.voidsetLambda(double lambda) Set the current value of the state variable.voidsetParallel(boolean parallel) setParallel.voidsetPreviousAcceleration(double[] previousAcceleration) setPreviousAcceleration.voidsetPrintOnFailure(boolean onFail, boolean override) Sets the printOnFailure flag; if override is true, over-rides any existing property.voidsetScaling(double[] scaling) Scale the problem.voidsetVelocity(double[] velocity) setVelocity.Methods 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
-
QuadTopologyEnergy
General structure: first layer will be the "A/B" layer, consisting of the two dual topologies. The second layer will be the "1/2" layer, consisting of the assemblies/ForceFieldEnergies associated with each dual topology. Arrays will be addressed as [A/B=0/1][1/2=0/1].For example, if running a dual-force-field calculation, A might be the original molecule, going from AMOEBA to a fixed-charge force field, while B is a modified molecule going from fixed-charge to AMOEBA. Within those, A1 would be AMOEBA-original, A2 would be AMBER-original, B1 would be AMBER-modified, B2 would be AMOEBA-modified.
This constructor assumes there are no unique atoms in either topology, and pins everything.
- Parameters:
dualTopologyA- A DualTopologyEnergydualTopologyB- A DualTopologyEnergy
-
QuadTopologyEnergy
public QuadTopologyEnergy(DualTopologyEnergy dualTopologyA, DualTopologyEnergy dualTopologyB, List<Integer> uniqueAList, List<Integer> uniqueBList) General structure: first layer will be the "A/B" layer, consisting of the two dual topologies. The second layer will be the "1/2" layer, consisting of the assemblies/ForceFieldEnergies associated with each dual topology. Arrays will be addressed as [A/B=0/1][1/2=0/1].For example, if running a dual-force-field calculation, A might be the original molecule, going from AMOEBA to a fixed-charge force field, while B is a modified molecule going from fixed-charge to AMOEBA. Within those, A1 would be AMOEBA-original, A2 would be AMBER-original, B1 would be AMBER-modified, B2 would be AMOEBA-modified.
- Parameters:
dualTopologyA- A DualTopologyEnergydualTopologyB- A DualTopologyEnergyuniqueAList- Variables unique to AuniqueBList- Variables unique to B
-
-
Method Details
-
dEdLZeroAtEnds
public boolean dEdLZeroAtEnds()Returns true if dUdL is guaranteed to be zero at 0 and 1. Default implementation is to return false.Returns true if both dual topologies are zero at the ends.
- Specified by:
dEdLZeroAtEndsin interfaceLambdaInterface- Returns:
- True if dUdL is guaranteed 0 at endpoints.
-
destroy
public boolean destroy()Destroys this Potential and frees up any associated resources, particularly worker Threads. Default implementation is to return true (assume destruction successful).- Specified by:
destroyin interfaceOptimizationInterface- Returns:
- If resource reclamation successful, or resources already reclaimed.
-
energy
public double energy(double[] x) This method is called repeatedly to compute the function energy.- Specified by:
energyin interfaceOptimizationInterface- 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- Parameters:
x- Input parameters.verbose- Display extra information.- Returns:
- Function value at
x
-
energyAndGradient
public double energyAndGradient(double[] x, double[] g) This method is called repeatedly to compute the function energy and gradient.- Specified by:
energyAndGradientin interfaceOptimizationInterface- Parameters:
x- Input parameters.g- Output gradients with respect to each parameter.- Returns:
- Function value at
x.
-
energyAndGradient
public double energyAndGradient(double[] x, double[] g, boolean verbose) This method is called repeatedly to compute the function energy and gradient. The verbose flag may not be used by all implementations.- Specified by:
energyAndGradientin interfaceOptimizationInterface- Parameters:
x- Input parameters.g- Output gradients with respect to each parameter.verbose- Display extra information.- Returns:
- Function value at
x.
-
getAcceleration
public double[] getAcceleration(double[] acceleration) getAcceleration.- Specified by:
getAccelerationin interfacePotential- Parameters:
acceleration- an array of double values.- Returns:
- an array of double values.
-
getCoordinates
public double[] getCoordinates(double[] x) Load the current value of the parameters. If the supplied array is null or not large enough, a new one should be created. The filled array is returned.- Specified by:
getCoordinatesin interfaceOptimizationInterface- Parameters:
x- Supplied array.- Returns:
- The array filled with parameter values.
-
getCrystal
Get the Crystal instance that specifies the periodic boundary conditions and symmetry.- Specified by:
getCrystalin interfaceCrystalPotential- Returns:
- a Crystal instance.
-
setCrystal
Set the Crystal instance that specifies the periodic boundary conditions and symmetry.- Specified by:
setCrystalin interfaceCrystalPotential- Parameters:
crystal- a Crystal instance.
-
getDualTopA
Returns the first component DualTopologyEnergy.- Returns:
- Dual topology A.
-
getDualTopB
Returns the second component DualTopologyEnergy.- Returns:
- Dual topology B.
-
getEnergyTermState
Get the Potential Energy terms that is active.- Specified by:
getEnergyTermStatein interfacePotential- Returns:
- the STATE
-
setEnergyTermState
Set the Potential Energy terms that should be active.- Specified by:
setEnergyTermStatein interfacePotential- Parameters:
state- include FAST varying energy terms, SLOW varying energy terms or BOTH.
-
getLambda
public double getLambda()Get the current value of the state variable.- Specified by:
getLambdain interfaceLambdaInterface- 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:
setLambdain interfaceLambdaInterface- Parameters:
lambda- a double.
-
getMass
public double[] getMass()Get the mass of each degree of freedom. This is required for molecular dynamics. -
getNumberOfVariables
public int getNumberOfVariables()Get the number of variables being operated on.- Specified by:
getNumberOfVariablesin interfaceOptimizationInterface- Returns:
- Number of variables.
-
getPreviousAcceleration
public double[] getPreviousAcceleration(double[] previousAcceleration) getPreviousAcceleration.- Specified by:
getPreviousAccelerationin interfacePotential- Parameters:
previousAcceleration- an array of double values.- Returns:
- an array of double values.
-
getScaling
public double[] getScaling()Get the problem scaling.- Specified by:
getScalingin interfaceOptimizationInterface- Returns:
- The scaling value used for each variable.
-
setScaling
public void setScaling(double[] scaling) Scale the problem. A good choice for optimization is the square root of the median eigenvalue of a typical Hessian.- Specified by:
setScalingin interfaceOptimizationInterface- Parameters:
scaling- The scaling value to use for each variable.
-
getTotalEnergy
public double getTotalEnergy()Get the total energy of the system- Specified by:
getTotalEnergyin interfaceOptimizationInterface- Returns:
- the total energy
-
getUnderlyingPotentials
Description copied from interface:OptimizationInterfaceReturns a List of Potentials this Potential depends on with a recursive search, excluding the top level of this call. May not be implemented for all Potentials.- Specified by:
getUnderlyingPotentialsin interfaceOptimizationInterface- Returns:
- By default, an empty list.
-
getVariableTypes
Get the type of all variables.- Specified by:
getVariableTypesin interfacePotential- Returns:
- The VARIABLE_TYPE of each variable.
-
getVelocity
public double[] getVelocity(double[] velocity) getVelocity.- Specified by:
getVelocityin interfacePotential- Parameters:
velocity- an array of double values.- Returns:
- an array of double values.
-
getd2EdL2
public double getd2EdL2()Get the 2nd partial derivative of the energy with respect to lambda.- Specified by:
getd2EdL2in interfaceLambdaInterface- Returns:
- d2EdL2
-
getdEdL
public double getdEdL()Get the partial derivative of the energy with respect to lambda.- Specified by:
getdEdLin interfaceLambdaInterface- Returns:
- dEdL
-
getdEdXdL
public void getdEdXdL(double[] g) Get the gradient of dEdL with respect to each parameter.- Specified by:
getdEdXdLin interfaceLambdaInterface- Parameters:
g- - A double array of length the number of parameters in the model (commonly 3 * number of atoms).
-
setAcceleration
public void setAcceleration(double[] acceleration) setAcceleration.- Specified by:
setAccelerationin interfacePotential- Parameters:
acceleration- an array of double values.
-
setParallel
public void setParallel(boolean parallel) setParallel.- Parameters:
parallel- a boolean.
-
setPreviousAcceleration
public void setPreviousAcceleration(double[] previousAcceleration) setPreviousAcceleration.- Specified by:
setPreviousAccelerationin interfacePotential- Parameters:
previousAcceleration- an array of double values.
-
setPrintOnFailure
public void setPrintOnFailure(boolean onFail, boolean override) Sets the printOnFailure flag; if override is true, over-rides any existing property. Essentially sets the default value of printOnFailure for an algorithm. For example, rotamer optimization will generally run into force field issues in the normal course of execution as it tries unphysical self and pair configurations, so the algorithm should not print out a large number of error PDBs.- Parameters:
onFail- To setoverride- Override properties
-
setCoordinates
public void setCoordinates(double[] coordinates) Set the current value of the parameters. If the supplied array is null or not large enough, no action is taken.- Specified by:
setCoordinatesin interfaceOptimizationInterface- Parameters:
coordinates- The array with parameter values.
-
setVelocity
public void setVelocity(double[] velocity) setVelocity.- Specified by:
setVelocityin interfacePotential- Parameters:
velocity- an array of double values.
-