1 | //
|
---|
2 | // molfreq.h
|
---|
3 | //
|
---|
4 | // Copyright (C) 1996 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 | #ifdef __GNUC__
|
---|
29 | #pragma interface
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #ifndef _chemistry_molecule_molfreq_h
|
---|
33 | #define _chemistry_molecule_molfreq_h
|
---|
34 |
|
---|
35 | #include <iostream>
|
---|
36 | #include <math/scmat/matrix.h>
|
---|
37 | #include <util/render/animate.h>
|
---|
38 | #include <chemistry/molecule/energy.h>
|
---|
39 | #include <chemistry/molecule/molrender.h>
|
---|
40 | #include <chemistry/molecule/coor.h>
|
---|
41 |
|
---|
42 | namespace sc {
|
---|
43 |
|
---|
44 | class MolFreqAnimate;
|
---|
45 |
|
---|
46 | /** The MolecularFrequencies class is used to compute the molecular
|
---|
47 | frequencies and thermodynamic information. */
|
---|
48 | class MolecularFrequencies: public SavableState {
|
---|
49 | private:
|
---|
50 | Ref<Molecule> mol_;
|
---|
51 | Ref<PointGroup> pg_;
|
---|
52 | int debug_;
|
---|
53 | int nirrep_;
|
---|
54 | // the number of frequencies per irrep
|
---|
55 | int *nfreq_;
|
---|
56 | // the frequencies for each irrep
|
---|
57 | double **freq_;
|
---|
58 |
|
---|
59 | Ref<SCMatrixKit> kit_;
|
---|
60 | Ref<SCMatrixKit> symkit_;
|
---|
61 |
|
---|
62 | // the symmetry blocked dimension for internal motions
|
---|
63 | RefSCDimension disym_;
|
---|
64 | // the cartesian dimension
|
---|
65 | RefSCDimension d3natom_;
|
---|
66 | // the blocked cartesian dimension
|
---|
67 | RefSCDimension bd3natom_;
|
---|
68 | // the normal coordinates
|
---|
69 | RefSCMatrix normco_;
|
---|
70 |
|
---|
71 | void do_freq_for_irrep(int irrep,
|
---|
72 | const RefDiagSCMatrix &m,
|
---|
73 | const RefSymmSCMatrix &dhessian,
|
---|
74 | const RefSCMatrix &dtranst);
|
---|
75 | public:
|
---|
76 | /** The KeyVal constructor.
|
---|
77 |
|
---|
78 | <dl>
|
---|
79 |
|
---|
80 | <dt><tt>mole</tt><dd> A MolecularEnergy object. If this is not
|
---|
81 | given then molecule must be given.
|
---|
82 |
|
---|
83 | <dt><tt>molecule</tt><dd> A Molecule object. If this is not given
|
---|
84 | then mole must be given.
|
---|
85 |
|
---|
86 | <dt><tt>point_group</tt><dd> A PointGroup object. This is the
|
---|
87 | point group used to compute the finite displacements. Since some
|
---|
88 | MolecularEnergy objects cannot handle changes in the molecule's
|
---|
89 | point group, the molecule must be given \f$C_1\f$ symmetry for
|
---|
90 | frequency calculations. In this case, the point_group keyword can
|
---|
91 | be given to reduce number of the displacements needed to compute
|
---|
92 | the frequencies. If this is not given then the point group of the
|
---|
93 | molecule is used.
|
---|
94 |
|
---|
95 | <dt><tt>debug</tt><dd> An integer which, if nonzero, will cause
|
---|
96 | extra output.
|
---|
97 |
|
---|
98 | <dt><tt>displacement</tt><dd> The amount that coordinates will be
|
---|
99 | displaced. The default is 0.001.
|
---|
100 |
|
---|
101 | </dl> */
|
---|
102 | MolecularFrequencies(const Ref<KeyVal> &);
|
---|
103 | MolecularFrequencies(StateIn &);
|
---|
104 | ~MolecularFrequencies();
|
---|
105 | void save_data_state(StateOut&);
|
---|
106 |
|
---|
107 | /// Return the molecule.
|
---|
108 | Ref<Molecule> molecule() const { return mol_; }
|
---|
109 |
|
---|
110 | /// Given a cartesian coordinate hessian, compute the frequencies.
|
---|
111 | void compute_frequencies(const RefSymmSCMatrix &xhessian);
|
---|
112 |
|
---|
113 | /// Returns the number if irreps.
|
---|
114 | int nirrep() const { return nirrep_; }
|
---|
115 |
|
---|
116 | /** Returns the number of modes in an irrep. compute_frequencies
|
---|
117 | must be called first. */
|
---|
118 | int nfreq(int irrep) const { return nfreq_[irrep]; }
|
---|
119 |
|
---|
120 | /** Returns the frequency, given the irrep and the index.
|
---|
121 | compute_frequencies must be called first. */
|
---|
122 | double freq(int irrep, int i) const { return freq_[irrep][i]; }
|
---|
123 |
|
---|
124 | /** This returns the normal coordinates generated by
|
---|
125 | compute_frequencies. */
|
---|
126 | RefSCMatrix normal_coordinates() { return normco_; }
|
---|
127 |
|
---|
128 | /** Computes thermochemical information using information generated
|
---|
129 | by calling compute_frequencies first. */
|
---|
130 | void thermochemistry(int degeneracy, double temp=298.15, double pres=1.0);
|
---|
131 |
|
---|
132 | void animate(const Ref<Render>&, const Ref<MolFreqAnimate>&);
|
---|
133 |
|
---|
134 | Ref<SCMatrixKit> matrixkit() { return kit_; }
|
---|
135 | Ref<SCMatrixKit> symmatrixkit() { return symkit_; }
|
---|
136 | };
|
---|
137 |
|
---|
138 |
|
---|
139 |
|
---|
140 | class MolFreqAnimate: public AnimatedObject {
|
---|
141 | private:
|
---|
142 | Ref<RenderedMolecule> renmol_;
|
---|
143 | Ref<MolecularFrequencies> molfreq_;
|
---|
144 | Ref<MolecularEnergy> dependent_mole_;
|
---|
145 | int irrep_;
|
---|
146 | int mode_;
|
---|
147 | int nframe_;
|
---|
148 | double disp_;
|
---|
149 | public:
|
---|
150 | MolFreqAnimate(const Ref<KeyVal> &);
|
---|
151 | virtual ~MolFreqAnimate();
|
---|
152 |
|
---|
153 | void set_mode(int i, int j) { irrep_ = i; mode_ = j; }
|
---|
154 | int nobject();
|
---|
155 | Ref<RenderedObject> object(int iobject);
|
---|
156 | };
|
---|
157 |
|
---|
158 | }
|
---|
159 |
|
---|
160 | #endif
|
---|
161 |
|
---|
162 | // Local Variables:
|
---|
163 | // mode: c++
|
---|
164 | // c-file-style: "CLJ"
|
---|
165 | // End:
|
---|