1 | //
|
---|
2 | // obwfn.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 | #ifndef _chemistry_qc_wfn_obwfn_h
|
---|
29 | #define _chemistry_qc_wfn_obwfn_h
|
---|
30 |
|
---|
31 | #ifdef __GNUC__
|
---|
32 | #pragma interface
|
---|
33 | #endif
|
---|
34 |
|
---|
35 | #include <chemistry/qc/wfn/wfn.h>
|
---|
36 |
|
---|
37 | namespace sc {
|
---|
38 |
|
---|
39 | /**A OneBodyWavefunction is a MolecularEnergy that solves an effective
|
---|
40 | one-body problem. */
|
---|
41 | class OneBodyWavefunction: public Wavefunction {
|
---|
42 | protected:
|
---|
43 | ResultRefSymmSCMatrix density_;
|
---|
44 | AccResultRefSCMatrix oso_eigenvectors_;
|
---|
45 | AccResultRefDiagSCMatrix eigenvalues_;
|
---|
46 | int nirrep_;
|
---|
47 | int *nvecperirrep_;
|
---|
48 | double *occupations_;
|
---|
49 | double *alpha_occupations_;
|
---|
50 | double *beta_occupations_;
|
---|
51 |
|
---|
52 | void init_sym_info();
|
---|
53 |
|
---|
54 | // oldocc is converted to newocc using the correlation
|
---|
55 | // table between initial_pg_ and the current point group
|
---|
56 | // returns 1 if successful and 0 otherwise. newocc is
|
---|
57 | // delete[]'ed and new'ed.
|
---|
58 | int form_occupations(int *&newocc, const int *oldocc);
|
---|
59 |
|
---|
60 | public:
|
---|
61 | OneBodyWavefunction(StateIn&);
|
---|
62 | /** The KeyVal constructor.
|
---|
63 | <dl>
|
---|
64 |
|
---|
65 | <dt><tt>eigenvector_accuracy</tt><dd> Gives the accuracy to which
|
---|
66 | eigenvectors are initially computed. The default 1.0e-7.
|
---|
67 | Accuracies are usually adjusted as needed anyway, so it should not
|
---|
68 | be necessary to change this.
|
---|
69 |
|
---|
70 | </dl>
|
---|
71 | */
|
---|
72 | OneBodyWavefunction(const Ref<KeyVal>&);
|
---|
73 | ~OneBodyWavefunction();
|
---|
74 |
|
---|
75 | void save_data_state(StateOut&);
|
---|
76 |
|
---|
77 | int nelectron();
|
---|
78 |
|
---|
79 | /** Overload of Function::set_desired_value_accuracy(). Must update
|
---|
80 | accuracy of the eigenvectors and the eigenvalues */
|
---|
81 | void set_desired_value_accuracy(double eps);
|
---|
82 |
|
---|
83 | // Following is a proposed interface to make the meaning of
|
---|
84 | // the various transformation matrices less confusing.
|
---|
85 | // /** These members give metrics and basis transformations
|
---|
86 | // using the covariant/contravariant tensor notation. */
|
---|
87 | // //@{
|
---|
88 | // /** Returns the transformation matrix that converts
|
---|
89 | // a contravariant SO tensor index to a contravariant
|
---|
90 | // MO tensor index.
|
---|
91 | // */
|
---|
92 | // RefSCMatrix t_mo_so_I_J();
|
---|
93 | // /** Returns the transformation matrix that converts a covariant SO
|
---|
94 | // tensor index to a covariant MO tensor index.
|
---|
95 | // */
|
---|
96 | // RefSCMatrix t_mo_so_i_j();
|
---|
97 | // /** Returns the transformation matrix that converts
|
---|
98 | // a contravariant MO tensor index to a contravariant
|
---|
99 | // SO tensor index.
|
---|
100 | // */
|
---|
101 | // RefSCMatrix t_mo_so_I_J();
|
---|
102 | // /** Returns the transformation matrix that converts a covariant MO
|
---|
103 | // tensor index to a covariant SO tensor index.
|
---|
104 | // */
|
---|
105 | // RefSCMatrix t_mo_so_i_j();
|
---|
106 | // /** Returns the metric for converting a covariant SO index into
|
---|
107 | // a contravariant one. */
|
---|
108 | // RefSCMatrix g_so_I_j();
|
---|
109 | // /** Returns the metric for converting a contravariant SO index into
|
---|
110 | // a covariant one. */
|
---|
111 | // RefSCMatrix g_so_i_J();
|
---|
112 | // //@}
|
---|
113 |
|
---|
114 | /// Returns the SO to MO transformation matrix.
|
---|
115 | RefSCMatrix so_to_mo();
|
---|
116 | /// Returns the orthogonal-SO to MO transformation matrix.
|
---|
117 | RefSCMatrix orthog_so_to_mo();
|
---|
118 | /// Returns the MO to SO transformation matrix.
|
---|
119 | RefSCMatrix mo_to_so();
|
---|
120 | /** Returns the MO to orthogonal-SO transformation matrix.
|
---|
121 | This returns the same matrix as oso_eigenvectors(). */
|
---|
122 | RefSCMatrix mo_to_orthog_so();
|
---|
123 |
|
---|
124 | /** Deprecated. Use so_to_mo().t() instead. */
|
---|
125 | RefSCMatrix eigenvectors();
|
---|
126 | /** Returns the orthogonal MO (columns) to orthogonal-SO (rows) transformation
|
---|
127 | matrix. */
|
---|
128 | virtual RefSCMatrix oso_eigenvectors() = 0;
|
---|
129 | /** Returns the MO basis eigenvalues. */
|
---|
130 | virtual RefDiagSCMatrix eigenvalues() = 0;
|
---|
131 | /** Returns the occupation. The irreducible representation and the
|
---|
132 | vector number within that representation are given as arguments. */
|
---|
133 | virtual double occupation(int irrep, int vectornum) = 0;
|
---|
134 | /** Returns the occupation. The vector number in the MO basis is given
|
---|
135 | as an argument. */
|
---|
136 | double occupation(int vectornum);
|
---|
137 |
|
---|
138 | /// Return 1 if the alpha orbitals are not equal to the beta orbitals.
|
---|
139 | virtual int spin_unrestricted() = 0;
|
---|
140 |
|
---|
141 | /** Returns the alpha occupation. The irreducible representation and the
|
---|
142 | vector number within that representation are given as arguments. */
|
---|
143 | virtual double alpha_occupation(int irrep, int vectornum);
|
---|
144 | /** Returns the beta occupation. The irreducible representation and the
|
---|
145 | vector number within that representation are given as arguments. */
|
---|
146 | virtual double beta_occupation(int irrep, int vectornum);
|
---|
147 | /** Returns the alpha occupation. The vector number in the MO basis is
|
---|
148 | given as an argument. */
|
---|
149 | double alpha_occupation(int vectornum);
|
---|
150 | /** Returns the beta occupation. The vector number in the MO basis is
|
---|
151 | given as an argument. */
|
---|
152 | double beta_occupation(int vectornum);
|
---|
153 |
|
---|
154 | // Return alpha and beta electron densities
|
---|
155 | virtual RefSCMatrix oso_alpha_eigenvectors();
|
---|
156 | virtual RefSCMatrix oso_beta_eigenvectors();
|
---|
157 | virtual RefSCMatrix alpha_eigenvectors();
|
---|
158 | virtual RefSCMatrix beta_eigenvectors();
|
---|
159 | virtual RefDiagSCMatrix alpha_eigenvalues();
|
---|
160 | virtual RefDiagSCMatrix beta_eigenvalues();
|
---|
161 |
|
---|
162 | virtual RefDiagSCMatrix
|
---|
163 | projected_eigenvalues(const Ref<OneBodyWavefunction>&, int alp=1);
|
---|
164 | /** Projects the density into the current basis set. Returns an
|
---|
165 | orthogonalized SO to MO transformation with the orbitals. */
|
---|
166 | virtual RefSCMatrix projected_eigenvectors(const Ref<OneBodyWavefunction>&,
|
---|
167 | int alp=1);
|
---|
168 | /** Return a guess vector. The guess transforms the orthogonal SO
|
---|
169 | basis to the MO basis. */
|
---|
170 | virtual RefSCMatrix hcore_guess();
|
---|
171 | /** Return a guess vector and the eigenvalues. The guess ransforms the
|
---|
172 | orthogonal SO basis to the MO basis. Storage for the eigenvalues
|
---|
173 | will be allocated. */
|
---|
174 | virtual RefSCMatrix hcore_guess(RefDiagSCMatrix &val);
|
---|
175 |
|
---|
176 | void symmetry_changed();
|
---|
177 |
|
---|
178 | double orbital(const SCVector3& r, int iorb);
|
---|
179 | double orbital_density(const SCVector3& r, int iorb, double* orbval = 0);
|
---|
180 |
|
---|
181 | void print(std::ostream&o=ExEnv::out0()) const;
|
---|
182 | };
|
---|
183 |
|
---|
184 |
|
---|
185 | // This is useful as an initial guess for other one body wavefunctions
|
---|
186 | class HCoreWfn: public OneBodyWavefunction {
|
---|
187 | private:
|
---|
188 | int nirrep_;
|
---|
189 | int *docc_;
|
---|
190 | int *socc_;
|
---|
191 | int total_charge_;
|
---|
192 | int user_occ_;
|
---|
193 |
|
---|
194 | void fill_occ(const RefDiagSCMatrix &evals,
|
---|
195 | int ndocc, int *docc, int nsocc = 0, int *socc = 0);
|
---|
196 |
|
---|
197 | void compute();
|
---|
198 |
|
---|
199 | public:
|
---|
200 | HCoreWfn(StateIn&);
|
---|
201 | HCoreWfn(const Ref<KeyVal>&);
|
---|
202 | ~HCoreWfn();
|
---|
203 |
|
---|
204 | void save_data_state(StateOut&);
|
---|
205 |
|
---|
206 | double occupation(int irrep, int vectornum);
|
---|
207 |
|
---|
208 | RefSCMatrix oso_eigenvectors();
|
---|
209 | RefDiagSCMatrix eigenvalues();
|
---|
210 | RefSymmSCMatrix density();
|
---|
211 | int spin_polarized();
|
---|
212 | int spin_unrestricted();
|
---|
213 |
|
---|
214 | int value_implemented() const;
|
---|
215 | };
|
---|
216 |
|
---|
217 | }
|
---|
218 |
|
---|
219 | #endif
|
---|
220 |
|
---|
221 | // Local Variables:
|
---|
222 | // mode: c++
|
---|
223 | // c-file-style: "ETS"
|
---|
224 | // End:
|
---|