File AFIROptimizerBase.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
AFIROptimizerBase
- #include <AFIROptimizerBase.h>
The base class for all AFIR optimizers.
The main purpose of this base class is to hide the template parameter(s) of the derived class(es).
This optimizer is a version of the GeometryOptimizer that optimizes the underlying structure while applying an additional artificial force for the induction of reactions.
The artificial force induced reaction (AFIR) optimizer is based on the works by Maeda et. al. The implementation was done following this reference: J Comput Chem., 2018, 39, 233 [DOI: 10.1002/jcc.25106] https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5765425/ (accessed 05.04.2019)
The original references are: J. Chem. Phys., 2010, 132, 241102 J. Chem. Theory Comput., 2011, 7, 2335
Subclassed by Scine::Utils::AFIROptimizer< OptimizerType >
Public Functions
-
AFIROptimizerBase
() Default constructor.
-
virtual
~AFIROptimizerBase
() Virtual default destructor.
-
virtual int
optimize
(AtomCollection &atoms) = 0 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.
-
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.
-
void
evaluateArtificialForces
(const AtomCollection &atoms, double &energy, Eigen::MatrixXd &gradients) const The function evaluating all artificial forces for the given set of atoms.
- Parameters
atoms
: The atoms.energy
: The added artificial energy in hartree/a.u.gradients
: The added artificial gradient contributions in a.u.
Public Members
-
std::vector<int>
lhsList
¶
-
std::vector<int>
rhsList
¶
-
double
energyAllowance
= 1000.0 The maximum amount of energy to be added by the artifical force, in kJ/mol.
This values gives the maximum height of an energy barrier the artificial force can force the molecule across.
-
bool
attractive
= true Switch for the artificial force to be attractive or repulsive.
If true, the atoms in the lhsList and rhsList will be forced towards one another, if false, the atoms will be repelled from one another.
-
bool
weak
= false Switch for an additional weak attractive force applied to all atom pairs.
If true a small attractive force is added across the entire set of atoms. The energy allowance for this force is calculated as \( 10/(N_{\text{atoms}}-1) \) kJ/mol.
-
int
phaseIn
= 100 The number of steps over which the full attractive force is slowly applied.
The phasing in of the artificial forces happens linearly. Note that only the force (gradient contribution) is phased in, the energy contribution is always added fully.
-
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.
Public Static Attributes
-
constexpr const char *
afirRHSListKey
= "afir_rhs_list"¶
-
constexpr const char *
afirLHSListKey
= "afir_lhs_list"¶
-
constexpr const char *
afirWeakForcesKey
= "afir_weak_forces"¶
-
constexpr const char *
afirAttractiveKey
= "afir_attractive"¶
-
constexpr const char *
afirEnergyAllowanceKey
= "afir_energy_allowance"¶
-
constexpr const char *
afirPhaseInKey
= "afir_phase_in"¶
-
constexpr const char *
afirTransfromCoordinatesKey
= "afir_transform_coordinates"¶
-
-
class
-
namespace