MPQC  3.0.0-alpha
deriv.h
1 //
2 // deriv.h
3 //
4 // Copyright (C) 1997 Limit Point Systems, Inc.
5 //
6 // Author: Curtis Janssen <cljanss@limitpt.com>
7 // Maintainer: LPS
8 //
9 // This file is part of the SC Toolkit.
10 //
11 // The SC Toolkit is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU Library General Public License as published by
13 // the Free Software Foundation; either version 2, or (at your option)
14 // any later version.
15 //
16 // The SC Toolkit is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU Library General Public License for more details.
20 //
21 // You should have received a copy of the GNU Library General Public License
22 // along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24 //
25 // The U.S. Government is granted a limited license as per AL 91-7.
26 //
27 
28 #ifndef _chemistry_molecule_deriv_h
29 #define _chemistry_molecule_deriv_h
30 
31 #include <iostream>
32 
33 #include <chemistry/molecule/molecule.h>
34 #include <chemistry/molecule/coor.h>
35 
36 namespace sc {
37 
38 class MolecularEnergy;
39 
42 
46 class MolecularHessian: virtual public SavableState {
47  static double desired_accuracy_default_;
48  double desired_accuracy_;
49  bool desired_accuracy_set_to_default_;
50  protected:
51  Ref<Molecule> mol_;
52  RefSCDimension d3natom_;
53  Ref<SCMatrixKit> matrixkit_;
54  public:
70 
71  RefSCDimension d3natom();
72  Ref<SCMatrixKit> matrixkit() const { return matrixkit_; }
73 
75  virtual RefSymmSCMatrix cartesian_hessian() = 0;
76 
80  virtual void set_energy(const Ref<MolecularEnergy> &energy);
83  virtual MolecularEnergy* energy() const;
84 
88  Ref<PointGroup> pg = 0,
89  Ref<SCMatrixKit> kit = 0);
90 
92  static void write_cartesian_hessian(const char *filename,
93  const Ref<Molecule> &m,
94  const RefSymmSCMatrix &hess);
95 
97  static void read_cartesian_hessian(const char *filename,
98  const Ref<Molecule> &m,
99  const RefSymmSCMatrix &hess);
100 
105  virtual void set_desired_accuracy(double acc);
110  virtual double desired_accuracy() const;
114  bool desired_accuracy_set_to_default() const { return desired_accuracy_set_to_default_; }
115 };
116 
117 
121  protected:
122  std::string filename_;
123  public:
140  void save_data_state(StateOut&);
141 
144 };
145 
149  protected:
150  Ref<MolecularCoor> coor_;
151  public:
169  void save_data_state(StateOut&);
170 
173 };
174 
178  protected:
179  double diag_;
180  public:
196  void save_data_state(StateOut&);
197 
200 };
201 
203 
207 class MolecularGradient: virtual public SavableState {
208  double desired_accuracy_;
209  protected:
210  Ref<Molecule> mol_;
211  RefSCDimension d3natom_;
212  Ref<SCMatrixKit> matrixkit_;
213  public:
228  void save_data_state(StateOut&);
229 
230  RefSCDimension d3natom();
231  Ref<SCMatrixKit> matrixkit() const { return matrixkit_; }
232 
234  virtual RefSCVector cartesian_gradient() = 0;
235 
239  virtual void set_energy(const Ref<MolecularEnergy> &energy);
242  virtual MolecularEnergy* energy() const;
243 
245  static void write_cartesian_gradient(const char *filename,
246  const Ref<Molecule> &m,
247  const RefSCVector &grad);
248 
250  static void read_cartesian_gradient(const char *filename,
251  const Ref<Molecule> &m,
252  const RefSCVector &grad);
253 
258  virtual void set_desired_accuracy(double acc);
263  virtual double desired_accuracy() const;
264 };
265 
267 // end of addtogroup ChemistryMolecule
268 
269 }
270 
271 #endif
272 
273 // Local Variables:
274 // mode: c++
275 // c-file-style: "CLJ"
276 // End:
sc::GuessMolecularHessian::GuessMolecularHessian
GuessMolecularHessian(const Ref< KeyVal > &)
The GuessMolecularHessian KeyVal constructor is used to generate a GuessMolecularHessian object from ...
sc::DiagMolecularHessian::save_data_state
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
sc::DiagMolecularHessian::cartesian_hessian
RefSymmSCMatrix cartesian_hessian()
Return the hessian in cartesian coordinates.
sc::MolecularGradient::set_desired_accuracy
virtual void set_desired_accuracy(double acc)
Sets the desired accuracy.
sc::RefSymmSCMatrix
The RefSymmSCMatrix class is a smart pointer to an SCSymmSCMatrix specialization.
Definition: matrix.h:265
sc::MolecularHessian::desired_accuracy
virtual double desired_accuracy() const
Reports the desired accuracy.
sc::MolecularHessian::write_cartesian_hessian
static void write_cartesian_hessian(const char *filename, const Ref< Molecule > &m, const RefSymmSCMatrix &hess)
Write the hessian in a simple text format.
sc::ReadMolecularHessian::cartesian_hessian
RefSymmSCMatrix cartesian_hessian()
Return the hessian in cartesian coordinates.
sc::RefSCMatrix
The RefSCMatrix class is a smart pointer to an SCMatrix specialization.
Definition: matrix.h:135
sc::Ref
A template class that maintains references counts.
Definition: ref.h:361
sc::MolecularGradient::read_cartesian_gradient
static void read_cartesian_gradient(const char *filename, const Ref< Molecule > &m, const RefSCVector &grad)
Read the hessian from a simple text format.
sc::MolecularGradient::save_data_state
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
sc::MolecularHessian::read_cartesian_hessian
static void read_cartesian_hessian(const char *filename, const Ref< Molecule > &m, const RefSymmSCMatrix &hess)
Read the hessian from a simple text format.
sc::MolecularHessian::cartesian_to_symmetry
static RefSCMatrix cartesian_to_symmetry(const Ref< Molecule > &m, Ref< PointGroup > pg=0, Ref< SCMatrixKit > kit=0)
Find transformation matrix from cartesian to symmetry coordinates.
sc::MolecularHessian::save_data_state
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
sc::MolecularGradient
MolecularGradient is an abstract class that computes a molecule's first derivatives of the energy wit...
Definition: deriv.h:207
sc::MolecularHessian
MolecularHessian is an abstract class that computes a molecule's second derivatives of the energy wit...
Definition: deriv.h:46
sc::DiagMolecularHessian::DiagMolecularHessian
DiagMolecularHessian(const Ref< KeyVal > &)
The DiagMolecularHessian KeyVal constructor is used to generate a DiagMolecularHessian object from th...
sc::MolecularGradient::energy
virtual MolecularEnergy * energy() const
This returns a MolecularEnergy object, if used by this specialization.
sc::MolecularGradient::desired_accuracy
virtual double desired_accuracy() const
Reports the desired accuracy.
sc::StateIn
Definition: statein.h:79
sc::RefSCDimension
The RefSCDimension class is a smart pointer to an SCDimension specialization.
Definition: dim.h:152
sc::MolecularHessian::set_desired_accuracy
virtual void set_desired_accuracy(double acc)
Sets the desired accuracy.
sc::MolecularHessian::energy
virtual MolecularEnergy * energy() const
This returns a MolecularEnergy object, if used by this specialization.
sc::MolecularEnergy
The MolecularEnergy abstract class inherits from the Function class.
Definition: energy.h:50
sc::ReadMolecularHessian::ReadMolecularHessian
ReadMolecularHessian(const Ref< KeyVal > &)
The ReadMolecularHessian KeyVal constructor is used to generate a ReadMolecularHessian object from th...
sc::MolecularGradient::write_cartesian_gradient
static void write_cartesian_gradient(const char *filename, const Ref< Molecule > &m, const RefSCVector &grad)
Write the gradient in a simple text format.
sc::MolecularHessian::set_energy
virtual void set_energy(const Ref< MolecularEnergy > &energy)
Some MolecularHessian specializations require a molecular energy object.
sc::MolecularGradient::cartesian_gradient
virtual RefSCVector cartesian_gradient()=0
Return the cartesian hessian.
sc::GuessMolecularHessian::cartesian_hessian
RefSymmSCMatrix cartesian_hessian()
Return the hessian in cartesian coordinates.
sc::RefSCVector
The RefSCVector class is a smart pointer to an SCVector specialization.
Definition: matrix.h:55
sc::StateOut
Definition: stateout.h:71
sc::DiagMolecularHessian
DiagMolecularHessian is an implementation of MolecularHessian that returns a hessian that is a diagon...
Definition: deriv.h:177
sc::ReadMolecularHessian::save_data_state
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
sc::MolecularHessian::cartesian_hessian
virtual RefSymmSCMatrix cartesian_hessian()=0
Return the cartesian hessian.
sc::SavableState
Base class for objects that can save/restore state.
Definition: state.h:45
sc::GuessMolecularHessian
GuessMolecularHessian is an implementation of MolecularHessian that estimates the hessian based on th...
Definition: deriv.h:148
sc::MolecularHessian::desired_accuracy_set_to_default
bool desired_accuracy_set_to_default() const
Definition: deriv.h:114
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
sc::GuessMolecularHessian::save_data_state
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
sc::ReadMolecularHessian
ReadMolecularHessian is an implementation of MolecularHessian that reads the hessian from a file.
Definition: deriv.h:120
sc::MolecularGradient::set_energy
virtual void set_energy(const Ref< MolecularEnergy > &energy)
Some MolecularGradient specializations require a molecular energy object.

Generated at Sun Jan 26 2020 23:23:56 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.