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
FieldsModifier and TypeFieldDescriptionprotected final AlgorithmListenerThe AlgorithmListener to update the UI.protected booleanA flag to indicate the algorithm is done.protected doubleThe final potential energy.protected final ExtendedSystemThe extended system that contains the fictitious particleprotected final double[]The gradient.protected double[]The gradient.protected final MolecularAssemblyThe MolecularAssembly being operated on.protected final intNumber of variables.protected final intNumber of Extended System variables.protected intThe number of optimization steps taken.protected final PotentialThe potential energy to optimize.protected final double[]Scaling applied to each variable.protected intThe return status of the optimization.protected booleanA flag to indicate the algorithm should be terminated.protected double[]Current value of each Extended System variable.protected longMinimization time in nanoseconds.protected final double[]Current value of each variable. -
Constructor Summary
ConstructorsConstructorDescriptionPhMinimize(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 TypeMethodDescriptiondoubleGetter for the fieldenergy.doublegetRMSGradient.intGetter 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) minimizebooleanoptimizationUpdate(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.voidThis should be implemented as a blocking interrupt; when the method returns theTerminatablealgorithm 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- aMolecularAssemblyobject.potential- aPotentialobject.algorithmListener- aAlgorithmListenerobject.
-
PhMinimize
public PhMinimize(MolecularAssembly molecularAssembly, AlgorithmListener algorithmListener, ExtendedSystem esvSystem) Constructor for Minimize.- Parameters:
molecularAssembly- aMolecularAssemblyobject.algorithmListener- aAlgorithmListenerobject.
-
-
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
Potentialobject.
-
minimizeCoordinates
minimize- Parameters:
eps- The convergence criteria.- Returns:
- a
Potentialobject.
-
minimizeCoordinates
minimize- Parameters:
eps- The convergence criteria.maxIterations- The maximum number of iterations.- Returns:
- a
Potentialobject.
-
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
Potentialobject.
-
minimizeTitration
minimize- Parameters:
eps- The convergence criteria.maxIterations- The maximum number of iterations.- Returns:
- a
Potentialobject.
-
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
Potentialobject.
-
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:
optimizationUpdatein 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 theTerminatablealgorithm has reached a clean termination point. For example, between minimize or molecular dynamics steps.- Specified by:
terminatein interfaceTerminatable
-