28#ifndef _chemistry_molecule_energy_h
29#define _chemistry_molecule_energy_h
37#include <math/optimize/function.h>
38#include <math/optimize/conv.h>
39#include <chemistry/molecule/molecule.h>
40#include <chemistry/molecule/coor.h>
41#include <chemistry/molecule/hess.h>
48class MolecularEnergy:
public Function {
69 void failure(
const char *);
82 int print_molecule_when_changed_;
84 MolecularEnergy(
const MolecularEnergy&);
143 void set_checkpoint_file(
const char*);
144 void set_checkpoint_freq(
int freq);
147 const char* checkpoint_file()
const;
148 int checkpoint_freq()
const;
150 MolecularEnergy & operator=(
const MolecularEnergy&);
164 int hessian_implemented()
const;
185 const char *t=0, std::ostream&o=
ExEnv::out0())
const;
193class SumMolecularEnergy:
public MolecularEnergy {
202 ~SumMolecularEnergy();
207 int gradient_implemented()
const;
208 int hessian_implemented()
const;
235class MolEnergyConvergence:
public Convergence {
243 MolEnergyConvergence();
244 MolEnergyConvergence(
StateIn&);
263 virtual ~MolEnergyConvergence();
static std::ostream & out0()
Return an ostream that writes from node 0.
MolEnergyConvergence(const Ref< KeyVal > &)
The KeyVal constructor.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
int converged()
Return nonzero if the optimization has converged.
void get_grad(const Ref< Function > &)
Set the current gradient and displacement.
RefSymmSCMatrix get_cartesian_hessian()
Return the cartesian hessian.
void print_natom_3(const RefSCVector &, const char *t=0, std::ostream &o=ExEnv::out0()) const
Nicely print n x 3 data that are stored in a vector.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
MolecularEnergy(const Ref< KeyVal > &)
The KeyVal constructor.
RefSCVector get_cartesian_x()
Return the cartesian coordinates.
RefSCVector get_cartesian_gradient()
Return the cartesian gradient.
virtual double energy()
A wrapper around value();.
virtual void set_gradient(RefSCVector &)
These are passed gradients and hessian in cartesian coordinates.
void guess_hessian(RefSymmSCMatrix &)
Compute a quick, approximate hessian.
RefSymmSCMatrix hessian()
If a molecule hessian object is given, it will be used to provide a hessian.
virtual void set_energy(double)
This is just a wrapper around set_value().
void set_checkpoint()
Set up checkpointing.
Ref< NonlinearTransform > change_coordinates()
An optimizer can call change coordinates periodically to give the function an opportunity to change i...
void set_x(const RefSCVector &)
Set and retrieve the coordinate values.
bool if_to_checkpoint() const
Check if need to checkpoint.
virtual void symmetry_changed()
Call this if you have changed the molecular symmetry of the molecule contained by this MolecularEnerg...
virtual void print(std::ostream &=ExEnv::out0()) const
Print information about the object.
The RefSCDimension class is a smart pointer to an SCDimension specialization.
Definition dim.h:156
The RefSCVector class is a smart pointer to an SCVector specialization.
Definition matrix.h:55
The RefSymmSCMatrix class is a smart pointer to an SCSymmSCMatrix specialization.
Definition matrix.h:261
A template class that maintains references counts.
Definition ref.h:332
Restores objects that derive from SavableState.
Definition statein.h:70
Serializes objects that derive from SavableState.
Definition stateout.h:61
void set_x(const RefSCVector &)
Set and retrieve the coordinate values.
int value_implemented() const
Information about the availability of values, gradients, and hessians.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
void compute()
Recompute at least the results that have compute true and are not already computed.