- Main Page
- Related Pages
- Classes
- Files

# fdhess.h

    00001 //
    00002 // fdhess.h
    00003 //
    00004 // Copyright (C) 1997 Limit Point Systems, Inc.
    00005 //
    00006 // Author: Curtis Janssen <cljanss@limitpt.com>
    00007 // Maintainer: LPS
    00008 //
    00009 // This file is part of the SC Toolkit.
    00010 //
    00011 // The SC Toolkit is free software; you can redistribute it and/or modify
    00012 // it under the terms of the GNU Library General Public License as published by
    00013 // the Free Software Foundation; either version 2, or (at your option)
    00014 // any later version.
    00015 //
    00016 // The SC Toolkit is distributed in the hope that it will be useful,
    00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00019 // GNU Library General Public License for more details.
    00020 //
    00021 // You should have received a copy of the GNU Library General Public License
    00022 // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
    00023 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
    00024 //
    00025 // The U.S. Government is granted a limited license as per AL 91-7.
    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
    00045 class FinDispMolecularHessian: public MolecularHessian {
    00046   protected:
    00047     Ref<MolecularEnergy> mole_;
    00048     // In case molecule must be given in lower symmetry, its actual
    00049     // symmetry and the symmetry used to compute displacements is this
    00050     Ref<PointGroup> displacement_point_group_;
    00051     // The molecule's original point group for restoration at the end.
    00052     Ref<PointGroup> original_point_group_;
    00053     // The molecule's original geometry for restoration at the end and
    00054     //computing displacements.
    00055     RefSCVector original_geometry_;
    00056     // the cartesian displacement size in bohr
    00057     double disp_;
    00058     // the accuracy for gradient calculations
    00059     double accuracy_;
    00060     // the number of completed displacements
    00061     int ndisp_;
    00062     // the number of irreps in the displacement point group
    00063     int nirrep_;
    00064     // whether or not to attempt a restart
    00065     int restart_;
    00066     // the name of the restart file
    00067     char *restart_file_;
    00068     // whether or not to checkpoint
    00069     int checkpoint_;
    00070     // the name of the checkpoint file
    00071     char *checkpoint_file_;
    00072     // only do the totally symmetric displacements
    00073     int only_totally_symmetric_;
    00074     // eliminate the cubic terms by doing an extra displacement for
    00075     //each of the totally symmetry coordinates
    00076     int eliminate_cubic_terms_;
    00077     // use the gradient at the initial geometry to remove first order terms
    00078     // (important if not at equilibrium geometry)
    00079     int do_null_displacement_;
    00080     // print flag
    00081     int debug_;
    00082     // a basis for the symmetrized cartesian coordinates
    00083     RefSCMatrix symbasis_;
    00084     // the gradients at each of the displacements
    00085     RefSCVector *gradients_;
    00086
    00087     void get_disp(int disp, int &irrep, int &index, double &coef);
    00088     void do_hess_for_irrep(int irrep,
    00089                            const RefSymmSCMatrix &dhessian,
    00090                            const RefSymmSCMatrix &xhessian);
    00091     void init();
    00092     void restart();
    00093   public:
    00094     FinDispMolecularHessian(const Ref<MolecularEnergy>&);
    00150     FinDispMolecularHessian(const Ref<KeyVal>&);
    00151     FinDispMolecularHessian(StateIn&);
    00152     ~FinDispMolecularHessian();
    00153     void save_data_state(StateOut&);
    00154
    00157     RefSymmSCMatrix compute_hessian_from_gradients();
    00158     int ndisplace() const;
    00159     int ndisplacements_done() const { return ndisp_; }
    00160     RefSCMatrix displacements(int irrep) const;
    00161     void displace(int disp);
    00162     void original_geometry();
    00163     void set_gradient(int disp, const RefSCVector &grad);
    00164     void checkpoint_displacements(StateOut&);
    00165     void restore_displacements(StateIn&);
    00166
    00169     RefSymmSCMatrix cartesian_hessian();
    00170
    00172     void set_checkpoint(int c) { checkpoint_ = c; }
    00174     int checkpoint() const { return checkpoint_; }
    00175
    00176     void set_energy(const Ref<MolecularEnergy> &energy);
    00177     MolecularEnergy* energy() const;
    00178
    00179     Ref<SCMatrixKit> matrixkit() const { return mole_->matrixkit(); }
    00180     RefSCDimension d3natom() const { return mole_->moldim(); }
    00181 };
    00182
    00183 }
    00184
    00185 #endif
    00186
    00187 // Local Variables:
    00188 // mode: c++
    00189 // c-file-style: "CLJ"
    00190 // End: