Loading...
Searching...
No Matches
BALL::ConjugateGradientMinimizer Class Reference
Molecular Modeling » Molecular Mechanics » Energy Minimizer

`#include <BALL/MOLMEC/MINIMIZATION/conjugateGradient.h>`

Inheritance diagram for BALL::ConjugateGradientMinimizer:

## Classes

struct | Option
struct | Default

## Public Types

Enums
enum | UpdateMethod { POLAK_RIBIERE = 1 , FLETCHER_REEVES = 2 , SHANNO = 3 }

## Public Member Functions

Constructors and Destructors
| ConjugateGradientMinimizer ()
| ConjugateGradientMinimizer (ForceField &force_field)
| ConjugateGradientMinimizer (ForceField &force_field, SnapShotManager *ssm)
| ConjugateGradientMinimizer (ForceField &force_field, SnapShotManager *ssm, const Options &options)
| ConjugateGradientMinimizer (ForceField &force_field, const Options &options)
| ConjugateGradientMinimizer (const ConjugateGradientMinimizer &rhs)
virtual | ~ConjugateGradientMinimizer ()
Assignments
const ConjugateGradientMinimizer & | operator= (const ConjugateGradientMinimizer &rhs)
Setup methods. They do all necessary preparations.
virtual bool | specificSetup ()
Accessors
void | setUpdateMethod (UpdateMethod method)
UpdateMethod | getUpdateMethod () const
virtual double | findStep ()
virtual void | updateDirection ()
virtual bool | minimize (Size iterations=0, bool resume=false)
Public Member Functions inherited from BALL::EnergyMinimizer
| EnergyMinimizer ()
| EnergyMinimizer (ForceField &force_field)
| EnergyMinimizer (ForceField &force_field, const Options &options)
| EnergyMinimizer (const EnergyMinimizer &energy_minimizer)
virtual | ~EnergyMinimizer ()
const EnergyMinimizer & | operator= (const EnergyMinimizer &energy_minimizer)
bool | operator== (const EnergyMinimizer &energy_minimizer)
bool | isValid () const
bool | setup (ForceField &force_field)
bool | setup (ForceField &force_field, SnapShotManager *ssm)
bool | setup (ForceField &force_field, SnapShotManager *ssm, const Options &options)
bool | setup (ForceField &force_field, const Options &options)
virtual bool | isConverged () const
virtual double | updateEnergy ()
virtual void | updateForces ()
void | storeGradientEnergy ()
virtual void | printEnergy () const
virtual void | takeSnapShot () const
virtual void | finishIteration ()
Size | getNumberOfIterations () const
Gradient & | getDirection ()
Gradient & | getGradient ()
Gradient & | getInitialGradient ()
double | getEnergy () const
double & | getEnergy ()
double | getInitialEnergy () const
double & | getInitialEnergy ()
void | setNumberOfIterations (Size number_of_iterations)
Size | getMaxNumberOfIterations () const
void | setMaxNumberOfIterations (Size number_of_iterations)
void | setMaxSameEnergy (Size number)
Size | getMaxSameEnergy () const
void | setEnergyOutputFrequency (Size energy_output_frequency)
Size | getEnergyOutputFrequency () const
void | setEnergyDifferenceBound (float energy_difference_bound)
float | getEnergyDifferenceBound () const
void | setMaxGradient (float max_gradient)
float | getMaxGradient () const
void | setMaximumDisplacement (float maximum_displacement)
float | getMaximumDisplacement () const
void | setSnapShotFrequency (Size snapshot_frequency)
Size | getSnapShotFrequency () const
ForceField * | getForceField ()
Size | getForceUpdateCounter () const
Size | getEnergyUpdateCounter () const
void | enableEnergyAbortCondition (bool state)
bool | energyAbortConditionEnabled () const
| Query if the MDSimulation aborts if the Energy is greater than abort_energy_.
void | setEnergyToAbort (float value)
float | getEnergyToAbort () const
bool | wasAborted () const

## Protected Attributes

Protected Attributes
LineSearch | line_search_
Gradient | unscaled_direction_
Size | number_of_atoms_
Size | updt_method_
bool | first_iter_
double | old_gtg_
vector< Vector3 > | a_i_
vector< Vector3 > | b_i_
vector< Vector3 > | p_t_
vector< Vector3 > | y_t_
vector< Vector3 > | p_i_
vector< Vector3 > | y_i_
double | D_1_
double | D_4_
Size | restart_frequency_
Size | last_restart_iter_
Protected Attributes inherited from BALL::EnergyMinimizer
Gradient | initial_grad_
Gradient | current_grad_
double | initial_energy_
double | current_energy_
Gradient | old_grad_
double | old_energy_
Gradient | direction_
bool | valid_
SnapShotManager * | snapshot_
ForceField * | force_field_
Size | number_of_iterations_
Size | maximal_number_of_iterations_
Size | energy_output_frequency_
Size | snapshot_frequency_
double | energy_difference_bound_
double | max_gradient_
Size | max_same_energy_
Size | same_energy_counter_
float | maximum_displacement_
Size | force_update_counter_
Size | energy_update_counter_
float | cutlo_
double | step_
bool | abort_by_energy_enabled_
float | abort_energy_
bool | aborted_

## Additional Inherited Members

Public Attributes inherited from BALL::EnergyMinimizer
Options | options

## Detailed Description

A minimizer for geometry optimization based on different conjugate gradient (CG) algorithms. See

[1] Fletcher, R. and Reeves, C.M. "Function Minimization by Conjugate Gradients" Comp. J., 7, 149-154, 1964

[2] David Shanno "Conjugate Gradient Methods With Inexact Searches" Mathematics of Operations Research, Vol. 3, No. 3, August 1978, pp. 244-256

[3] S. Watowich et. al "A Stable Rapidly Converging Conjugate Gradient Method for Energy Minimization" Journal of Computational Chemistry, Vol. 9, No. 6, pp. 650-661 (1988)

[4] M.J.D. Powell "Convergence properties of algorithms for nonlinear optimization" Report No. DAMPT 1985/NA1, University of Cambridge, 1985

[5] D.F. Shanno "Globally convergent conjugate gradient algorithms" Mathematical Programming 33 (1985), pp. 61-67

Definition at line 40 of file conjugateGradient.h.

## Member Enumeration Documentation

## UpdateMethod

enum BALL::ConjugateGradientMinimizer::UpdateMethod

The different conjugate gradient methods implemented.

See also
  updateDirection for details on the implementation and references

Enumerator
POLAK_RIBIERE | Polak-Ribiere method
FLETCHER_REEVES | Fletcher-Reeves method
SHANNO | Shanno

Definition at line 52 of file conjugateGradient.h.

## Constructor & Destructor Documentation

## ConjugateGradientMinimizer() [1/6]

BALL::ConjugateGradientMinimizer::ConjugateGradientMinimizer | ( |  | ) |

Default constructor.

## ConjugateGradientMinimizer() [2/6]

BALL::ConjugateGradientMinimizer::ConjugateGradientMinimizer | ( | ForceField & | force_field | ) |

Constructor expecting a valid force field

## ConjugateGradientMinimizer() [3/6]

BALL::ConjugateGradientMinimizer::ConjugateGradientMinimizer | ( | ForceField & | force_field,
|  | SnapShotManager * | ssm )

Constructor expecting a valid force field and a snapshot manager

## ConjugateGradientMinimizer() [4/6]

BALL::ConjugateGradientMinimizer::ConjugateGradientMinimizer | ( | ForceField & | force_field,
|  | SnapShotManager * | ssm,
|  | const Options & | options )

Constructor expecting a valid force field, a snapshot manager and options

## ConjugateGradientMinimizer() [5/6]

BALL::ConjugateGradientMinimizer::ConjugateGradientMinimizer | ( | ForceField & | force_field,
|  | const Options & | options )

Constructor expecting a valid force field and options

## ConjugateGradientMinimizer() [6/6]

BALL::ConjugateGradientMinimizer::ConjugateGradientMinimizer | ( | const ConjugateGradientMinimizer & | rhs | ) |

Copy constructor

## ~ConjugateGradientMinimizer()

virtual BALL::ConjugateGradientMinimizer::~ConjugateGradientMinimizer | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## findStep()

virtual double BALL::ConjugateGradientMinimizer::findStep | ( |  | ) |

virtual

Calculate the next step. First, this method updates the model. Second, it performs a line search along the calculated direction afterwards.

Returns
  double if the line search found an acceptable solution, otherwise -1.

See also
  EnergyMinimizer::findStep

Reimplemented from BALL::EnergyMinimizer.

## getUpdateMethod()

UpdateMethod BALL::ConjugateGradientMinimizer::getUpdateMethod | ( |  | ) | const

Returns the current method for updateDirection.

## minimize()

virtual bool BALL::ConjugateGradientMinimizer::minimize | ( | Size | iterations = 0,
|  | bool | resume = false )

virtual

Minimize the energy of the system. This method executes at most iterations minimization steps. If the number of iterations is not given, the number specified in the options is taken.

Parameters

  iterations | the maximum number of iterations
  resume | true to resume a previous run

See also
  EnergyMinimizer::minimize

Reimplemented from BALL::EnergyMinimizer.

## operator=()

const ConjugateGradientMinimizer & BALL::ConjugateGradientMinimizer::operator= | ( | const ConjugateGradientMinimizer & | rhs | ) |

Assignment operator

## setUpdateMethod()

void BALL::ConjugateGradientMinimizer::setUpdateMethod | ( | UpdateMethod | method | ) |

Set explicitly the criterion used for updateDirection. If the method is not recognized, this function fails.

## specificSetup()

virtual bool BALL::ConjugateGradientMinimizer::specificSetup | ( |  | ) |

virtual

Specific setup

Reimplemented from BALL::EnergyMinimizer.

## updateDirection()

virtual void BALL::ConjugateGradientMinimizer::updateDirection | ( |  | ) |

virtual

Update the search direction. This method updates the search direction. It uses the different conjugate gradient caculations dependend on the options.

Reimplemented from BALL::EnergyMinimizer.

## Member Data Documentation

## a_i_

vector<Vector3> BALL::ConjugateGradientMinimizer::a_i_

protected

Variable needed for the Shanno direction calculation

Definition at line 216 of file conjugateGradient.h.

## b_i_

vector<Vector3> BALL::ConjugateGradientMinimizer::b_i_

protected

Variable needed for the Shanno direction calculation

Definition at line 220 of file conjugateGradient.h.

## D_1_

double BALL::ConjugateGradientMinimizer::D_1_

protected

Variable needed for the Shanno direction calculation

Definition at line 240 of file conjugateGradient.h.

## D_4_

double BALL::ConjugateGradientMinimizer::D_4_

protected

Variable needed for the Shanno direction calculation

Definition at line 244 of file conjugateGradient.h.

## first_iter_

bool BALL::ConjugateGradientMinimizer::first_iter_

protected

Is this the (initial) first iteration?

Definition at line 208 of file conjugateGradient.h.

## last_restart_iter_

Size BALL::ConjugateGradientMinimizer::last_restart_iter_

protected

We count the iterations since the last restart. There are other necessities for a restart so the iteration counter may not coincide (by modulo) with the restart frequency.

Definition at line 255 of file conjugateGradient.h.

## line_search_

LineSearch BALL::ConjugateGradientMinimizer::line_search_

protected

The line search

Definition at line 192 of file conjugateGradient.h.

## number_of_atoms_

Size BALL::ConjugateGradientMinimizer::number_of_atoms_

protected

Number of movable atoms.

Definition at line 200 of file conjugateGradient.h.

## old_gtg_

double BALL::ConjugateGradientMinimizer::old_gtg_

protected

where is the gradient of the last iteration

Definition at line 212 of file conjugateGradient.h.

## p_i_

vector<Vector3> BALL::ConjugateGradientMinimizer::p_i_

protected

Variable needed for the Shanno direction calculation

Definition at line 232 of file conjugateGradient.h.

## p_t_

vector<Vector3> BALL::ConjugateGradientMinimizer::p_t_

protected

Variable needed for the Shanno direction calculation

Definition at line 224 of file conjugateGradient.h.

## restart_frequency_

Size BALL::ConjugateGradientMinimizer::restart_frequency_

protected

Frequency for restarts.

Definition at line 248 of file conjugateGradient.h.

## unscaled_direction_

Gradient BALL::ConjugateGradientMinimizer::unscaled_direction_

protected

Unscaled last search direction

Definition at line 196 of file conjugateGradient.h.

## updt_method_

Size BALL::ConjugateGradientMinimizer::updt_method_

protected

Update method used for the CG

Definition at line 204 of file conjugateGradient.h.

## y_i_

vector<Vector3> BALL::ConjugateGradientMinimizer::y_i_

protected

Variable needed for the Shanno direction calculation

Definition at line 236 of file conjugateGradient.h.

## y_t_

vector<Vector3> BALL::ConjugateGradientMinimizer::y_t_

protected

Variable needed for the Shanno direction calculation

Definition at line 228 of file conjugateGradient.h.