Psi4
index.h
Go to the documentation of this file.
1 /*
2  * @BEGIN LICENSE
3  *
4  * Psi4: an open-source quantum chemistry software package
5  *
6  * Copyright (c) 2007-2017 The Psi4 Developers.
7  *
8  * The copyrights for code used from other parties are included in
9  * the corresponding files.
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program 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 General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License along
22  * with this program; if not, write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  *
25  * @END LICENSE
26  */
27 
28 #ifndef _psi_src_bin_psimrcc_ccindex_h
29 #define _psi_src_bin_psimrcc_ccindex_h
30 
35 /*********************************************************
36  CCIndex Class
37  1) Purpose
38  This class is used to store n-tuples of MOs indices (p,q,r,..)
39  2) Use
40  3) Details
41  The pairs are stored according to the irreps, for example
42 
43  A1 A2 B1 B2
44  ----------------------------------------------
45  |(0,0),(0,1)| (4,5),(7,9) | .......|........|
46  ----------------------------------------------
47  4) Uses
48  MOInfo class
49  STL <vector>
50 
51 *********************************************************/
52 
54 #include <vector>
55 
56 namespace psi{
57 
58  namespace psimrcc{
59 
60 typedef std::vector<std::vector<int> > vecvecint;
61 
66 class CCIndex{
67  typedef std::vector<int*> pIntVec;
68  typedef std::vector<size_t> Size_tVec;
69  typedef std::vector<size_t*> pSize_tVec;
70 public:
72  // Class Constructor and Destructor
74  CCIndex(std::string str);
75  ~CCIndex();
76 
78  // Class Interface
80  // Print routines
81  void print();
82  // Get the numeber of tuples and the numeber of indices per tuple
83  int get_ntuples() {return(ntuples);}
84  int get_nelements() {return(nelements);}
85  std::string get_label() {return(label);}
86 
87  // Get the tuples
88  short** get_tuples() {return(tuples);}
89  short* get_tuple(int i) {return(tuples[i]);}
90 
91  // Get the tuples irrep structure
92  size_t get_first(int i) {return(first[i]);}
93  size_t get_last(int i) {return(last[i]);}
94  size_t get_pairpi(int i) {return(tuplespi[i]);}
95  size_t get_tuplespi(int i) {return(tuplespi[i]);}
97  Size_tVec& get_first() {return(first);}
98  Size_tVec& get_last() {return(last);}
100 
101 
102  // Given a set of number retrieve the corresponding tuple index relative to the tuple's irrep
104  size_t get_tuple_abs_index(short p, short q) {return(first[two_index_to_irrep[p][q]] + two_index_to_tuple_rel_index[p][q]);}
105  size_t get_tuple_abs_index(short p, short q, short r) {return(first[three_index_to_irrep[p][q][r]] + three_index_to_tuple_rel_index[p][q][r]);}
106 
107  // Given a set of number retrieve the corresponding tuple index relative to the tuple's irrep
108  size_t get_tuple_rel_index(short p) {return(one_index_to_tuple_rel_index[p]);}
109  size_t get_tuple_rel_index(short p, short q) {return(two_index_to_tuple_rel_index[p][q]);}
110  size_t get_tuple_rel_index(short p, short q, short r) {return(three_index_to_tuple_rel_index[p][q][r]);}
111 
112  // Given a set of number retrieve the corresponding tuple irrep
113  int get_tuple_irrep(short p) {return(one_index_to_irrep[p]);}
114  int get_tuple_irrep(short p, short q) {return(two_index_to_irrep[p][q]);}
115  int get_tuple_irrep(short p, short q, short r) {return(three_index_to_irrep[p][q][r]);}
116 
118 
125 
126  int** get_element_irrep() {return(element_irrep);}
127 
128 private:
130  // Class private functions
132  void init();
133  void cleanup();
134  void make_zero_index();
135  void make_one_index();
136  void make_two_index();
137  void make_three_index();
139  // Class data
141  // Type // Name
142  std::string label; // The label of this object
143  int nirreps; // The number of irreps
144  int nelements; // Number of elements
145  Size_tVec dimension; // Size of the elements space
146  vecvecint mospi; // Size of each irrep of the elements space
147  vecvecint first_mos; // Last mo of each irrep of the elements space
148  vecvecint indices_to_pitzer; // Mapping from the mos of this space to Pitzer
149  bool greater_than_or_equal; // >= tuples
150  bool greater_than; // > tuples
151  size_t ntuples; // Number of tuples
152  short** tuples; // The tuples ordered as matrix : tuples[number][element]
153  Size_tVec first; // First pair of irrep
154  Size_tVec last; // Last pair of irrep
155  Size_tVec tuplespi; // Number of tuples for irrep
156  size_t* one_index_to_tuple_rel_index; // 1->tuple mapping array
157  size_t** two_index_to_tuple_rel_index; // 2->tuple mapping array
158  size_t*** three_index_to_tuple_rel_index; // 3->tuple mapping array
159  int* one_index_to_irrep; // 1->irrep mapping array
160  int** two_index_to_irrep; // 2->irrep mapping array
161  int*** three_index_to_irrep; // 3->irrep mapping array
162  int** element_irrep; // Irrep of each element
163 };
164 
165 }} /* End Namespaces */
166 
167 #endif // _psi_src_bin_psimrcc_ccindex_h
Size_tVec & get_first()
Definition: index.h:97
size_t * one_index_to_tuple_rel_index
Definition: index.h:156
int get_ntuples()
Definition: index.h:83
size_t get_last(int i)
Definition: index.h:93
PsiReturnType psimrcc(SharedWavefunction, Options &)
Definition: psimrcc/main.cc:86
bool greater_than_or_equal
Definition: index.h:149
int nirreps
Definition: index.h:143
std::vector< int * > pIntVec
Definition: index.h:67
int ** get_element_irrep()
Definition: index.h:126
~CCIndex()
Definition: index.cc:61
Size_tVec first
Definition: index.h:153
int *** three_index_to_irrep
Definition: index.h:161
size_t ntuples
Definition: index.h:151
size_t *** get_three_index_to_tuple_rel_index()
Definition: index.h:121
int * one_index_to_irrep
Definition: index.h:159
short ** get_tuples()
Definition: index.h:88
int nelements
Definition: index.h:144
vecvecint mospi
Definition: index.h:146
Size_tVec & get_tuplespi()
Definition: index.h:99
size_t ** get_two_index_to_tuple_rel_index()
Definition: index.h:120
Size_tVec & get_last()
Definition: index.h:98
Definition: index.h:66
Definition: pointgrp.h:105
short ** tuples
Definition: index.h:152
CCIndex(std::string str)
Definition: index.cc:52
int get_tuple_irrep(short p, short q, short r)
Definition: index.h:115
size_t get_tuplespi(int i)
Definition: index.h:95
void make_zero_index()
Definition: index.cc:160
size_t *** three_index_to_tuple_rel_index
Definition: index.h:158
bool greater_than
Definition: index.h:150
vecvecint first_mos
Definition: index.h:147
void cleanup()
Definition: index.cc:137
vecvecint indices_to_pitzer
Definition: index.h:148
int get_tuple_irrep(short p, short q)
Definition: index.h:114
size_t get_first(int i)
Definition: index.h:92
int ** get_two_index_to_irrep()
Definition: index.h:123
void make_one_index()
Definition: index.cc:179
std::vector< size_t * > pSize_tVec
Definition: index.h:69
void init()
Definition: index.cc:66
int ** two_index_to_irrep
Definition: index.h:160
std::vector< std::vector< int > > vecvecint
Definition: index.h:60
std::string get_label()
Definition: index.h:85
void make_two_index()
Definition: index.cc:213
std::vector< size_t > Size_tVec
Definition: index.h:68
size_t * get_one_index_to_tuple_rel_index()
Definition: index.h:119
int * get_one_index_to_irrep()
Definition: index.h:122
size_t get_tuple_abs_index(short p, short q)
Definition: index.h:104
int get_nelements()
Definition: index.h:84
void print()
Definition: index.cc:420
size_t get_tuple_abs_index(short p, short q, short r)
Definition: index.h:105
Size_tVec last
Definition: index.h:154
int ** element_irrep
Definition: index.h:162
size_t get_tuple_rel_index(short p, short q)
Definition: index.h:109
int *** get_three_index_to_irrep()
Definition: index.h:124
size_t get_tuple_abs_index(short p)
Definition: index.h:103
size_t get_tuple_rel_index(short p, short q, short r)
Definition: index.h:110
Size_tVec tuplespi
Definition: index.h:155
size_t get_tuple_rel_index(short p)
Definition: index.h:108
size_t get_pairpi(int i)
Definition: index.h:94
short * get_tuple(int i)
Definition: index.h:89
int get_tuple_irrep(short p)
Definition: index.h:113
void make_three_index()
Definition: index.cc:321
std::string label
Definition: index.h:142
Size_tVec dimension
Definition: index.h:145
Size_tVec & get_pairpi()
Definition: index.h:96
size_t ** two_index_to_tuple_rel_index
Definition: index.h:157
vecvecint & get_indices_to_pitzer()
Definition: index.h:117