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