MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
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
36namespace sc {
37
38class MolecularEnergy;
39
42
46class 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
76
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:
141
144};
145
174
201
203
207class MolecularGradient: virtual public SavableState {
208 double desired_accuracy_;
209 protected:
210 Ref<Molecule> mol_;
211 RefSCDimension d3natom_;
212 Ref<SCMatrixKit> matrixkit_;
213 public:
229
230 RefSCDimension d3natom();
231 Ref<SCMatrixKit> matrixkit() const { return matrixkit_; }
232
235
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:
DiagMolecularHessian is an implementation of MolecularHessian that returns a hessian that is a diagon...
Definition deriv.h:177
RefSymmSCMatrix cartesian_hessian()
Return the hessian in cartesian coordinates.
DiagMolecularHessian(const Ref< KeyVal > &)
The DiagMolecularHessian KeyVal constructor is used to generate a DiagMolecularHessian object from th...
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
GuessMolecularHessian is an implementation of MolecularHessian that estimates the hessian based on th...
Definition deriv.h:148
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
RefSymmSCMatrix cartesian_hessian()
Return the hessian in cartesian coordinates.
GuessMolecularHessian(const Ref< KeyVal > &)
The GuessMolecularHessian KeyVal constructor is used to generate a GuessMolecularHessian object from ...
The MolecularEnergy abstract class inherits from the Function class.
Definition energy.h:54
MolecularGradient is an abstract class that computes a molecule's first derivatives of the energy wit...
Definition deriv.h:207
static void write_cartesian_gradient(const char *filename, const Ref< Molecule > &m, const RefSCVector &grad)
Write the gradient in a simple text format.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
virtual void set_desired_accuracy(double acc)
Sets the desired accuracy.
virtual RefSCVector cartesian_gradient()=0
Return the cartesian hessian.
virtual void set_energy(const Ref< MolecularEnergy > &energy)
Some MolecularGradient specializations require a molecular energy object.
MolecularGradient(const Ref< KeyVal > &)
The MolecularGradient KeyVal constructor is used to generate a MolecularGradient object from the inpu...
static void read_cartesian_gradient(const char *filename, const Ref< Molecule > &m, const RefSCVector &grad)
Read the hessian from a simple text format.
virtual MolecularEnergy * energy() const
This returns a MolecularEnergy object, if used by this specialization.
virtual double desired_accuracy() const
Reports the desired accuracy.
MolecularHessian is an abstract class that computes a molecule's second derivatives of the energy wit...
Definition deriv.h:46
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
virtual MolecularEnergy * energy() const
This returns a MolecularEnergy object, if used by this specialization.
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.
static void write_cartesian_hessian(const char *filename, const Ref< Molecule > &m, const RefSymmSCMatrix &hess)
Write the hessian in a simple text format.
static void read_cartesian_hessian(const char *filename, const Ref< Molecule > &m, const RefSymmSCMatrix &hess)
Read the hessian from a simple text format.
virtual void set_energy(const Ref< MolecularEnergy > &energy)
Some MolecularHessian specializations require a molecular energy object.
virtual double desired_accuracy() const
Reports the desired accuracy.
MolecularHessian(const Ref< KeyVal > &)
The MolecularHessian KeyVal constructor is used to generate a MolecularHessian derivative object from...
virtual void set_desired_accuracy(double acc)
Sets the desired accuracy.
bool desired_accuracy_set_to_default() const
Definition deriv.h:114
virtual RefSymmSCMatrix cartesian_hessian()=0
Return the cartesian hessian.
ReadMolecularHessian is an implementation of MolecularHessian that reads the hessian from a file.
Definition deriv.h:120
RefSymmSCMatrix cartesian_hessian()
Return the hessian in cartesian coordinates.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
ReadMolecularHessian(const Ref< KeyVal > &)
The ReadMolecularHessian KeyVal constructor is used to generate a ReadMolecularHessian object from th...
The RefSCDimension class is a smart pointer to an SCDimension specialization.
Definition dim.h:152
The RefSCMatrix class is a smart pointer to an SCMatrix specialization.
Definition matrix.h:135
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:265
A template class that maintains references counts.
Definition ref.h:361
Base class for objects that can save/restore state.
Definition state.h:45
Restores fundamental and user-defined types from images created with StateOut.
Definition statein.h:79
Serializes fundamental and user-defined types.
Definition stateout.h:71
Contains all MPQC code up to version 3.
Definition mpqcin.h:14

Generated at Wed Sep 25 2024 02:45:28 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.12.0.