Package ffx.algorithms.optimize
Class PhMinimize
java.lang.Object
ffx.algorithms.optimize.PhMinimize
- All Implemented Interfaces:
Terminatable
,OptimizationListener
Minimize the potential energy of a system to an RMS gradient per atom convergence criteria.
- Since:
- 1.0
- Author:
- Michael J. Schnieders
-
Field Summary
Modifier and TypeFieldDescriptionprotected final AlgorithmListener
The AlgorithmListener to update the UI.protected boolean
A flag to indicate the algorithm is done.protected double
The final potential energy.protected final ExtendedSystem
The extended system that contains the fictitious particleprotected final double[]
The gradient.protected double[]
The gradient.protected final MolecularAssembly
The MolecularAssembly being operated on.protected final int
Number of variables.protected final int
Number of Extended System variables.protected int
The number of optimization steps taken.protected final Potential
The potential energy to optimize.protected final double[]
Scaling applied to each variable.protected int
The return status of the optimization.protected boolean
A flag to indicate the algorithm should be terminated.protected double[]
Current value of each Extended System variable.protected long
Minimization time in nanoseconds.protected final double[]
Current value of each variable. -
Constructor Summary
ConstructorDescriptionPhMinimize
(MolecularAssembly molecularAssembly, AlgorithmListener algorithmListener, ExtendedSystem esvSystem) Constructor for Minimize.PhMinimize
(MolecularAssembly molecularAssembly, Potential potential, AlgorithmListener algorithmListener, ExtendedSystem esvSystem) Constructor for Minimize. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Getter for the fieldenergy
.double
getRMSGradient.int
Getter for the fieldstatus
.minimizeminimizeCoordinates
(double eps) minimizeminimizeCoordinates
(double eps, int maxIterations) minimizeminimizeCoordinates
(int m, double eps, int maxIterations) minimizeminimizeTitration
(double eps, int maxIterations) minimizeminimizeTitration
(int m, double eps, int maxIterations) minimizeboolean
optimizationUpdate
(int iteration, int nBFGS, int functionEvaluations, double rmsGradient, double rmsCoordinateChange, double energy, double energyChange, double angle, LineSearch.LineSearchResult lineSearchResult) This method is called by the optimizer after each step.void
This should be implemented as a blocking interrupt; when the method returns theTerminatable
algorithm has reached a clean termination point.
-
Field Details
-
molecularAssembly
The MolecularAssembly being operated on. -
potential
The potential energy to optimize. -
esvSystem
The extended system that contains the fictitious particle -
algorithmListener
The AlgorithmListener to update the UI. -
n
protected final int nNumber of variables. -
nESV
protected final int nESVNumber of Extended System variables. -
x
protected final double[] xCurrent value of each variable. -
theta
protected double[] thetaCurrent value of each Extended System variable. -
grad
protected final double[] gradThe gradient. -
gradESV
protected double[] gradESVThe gradient. -
scaling
protected final double[] scalingScaling applied to each variable. -
done
protected boolean doneA flag to indicate the algorithm is done. -
terminate
protected boolean terminateA flag to indicate the algorithm should be terminated. -
time
protected long timeMinimization time in nanoseconds. -
energy
protected double energyThe final potential energy. -
status
protected int statusThe return status of the optimization. -
nSteps
protected int nStepsThe number of optimization steps taken.
-
-
Constructor Details
-
PhMinimize
public PhMinimize(MolecularAssembly molecularAssembly, Potential potential, AlgorithmListener algorithmListener, ExtendedSystem esvSystem) Constructor for Minimize.- Parameters:
molecularAssembly
- aMolecularAssembly
object.potential
- aPotential
object.algorithmListener
- aAlgorithmListener
object.
-
PhMinimize
public PhMinimize(MolecularAssembly molecularAssembly, AlgorithmListener algorithmListener, ExtendedSystem esvSystem) Constructor for Minimize.- Parameters:
molecularAssembly
- aMolecularAssembly
object.algorithmListener
- aAlgorithmListener
object.
-
-
Method Details
-
getEnergy
public double getEnergy()Getter for the fieldenergy
.- Returns:
- a double.
-
getRMSGradient
public double getRMSGradient()getRMSGradient.- Returns:
- a double.
-
getStatus
public int getStatus()Getter for the fieldstatus
.- Returns:
- The status of the optimization.
-
minimizeCoordinates
minimize- Returns:
- a
Potential
object.
-
minimizeCoordinates
minimize- Parameters:
eps
- The convergence criteria.- Returns:
- a
Potential
object.
-
minimizeCoordinates
minimize- Parameters:
eps
- The convergence criteria.maxIterations
- The maximum number of iterations.- Returns:
- a
Potential
object.
-
minimizeCoordinates
minimize- Parameters:
m
- The number of previous steps used to estimate the Hessian.eps
- The convergence criteria.maxIterations
- The maximum number of iterations.- Returns:
- a
Potential
object.
-
minimizeTitration
minimize- Parameters:
eps
- The convergence criteria.maxIterations
- The maximum number of iterations.- Returns:
- a
Potential
object.
-
minimizeTitration
minimize- Parameters:
m
- The number of previous steps used to estimate the Hessian.eps
- The convergence criteria.maxIterations
- The maximum number of iterations.- Returns:
- a
Potential
object.
-
optimizationUpdate
public boolean optimizationUpdate(int iteration, int nBFGS, int functionEvaluations, double rmsGradient, double rmsCoordinateChange, double energy, double energyChange, double angle, LineSearch.LineSearchResult lineSearchResult) This method is called by the optimizer after each step.It can be used to log status messages, update the user interface, or gracefully terminate the optimizer.
Implement the OptimizationListener interface.
- Specified by:
optimizationUpdate
in interfaceOptimizationListener
- Parameters:
iteration
- Number of iterations.nBFGS
- Number of L-BFGS correction vectors.functionEvaluations
- Number of function evaluations.rmsGradient
- RMS gradient at current solution.rmsCoordinateChange
- RMS coordinate change at current solution.energy
- Function value at current solution.energyChange
- Change in the function value compared to the previous solution.angle
- Current angle between gradient and search direction.lineSearchResult
- Result of the line search (null at iteration == 0).- Returns:
- A return value of false will terminate the optimization.
- Since:
- 1.0
-
terminate
public void terminate()This should be implemented as a blocking interrupt; when the method returns theTerminatable
algorithm has reached a clean termination point. For example, between minimize or molecular dynamics steps.- Specified by:
terminate
in interfaceTerminatable
-