MADNESS 0.10.1
madness::MolecularOptimizer Class Reference

Molecular optimizer derived from the QuasiNewton optimizer. More...

#include <molecular_optimizer.h>

Inheritance diagram for madness::MolecularOptimizer:
Collaboration diagram for madness::MolecularOptimizer:

Public Member Functions

 MolecularOptimizer (World &world, const commandlineparser &parser, const std::shared_ptr< MolecularOptimizationTargetInterface > &tar)
 same ctor as the QuasiNewton optimizer
bool converged () const
bool converged (const Tensor< double > &displacement) const
double gradient_norm () const
bool optimize (Tensor< double > &x)
 optimize the underlying molecule
void set_hessian (const Tensor< double > &hess)
 set an (initial) hessian
double value () const
Public Member Functions inherited from madness::OptimizerInterface
virtual ~OptimizerInterface ()

Static Public Member Functions

static Tensor< double > compute_frequencies (const Molecule &molecule, const Tensor< double > &hessian, Tensor< double > &normalmodes, const std::vector< std::string > &remove_dof={}, const bool print_hessian=false)
 returns the vibrational frequencies
static Tensor< double > compute_reduced_mass (const Molecule &molecule, const Tensor< double > &normalmodes)
static Tensor< double > projector_external_dof (const Molecule &mol, const std::vector< std::string > &remove_dof)
 compute the projector to remove transl. and rot. degrees of freedom
static void remove_external_dof (Tensor< double > &hessian, const Molecule &mol, const std::vector< std::string > &remove_dof)
 remove translational degrees of freedom from the hessian

Public Attributes

MolecularOptimizationParameters parameters

Private Member Functions

Tensor< double > new_search_direction2 (const Tensor< double > &g, const Tensor< double > &hessian) const
 effectively invert the hessian and multiply with the gradient
bool optimize_conjugate_gradients (Tensor< double > &x)
bool optimize_quasi_newton (Tensor< double > &x)

Private Attributes

double f =1.e10
double gnorm =1.e10
Tensor< double > h
std::shared_ptr< MolecularOptimizationTargetInterface > target
 How to update the hessian: BFGS or SR1.

Detailed Description

Molecular optimizer derived from the QuasiNewton optimizer.

Essentially the QuasiNewton optimizer, but with the additional feature of projecting out rotational and translational degrees of freedom

Constructor & Destructor Documentation

◆ MolecularOptimizer()

madness::MolecularOptimizer::MolecularOptimizer ( World & world,
const commandlineparser & parser,
const std::shared_ptr< MolecularOptimizationTargetInterface > & tar )
inline

same ctor as the QuasiNewton optimizer

References parameters, and target.

Member Function Documentation

◆ compute_frequencies()

Tensor< double > madness::MolecularOptimizer::compute_frequencies ( const Molecule & molecule,
const Tensor< double > & hessian,
Tensor< double > & normalmodes,
const std::vector< std::string > & remove_dof = {},
const bool print_hessian = false )
inlinestatic

returns the vibrational frequencies

Parameters
[in]hessianthe hessian matrix (not mass-weighted)
[out]normalmodesthe normal modes
[in]project_trwhether to project out translation and rotation
[in]print_hessianwhether to print the hessian matrix
Returns
the frequencies in atomic units

References molecule.

Referenced by optimize_quasi_newton().

◆ compute_reduced_mass()

Tensor< double > madness::MolecularOptimizer::compute_reduced_mass ( const Molecule & molecule,
const Tensor< double > & normalmodes )
inlinestatic

◆ converged() [1/2]

bool madness::MolecularOptimizer::converged ( ) const
inlinevirtual

◆ converged() [2/2]

bool madness::MolecularOptimizer::converged ( const Tensor< double > & displacement) const
inline

◆ gradient_norm()

double madness::MolecularOptimizer::gradient_norm ( ) const
inlinevirtual

Implements madness::OptimizerInterface.

References gnorm.

Referenced by converged(), and converged().

◆ new_search_direction2()

Tensor< double > madness::MolecularOptimizer::new_search_direction2 ( const Tensor< double > & g,
const Tensor< double > & hessian ) const
inlineprivate

effectively invert the hessian and multiply with the gradient

References std::abs(), e(), madness::g, madness::inner(), parameters, madness::syev(), and v.

Referenced by optimize_quasi_newton().

◆ optimize()

bool madness::MolecularOptimizer::optimize ( Tensor< double > & x)
inlinevirtual

optimize the underlying molecule

Parameters
[in]xthe coordinates to compute energy and gradient

Implements madness::OptimizerInterface.

References converge(), and optimize_quasi_newton().

◆ optimize_conjugate_gradients()

bool madness::MolecularOptimizer::optimize_conjugate_gradients ( Tensor< double > & x)
inlineprivate

◆ optimize_quasi_newton()

◆ projector_external_dof()

Tensor< double > madness::MolecularOptimizer::projector_external_dof ( const Molecule & mol,
const std::vector< std::string > & remove_dof )
inlinestatic

compute the projector to remove transl. and rot. degrees of freedom

taken from http://www.gaussian.com/g_whitepap/vib.htm I don't really understand the concept behind the projectors, but it seems to work, and it is not written down explicitly anywhere. NOTE THE ERROR IN THE FORMULAS ON THE WEBPAGE !

Parameters
[in]do_remove_dofwhich dof to remove: x,y,z,Rx,Ry,Rz (transl/rot)

References madness::_(), madness::constants::atomic_mass_in_au, madness::Molecule::center_of_mass(), e(), madness::Molecule::get_atom(), madness::Atom::get_mass_in_au(), I, madness::inner(), madness::Molecule::moment_of_inertia(), madness::Molecule::natom(), norm(), madness::Tensor< T >::normf(), p(), madness::print(), madness::Tensor< T >::scale(), madness::syev(), madness::commandlineparser::tolower(), madness::Molecule::translate(), madness::transpose(), v, madness::Atom::x, madness::Atom::y, and madness::Atom::z.

Referenced by madness::Nemo::compute_IR_intensities(), compute_reduced_mass(), optimize_conjugate_gradients(), optimize_quasi_newton(), and remove_external_dof().

◆ remove_external_dof()

void madness::MolecularOptimizer::remove_external_dof ( Tensor< double > & hessian,
const Molecule & mol,
const std::vector< std::string > & remove_dof )
inlinestatic

remove translational degrees of freedom from the hessian

Parameters
[in]do_remove_dofwhich dof to remove: x,y,z,Rx,Ry,Rz (transl/rot)

References madness::inner(), and projector_external_dof().

Referenced by optimize_quasi_newton().

◆ set_hessian()

void madness::MolecularOptimizer::set_hessian ( const Tensor< double > & hess)
inline

set an (initial) hessian

References madness::copy(), and h.

◆ value()

double madness::MolecularOptimizer::value ( ) const
inlinevirtual

Member Data Documentation

◆ f

double madness::MolecularOptimizer::f =1.e10
private

Referenced by optimize_quasi_newton().

◆ gnorm

double madness::MolecularOptimizer::gnorm =1.e10
private

◆ h

Tensor<double> madness::MolecularOptimizer::h
private

◆ parameters

◆ target

std::shared_ptr<MolecularOptimizationTargetInterface> madness::MolecularOptimizer::target
private

How to update the hessian: BFGS or SR1.

Referenced by MolecularOptimizer(), optimize_conjugate_gradients(), and optimize_quasi_newton().


The documentation for this class was generated from the following file: