MPQC 2.3.1
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
43using namespace std;
44
45namespace sc {
46
55class MOIndexSpace : virtual public SavableState {
56
57public:
58
60 enum IndexOrder { symmetry = 0, energy = 1, undefined = 2 };
61
80 MOIndexSpace(std::string name, const RefSCMatrix& full_coefs,
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,
92 const RefDiagSCMatrix& evals, int nfzc, int nfzv, IndexOrder moorder = energy);
95 MOIndexSpace(std::string name, const RefSCMatrix& full_coefs,
97
100 MOIndexSpace(std::string name, const Ref<MOIndexSpace>& orig_space,
101 const RefSCMatrix& new_coefs,
102 const Ref<GaussianBasisSet>& new_basis);
104
106
108 const std::string name() const;
114 const RefSCMatrix coefs() const;
116 const RefDiagSCMatrix evals() const;
118 vector<int> mosym() 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
142private:
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
static std::ostream & out0()
Return an ostream that writes from node 0.
Class MOIndexSpace describes a range of molecular orbitals or similar objects that are linear combina...
Definition moindexspace.h:55
int nblocks() const
Returns the number of blocks.
size_t memory_in_use() const
Returns how much "significant" (i.e. O^2) memory this object uses.
const RefDiagSCMatrix evals() const
Returns the "eigenvalues" matrix.
void print(std::ostream &o=ExEnv::out0()) const
Prints out this.
int to_full_space(const int i) const
Returns the full-space index.
Ref< Integral > integral() const
Returns the integral factory used to instantiate the coefficient matrix.
vector< int > nmo() const
Returns the number of orbitals in each block.
int rank() const
Returns the rank of the space.
MOIndexSpace(std::string name, const RefSCMatrix &full_coefs, const Ref< GaussianBasisSet > basis, const Ref< Integral > &integral, const RefDiagSCMatrix &evals, int nfzc, int nfzv, IndexOrder moorder=energy)
This constructor should be used when the MOIndexSpace object is a subspace of a full orbital space.
MOIndexSpace(std::string name, const Ref< MOIndexSpace > &orig_space, const RefSCMatrix &new_coefs, const Ref< GaussianBasisSet > &new_basis)
This constructor is a true hack introduced because I have no idea how to construct what I need.
int full_rank() const
Returns the rank of the full space.
MOIndexSpace(std::string name, const RefSCMatrix &full_coefs, const Ref< GaussianBasisSet > basis, const Ref< Integral > &integral, const vector< int > &offsets, const vector< int > &nmopi, IndexOrder moorder=symmetry, const RefDiagSCMatrix &evals=0)
This function constructs an MOIndexSpace from (blocked) space full_coefs.
void print_summary(std::ostream &os) const
Produces a short summary.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
const RefSCMatrix coefs() const
Returns the coefficient matrix.
IndexOrder moorder() const
Returns the order of the orbitals.
MOIndexSpace(std::string name, const RefSCMatrix &full_coefs, const Ref< GaussianBasisSet > basis, const Ref< Integral > &integral)
This constructor should be used when the MOIndexSpace object is the full orbital space.
IndexOrder
Describes the ordering of indices.
Definition moindexspace.h:60
const std::string name() const
Returns the name of this MOIndexSpace.
vector< int > offsets() const
Returns the full-space index of the first orbital in each block.
vector< int > mosym() const
Returns the orbital symmetry array.
const Ref< GaussianBasisSet > basis() const
Returns the AO basis set.
The RefDiagSCMatrix class is a smart pointer to an DiagSCMatrix specialization.
Definition matrix.h:380
The RefSCDimension class is a smart pointer to an SCDimension specialization.
Definition dim.h:156
The RefSCMatrix class is a smart pointer to an SCMatrix specialization.
Definition matrix.h:135
A template class that maintains references counts.
Definition ref.h:332
Base class for objects that can save/restore state.
Definition state.h:46
Restores objects that derive from SavableState.
Definition statein.h:70
Serializes objects that derive from SavableState.
Definition stateout.h:61

Generated at Wed Mar 27 2024 02:45:28 for MPQC 2.3.1 using the documentation package Doxygen 1.9.8.