Class Scine::Utils::GeometryOptimizer¶
-
template<class
OptimizerType
>
classGeometryOptimizer
: public Scine::Utils::GeometryOptimizerBase¶ Basically just a templated version of the base class GeometryOptimizerBase, where the template defines the actual optimizer used in the geometry optimization.
- 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
-
GeometryOptimizer
(Core::Calculator &calculator)¶ Construct a new GeometryOptimizer object.
- Parameters
calculator
: The calculator to be used for the single point/gradient calculations.
-
virtual int
optimize
(AtomCollection &atoms)¶ See GeometryOptimizerBase::optimize().
- Return
int The final number of optimization cycles carried out.
- Parameters
atoms
: The AtomCollection (Geometry) to be optimized.
-
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.
-
template<>
intoptimize
(AtomCollection &atoms)¶ The main functionality of the geometry 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.
-
template<>
intoptimize
(AtomCollection &atoms) The main functionality of the geometry 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.
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.