MPQC 2.3.1

- Main Page
- Related Pages
- Classes
- Files

- File List

moindexspace.h
1 //
2 // moindexspace.h
3 //
4 // Copyright (C) 2004 Edward Valeev
5 //
6 // Author: Edward Valeev <edward.valeev@chemistry.gatech.edu>
7 // Maintainer: EV
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 __GNUG__
29 #pragma interface
30 #endif
31
32 #ifndef _chemistry_qc_mbptr12_moindexspace_h
33 #define _chemistry_qc_mbptr12_moindexspace_h
34
35 #include <vector>
36 #include <util/ref/ref.h>
37 #include <util/state/statein.h>
38 #include <util/state/stateout.h>
39 #include <math/scmat/abstract.h>
40 #include <util/state/statein.h>
41 #include <chemistry/qc/basis/basis.h>
42
43 using namespace std;
44
45 namespace sc {
46
55 class MOIndexSpace : virtual public SavableState {
56
57 public:
58
60 enum IndexOrder { symmetry = 0, energy = 1, undefined = 2 };
61
62 MOIndexSpace(StateIn&);
80 MOIndexSpace(std::string name, const RefSCMatrix& full_coefs,
81 const Ref<GaussianBasisSet> basis, const Ref<Integral>& integral,
82 const vector<int>& offsets, const vector<int>& nmopi,
83 IndexOrder moorder = symmetry,
84 const RefDiagSCMatrix& evals = 0);
90 MOIndexSpace(std::string name, const RefSCMatrix& full_coefs,
91 const Ref<GaussianBasisSet> basis, const Ref<Integral>& integral,
92 const RefDiagSCMatrix& evals, int nfzc, int nfzv, IndexOrder moorder = energy);
95 MOIndexSpace(std::string name, const RefSCMatrix& full_coefs,
96 const Ref<GaussianBasisSet> basis, const Ref<Integral>& integral);
97
100 MOIndexSpace(std::string name, const Ref<MOIndexSpace>& orig_space,
101 const RefSCMatrix& new_coefs,
102 const Ref<GaussianBasisSet>& new_basis);
103 ~MOIndexSpace();
104
105 void save_data_state(StateOut&);
106
108 const std::string name() const;
110 const Ref<GaussianBasisSet> basis() const;
112 Ref<Integral> integral() const;
114 const RefSCMatrix coefs() const;
116 const RefDiagSCMatrix evals() const;
118 vector<int> mosym() const;
120 IndexOrder moorder() const;
122 int rank() const;
124 int full_rank() const;
126 int nblocks() const;
128 vector<int> nmo() const;
130 vector<int> offsets() const;
132 int to_full_space(const int i) const;
133
135 size_t memory_in_use() const;
136
138 void print(std::ostream&o=ExEnv::out0()) const;
140 void print_summary(std::ostream& os) const;
141
142 private:
143 std::string name_; // String identifier for the orbital space
144
145 Ref<GaussianBasisSet> basis_; // The AO basis
146 Ref<Integral> integral_; // The integral factory
147 RefSCMatrix coefs_; // AO->MO transformation coefficients (nao by nmo matrix)
148 RefDiagSCMatrix evals_; // "eigenvalues" associated with the MOs
149 RefSCDimension modim_; // The MO dimension
150 vector<int> mosym_; // irrep of each orbital
151
152 int rank_; // The rank of this space
153 int full_rank_; // Rank of the full space, i.e. number of MOs
154 int nblocks_; // Number of blocks
155 vector<int> nmo_; // Number of MOs in each block
156 vector<int> offsets_; // Index of the first MO in each block relative to the first MO of that block in full space
157 vector<int> map_to_full_space_; // Full-space index
158
159 IndexOrder moorder_;
160
161 // checks mosym_ for irrep indices outside of the allowed range
162 void check_mosym() const;
163
164 // determines offsets_ and nmo_ from nfzc, nfzv, and evals
165 void frozen_to_blockinfo(const int nfzc, const int nfzv, const RefDiagSCMatrix& evals);
166
167 // computes coefficient matrix from the full coefficient matrix. If moorder_ == energy
168 // then the MO vectors will be sorted by their eigenvalues
169 void full_coefs_to_coefs(const RefSCMatrix& full_coefs, const RefDiagSCMatrix& evals);
170
171 // initialize the object
172 void init();
173
174 // sorting functions borrowed from mbpt.cc
175 static void dquicksort(double *item,int *index,int n);
176 static void dqs(double *item,int *index,int left,int right);
177
178 };
179
180 }
181
182 #endif
183
184 // Local Variables:
185 // mode: c++
186 // c-file-style: "CLJ"
187 // End:
188
189