00001 // 00002 // molfreq.h 00003 // 00004 // Copyright (C) 1996 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 #ifdef __GNUC__ 00029 #pragma interface 00030 #endif 00031 00032 #ifndef _chemistry_molecule_molfreq_h 00033 #define _chemistry_molecule_molfreq_h 00034 00035 #include <iostream> 00036 #include <math/scmat/matrix.h> 00037 #include <util/render/animate.h> 00038 #include <chemistry/molecule/energy.h> 00039 #include <chemistry/molecule/molrender.h> 00040 #include <chemistry/molecule/coor.h> 00041 00042 class MolFreqAnimate; 00043 00046 class MolecularFrequencies: public SavableState { 00047 private: 00048 Ref<Molecule> mol_; 00049 Ref<PointGroup> pg_; 00050 int debug_; 00051 int nirrep_; 00052 // the number of frequencies per irrep 00053 int *nfreq_; 00054 // the frequencies for each irrep 00055 double **freq_; 00056 00057 Ref<SCMatrixKit> kit_; 00058 Ref<SCMatrixKit> symkit_; 00059 00060 // the symmetry blocked dimension for internal motions 00061 RefSCDimension disym_; 00062 // the cartesian dimension 00063 RefSCDimension d3natom_; 00064 // the blocked cartesian dimension 00065 RefSCDimension bd3natom_; 00066 // the normal coordinates 00067 RefSCMatrix normco_; 00068 00069 void do_freq_for_irrep(int irrep, 00070 const RefDiagSCMatrix &m, 00071 const RefSymmSCMatrix &dhessian, 00072 const RefSCMatrix &dtranst); 00073 public: 00100 MolecularFrequencies(const Ref<KeyVal> &); 00101 MolecularFrequencies(StateIn &); 00102 ~MolecularFrequencies(); 00103 void save_data_state(StateOut&); 00104 00106 Ref<Molecule> molecule() const { return mol_; } 00107 00109 void compute_frequencies(const RefSymmSCMatrix &xhessian); 00110 00112 int nirrep() const { return nirrep_; } 00113 00116 int nfreq(int irrep) const { return nfreq_[irrep]; } 00117 00120 double freq(int irrep, int i) const { return freq_[irrep][i]; } 00121 00124 RefSCMatrix normal_coordinates() { return normco_; } 00125 00128 void thermochemistry(int degeneracy, double temp=298.15, double pres=1.0); 00129 00130 void animate(const Ref<Render>&, const Ref<MolFreqAnimate>&); 00131 00132 Ref<SCMatrixKit> matrixkit() { return kit_; } 00133 Ref<SCMatrixKit> symmatrixkit() { return symkit_; } 00134 }; 00135 00136 00137 00138 class MolFreqAnimate: public AnimatedObject { 00139 private: 00140 Ref<RenderedMolecule> renmol_; 00141 Ref<MolecularFrequencies> molfreq_; 00142 Ref<MolecularEnergy> dependent_mole_; 00143 int irrep_; 00144 int mode_; 00145 int nframe_; 00146 public: 00147 MolFreqAnimate(const Ref<KeyVal> &); 00148 virtual ~MolFreqAnimate(); 00149 00150 void set_mode(int i, int j) { irrep_ = i; mode_ = j; } 00151 int nobject(); 00152 Ref<RenderedObject> object(int iobject); 00153 }; 00154 00155 00156 #endif 00157 00158 // Local Variables: 00159 // mode: c++ 00160 // c-file-style: "CLJ" 00161 // End: