00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
#ifndef _chemistry_molecule_fdhess_h
00029
#define _chemistry_molecule_fdhess_h
00030
00031
#ifdef __GNUC__
00032
#pragma interface
00033
#endif
00034
00035
#include <iostream>
00036
00037
#include <chemistry/molecule/hess.h>
00038
#include <chemistry/molecule/energy.h>
00039
00040
namespace sc {
00041
00043 class FinDispMolecularHessian:
public MolecularHessian {
00044
protected:
00045
Ref<MolecularEnergy> mole_;
00046
00047
00048
Ref<PointGroup> displacement_point_group_;
00049
00050
Ref<PointGroup> original_point_group_;
00051
00052
00053
RefSCVector original_geometry_;
00054
00055
double disp_;
00056
00057
double accuracy_;
00058
00059
int ndisp_;
00060
00061
int nirrep_;
00062
00063
int restart_;
00064
00065
char *restart_file_;
00066
00067
int checkpoint_;
00068
00069
char *checkpoint_file_;
00070
00071
int only_totally_symmetric_;
00072
00073
00074
int eliminate_cubic_terms_;
00075
00076
00077
int do_null_displacement_;
00078
00079
int debug_;
00080
00081
RefSCMatrix symbasis_;
00082
00083
RefSCVector *gradients_;
00084
00085
void get_disp(
int disp,
int &irrep,
int &index,
double &coef);
00086
void do_hess_for_irrep(
int irrep,
00087
const RefSymmSCMatrix &dhessian,
00088
const RefSymmSCMatrix &xhessian);
00089
void init();
00090
void restart();
00091
public:
00092
FinDispMolecularHessian(
const Ref<MolecularEnergy>&);
00093
FinDispMolecularHessian(
const Ref<KeyVal>&);
00094
FinDispMolecularHessian(
StateIn&);
00095 ~
FinDispMolecularHessian();
00096
void save_data_state(
StateOut&);
00097
00100
RefSymmSCMatrix compute_hessian_from_gradients();
00101
int ndisplace()
const;
00102
int ndisplacements_done()
const {
return ndisp_; }
00103
RefSCMatrix displacements(
int irrep)
const;
00104
void displace(
int disp);
00105
void original_geometry();
00106
void set_gradient(
int disp,
const RefSCVector &grad);
00107
void checkpoint_displacements(
StateOut&);
00108
void restore_displacements(
StateIn&);
00109
00112
RefSymmSCMatrix cartesian_hessian();
00113
00115 void set_checkpoint(
int c) { checkpoint_ = c; }
00117 int checkpoint()
const {
return checkpoint_; }
00118
00119
void set_energy(
const Ref<MolecularEnergy> &energy);
00120
MolecularEnergy* energy() const;
00121
00122
Ref<
SCMatrixKit> matrixkit()
const {
return mole_->matrixkit(); }
00123 RefSCDimension d3natom()
const {
return mole_->moldim(); }
00124 };
00125
00126 }
00127
00128
#endif
00129
00130
00131
00132
00133