File IRCOptimizer.h¶
- Copyright
This code is licensed under the 3-clause BSD license.
Copyright ETH Zurich, Laboratory for Physical Chemistry, Reiher Group.
See LICENSE.txt for details.
-
namespace
Scine
This header file contains functions that allow for common notation for common things that can be done at a different degree of derivatives.
This header contains alias definitions defining which classes to use for the different degrees of derivatives.
-
namespace
Utils
-
class
IRCOptimizerBase
- #include <IRCOptimizer.h>
The base class for all IRC optimizers.
The main purpose of this base class is to hide the template parameter(s) of the derived class(es).
Subclassed by Scine::Utils::IRCOptimizer< OptimizerType >
Public Functions
-
IRCOptimizerBase
() Default constructor.
-
virtual
~IRCOptimizerBase
() Virtual default destructor.
-
virtual int
optimize
(AtomCollection &atoms, const Eigen::VectorXd &mode, bool forward = true) = 0 The main functionality of the IRC optimizer.
This function wraps the optimize functions of the underlying optimizer.
- Return
int The final number of optimization cycles carried out.
- Parameters
atoms
: The AtomCollection (Geometry) to be optimized.
-
virtual void
setSettings
(const Settings &settings) = 0 Function to apply the given settings to underlying classes.
- Parameters
settings
: The new settings.
-
virtual Settings
getSettings
() const = 0 Get the public settings as a Utils::Settings object.
- Return
Settings A settings object with the current settings.
-
virtual void
addObserver
(std::function<void(const int&, const double&, const Eigen::VectorXd&)> function) = 0 Add an observer function that will be triggered in each iteration.
- Parameters
function
: A function to be executed in every loop of the optimization. The function will have access to the current cycle count, the current value and to a const reference of the current parameters.
-
virtual void
clearObservers
() = 0 Clear all existing observer functions.
For optimization problems with very fast evaluations of the underlying function the removal of all observers can increase performance as the observers are given as std::functions and can not be added via templates.
Public Members
-
double
initialStepSize
= 0.01 The size of the initial step along the chosen mode.
-
bool
transformCoordinates
= true Switch to transform the coordinates from Cartesian into an internal space.
The optimization will be carried out in the internal coordinate space possibly accellerating convergence.
-
-
template<class
OptimizerType
, classConvergenceCheckType
>
classIRCOptimizerSettings
: public Scine::Utils::Settings - #include <IRCOptimizer.h>
Settings for an IRCOptimizer.
Uses template arguments in order to automatically include the settings of underlying objects into the given settings.
- Template Parameters
OptimizerType
: The underlying Optimizer class.ConvergenceCheckType
: The underlying ConvergenceCheck class.
Public Functions
-
IRCOptimizerSettings
(const IRCOptimizerBase &ircBase, const OptimizerType &optimizer, const ConvergenceCheckType &check) Construct a new IRCOptimizerSettings object.
Sets the default values of the settings to the current values set in the objects given to the constructor.
- Parameters
ircBase
: The IRC optimizer.optimizer
: The optimizer.check
: The convergence check criteria.
-
template<class
OptimizerType
>
classIRCOptimizer
: public Scine::Utils::IRCOptimizerBase - #include <IRCOptimizer.h>
A version of the GeometryOptimizer that optimizes along an internal reaction coordinate (IRC).
This optimizer mass-weights the actual gradient in order to optimize in the mass-weighted coordinate system.
- Template Parameters
OptimizerType
: Expects any of the Optimizer classes. Note that some special optimizers may not yet be supported or may need additional specialization.
Public Functions
-
IRCOptimizer
(Core::Calculator &calculator) Construct a new IRCOptimizer object.
- Parameters
calculator
: The calculator to be used for the single point/gradient calculations.
-
virtual int
optimize
(AtomCollection &atoms, const Eigen::VectorXd &mode, bool forward = true) See IRCOptimizerBase::optimize().
- Return
int The final number of optimization cycles carried out.
- Parameters
atoms
: The AtomCollection (Geometry) to be optimized.mode
: The mode to follow in the IRC.forward
: A boolean signaling to follow the mode forwards (true, current positions + mode) or backwards (false, current positions - mode)
-
virtual void
setSettings
(const Settings &settings) Function to apply the given settings to underlying classes.
- Parameters
settings
: The new settings.
-
virtual Settings
getSettings
() const Get the public settings as a Utils::Settings object.
- Return
Settings A settings object with the current settings.
-
virtual void
addObserver
(std::function<void(const int&, const double&, const Eigen::VectorXd&)> function) Add an observer function that will be triggered in each iteration.
- Parameters
function
: A function to be executed in every loop of the optimization. The function will have access to the current cycle count the current value and to a const reference of the current parameters.
-
virtual void
clearObservers
() Clear all existing observer functions.
For optimization problems with very fast evaluations of the underlying function the removal of all observers can increase performance as the observers are given as std::functions and can not be added via templates.
Public Members
-
OptimizerType
optimizer
The underlying optimizer, public in order to change it’s settings.
-
GradientBasedCheck
check
The underlying convergence check, public in order to change it’s settings.
Private Members
-
Core::Calculator &
_calculator
¶
-
class
-
namespace