Package ffx.numerics
Interface OptimizationInterface
- All Known Subinterfaces:
CrystalPotential
,Potential
- All Known Implementing Classes:
ANIEnergy
,Barostat
,DualTopologyEnergy
,ExtendedSystem
,ForceFieldEnergy
,MultistateBennettAcceptanceRatio
,OpenMMEnergy
,OrthogonalSpaceTempering
,QuadTopologyEnergy
,RealSpaceEnergy
,RefinementEnergy
,ScaleBulkEnergy
,SigmaAEnergy
,SplineEnergy
,XRayEnergy
,XtalEnergy
public interface OptimizationInterface
The OptimizationInterface defines methods required by an optimizer.
- Since:
- 1.0
- Author:
- Michael J. Schnieders
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
destroy()
Destroys this Potential and frees up any associated resources, particularly worker Threads.double
energy
(double[] x) This method is called repeatedly to compute the function energy.default double
energy
(double[] x, boolean verbose) This method is called repeatedly to compute the function energy.double
energyAndGradient
(double[] x, double[] g) This method is called repeatedly to compute the function energy and gradient.default double
energyAndGradient
(double[] x, double[] g, boolean verbose) This method is called repeatedly to compute the function energy and gradient.double[]
getCoordinates
(double[] parameters) Load the current value of the parameters.int
Get the number of variables being operated on.double[]
Get the problem scaling.double
Get 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.default void
scaleCoordinates
(double[] x) Default method to scale coordinates.default void
scaleCoordinatesAndGradient
(double[] x, double[] g) Default method to unscale coordinates.void
setScaling
(double[] scaling) Scale the problem.default void
unscaleCoordinates
(double[] x) Default method to unscale coordinates.
-
Method Details
-
destroy
default boolean destroy()Destroys this Potential and frees up any associated resources, particularly worker Threads. Default implementation is to return true (assume destruction successful).- Returns:
- If resource reclamation successful, or resources already reclaimed.
-
energy
double energy(double[] x) This method is called repeatedly to compute the function energy.- Parameters:
x
- Input parameters.- Returns:
- Function value at
x
. - Since:
- 1.0
-
energy
default 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.- Parameters:
x
- Input parameters.verbose
- Display extra information.- Returns:
- Function value at
x
-
energyAndGradient
double energyAndGradient(double[] x, double[] g) This method is called repeatedly to compute the function energy and gradient.- Parameters:
x
- Input parameters.g
- Output gradients with respect to each parameter.- Returns:
- Function value at
x
. - Since:
- 1.0
-
energyAndGradient
default 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.- Parameters:
x
- Input parameters.g
- Output gradients with respect to each parameter.verbose
- Display extra information.- Returns:
- Function value at
x
. - Since:
- 1.0
-
getCoordinates
double[] getCoordinates(double[] parameters) 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.- Parameters:
parameters
- Supplied array.- Returns:
- The array filled with parameter values.
-
getNumberOfVariables
int getNumberOfVariables()Get the number of variables being operated on.- Returns:
- Number of variables.
-
getScaling
double[] getScaling()Get the problem scaling.- Returns:
- The scaling value used for each variable.
- Since:
- 1.0
-
setScaling
void setScaling(double[] scaling) Scale the problem. A good choice for optimization is the square root of the median eigenvalue of a typical Hessian.- Parameters:
scaling
- The scaling value to use for each variable.- Since:
- 1.0
-
getTotalEnergy
double getTotalEnergy()Get the total energy of the system- Returns:
- the total energy
-
getUnderlyingPotentials
Returns 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.- Returns:
- By default, an empty list.
-
scaleCoordinates
default void scaleCoordinates(double[] x) Default method to scale coordinates.- Parameters:
x
- Input parameters.
-
scaleCoordinatesAndGradient
default void scaleCoordinatesAndGradient(double[] x, double[] g) Default method to unscale coordinates.- Parameters:
x
- Input parameters.g
- Gradient array.
-
unscaleCoordinates
default void unscaleCoordinates(double[] x) Default method to unscale coordinates.- Parameters:
x
- Input parameters.
-