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 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 public:
73  // Class Constructor and Destructor
75  CCIndex(std::string str);
76  ~CCIndex();
77 
79  // Class Interface
81  // Print routines
82  void print();
83  // Get the numeber of tuples and the numeber of indices per tuple
84  int get_ntuples() {return(ntuples);}
85  int get_nelements() {return(nelements);}
86  std::string get_label() {return(label);}
87 
88  // Get the tuples
89  short** get_tuples() {return(tuples);}
90  short* get_tuple(int i) {return(tuples[i]);}
91 
92  // Get the tuples irrep structure
93  size_t get_first(int i) {return(first[i]);}
94  size_t get_last(int i) {return(last[i]);}
95  size_t get_pairpi(int i) {return(tuplespi[i]);}
96  size_t get_tuplespi(int i) {return(tuplespi[i]);}
98  Size_tVec& get_first() {return(first);}
99  Size_tVec& get_last() {return(last);}
101 
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) {return(first[two_index_to_irrep[p][q]] + two_index_to_tuple_rel_index[p][q]);}
106  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]);}
107 
108  // Given a set of number retrieve the corresponding tuple index relative to the tuple's irrep
109  size_t get_tuple_rel_index(short p) {return(one_index_to_tuple_rel_index[p]);}
110  size_t get_tuple_rel_index(short p, short q) {return(two_index_to_tuple_rel_index[p][q]);}
111  size_t get_tuple_rel_index(short p, short q, short r) {return(three_index_to_tuple_rel_index[p][q][r]);}
112 
113  // Given a set of number retrieve the corresponding tuple irrep
114  int get_tuple_irrep(short p) {return(one_index_to_irrep[p]);}
115  int get_tuple_irrep(short p, short q) {return(two_index_to_irrep[p][q]);}
116  int get_tuple_irrep(short p, short q, short r) {return(three_index_to_irrep[p][q][r]);}
117 
119 
126 
127  int** get_element_irrep() {return(element_irrep);}
128 
129 private:
131  // Class private functions
133  void init();
134  void cleanup();
135  void make_zero_index();
136  void make_one_index();
137  void make_two_index();
138  void make_three_index();
140  // Class data
142  // Type // Name
143  std::string label; // The label of this object
144  int nirreps; // The number of irreps
145  int nelements; // Number of elements
146  Size_tVec dimension; // Size of the elements space
147  vecvecint mospi; // Size of each irrep of the elements space
148  vecvecint first_mos; // Last mo of each irrep of the elements space
149  vecvecint indices_to_pitzer; // Mapping from the mos of this space to Pitzer
150  bool greater_than_or_equal; // >= tuples
151  bool greater_than; // > tuples
152  size_t ntuples; // Number of tuples
153  short** tuples; // The tuples ordered as matrix : tuples[number][element]
154  Size_tVec first; // First pair of irrep
155  Size_tVec last; // Last pair of irrep
156  Size_tVec tuplespi; // Number of tuples for irrep
157  size_t* one_index_to_tuple_rel_index; // 1->tuple mapping array
158  size_t** two_index_to_tuple_rel_index; // 2->tuple mapping array
159  size_t*** three_index_to_tuple_rel_index; // 3->tuple mapping array
160  int* one_index_to_irrep; // 1->irrep mapping array
161  int** two_index_to_irrep; // 2->irrep mapping array
162  int*** three_index_to_irrep; // 3->irrep mapping array
163  int** element_irrep; // Irrep of each element
164 };
165 
166 }} /* End Namespaces */
167 
168 #endif // _psi_src_bin_psimrcc_ccindex_h
Size_tVec & get_first()
Definition: index.h:98
size_t * one_index_to_tuple_rel_index
Definition: index.h:157
int get_ntuples()
Definition: index.h:84
size_t get_last(int i)
Definition: index.h:94
PsiReturnType psimrcc(SharedWavefunction, Options &)
Definition: psimrcc/main.cc:87
bool greater_than_or_equal
Definition: index.h:150
int nirreps
Definition: index.h:144
std::vector< int * > pIntVec
Definition: index.h:68
int ** get_element_irrep()
Definition: index.h:127
~CCIndex()
Definition: index.cc:62
Size_tVec first
Definition: index.h:154
int *** three_index_to_irrep
Definition: index.h:162
size_t ntuples
Definition: index.h:152
size_t *** get_three_index_to_tuple_rel_index()
Definition: index.h:122
int * one_index_to_irrep
Definition: index.h:160
short ** get_tuples()
Definition: index.h:89
int nelements
Definition: index.h:145
vecvecint mospi
Definition: index.h:147
Size_tVec & get_tuplespi()
Definition: index.h:100
size_t ** get_two_index_to_tuple_rel_index()
Definition: index.h:121
Size_tVec & get_last()
Definition: index.h:99
Definition: index.h:67
Definition: pointgrp.h:106
short ** tuples
Definition: index.h:153
CCIndex(std::string str)
Definition: index.cc:53
int get_tuple_irrep(short p, short q, short r)
Definition: index.h:116
size_t get_tuplespi(int i)
Definition: index.h:96
void make_zero_index()
Definition: index.cc:161
size_t *** three_index_to_tuple_rel_index
Definition: index.h:159
bool greater_than
Definition: index.h:151
vecvecint first_mos
Definition: index.h:148
void cleanup()
Definition: index.cc:138
vecvecint indices_to_pitzer
Definition: index.h:149
int get_tuple_irrep(short p, short q)
Definition: index.h:115
size_t get_first(int i)
Definition: index.h:93
int ** get_two_index_to_irrep()
Definition: index.h:124
void make_one_index()
Definition: index.cc:180
std::vector< size_t * > pSize_tVec
Definition: index.h:70
void init()
Definition: index.cc:67
int ** two_index_to_irrep
Definition: index.h:161
std::vector< std::vector< int > > vecvecint
Definition: index.h:61
std::string get_label()
Definition: index.h:86
void make_two_index()
Definition: index.cc:214
std::vector< size_t > Size_tVec
Definition: index.h:69
size_t * get_one_index_to_tuple_rel_index()
Definition: index.h:120
int * get_one_index_to_irrep()
Definition: index.h:123
size_t get_tuple_abs_index(short p, short q)
Definition: index.h:105
int get_nelements()
Definition: index.h:85
void print()
Definition: index.cc:421
size_t get_tuple_abs_index(short p, short q, short r)
Definition: index.h:106
Size_tVec last
Definition: index.h:155
int ** element_irrep
Definition: index.h:163
size_t get_tuple_rel_index(short p, short q)
Definition: index.h:110
int *** get_three_index_to_irrep()
Definition: index.h:125
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:111
Size_tVec tuplespi
Definition: index.h:156
size_t get_tuple_rel_index(short p)
Definition: index.h:109
size_t get_pairpi(int i)
Definition: index.h:95
short * get_tuple(int i)
Definition: index.h:90
int get_tuple_irrep(short p)
Definition: index.h:114
void make_three_index()
Definition: index.cc:322
std::string label
Definition: index.h:143
Size_tVec dimension
Definition: index.h:146
Size_tVec & get_pairpi()
Definition: index.h:97
size_t ** two_index_to_tuple_rel_index
Definition: index.h:158
vecvecint & get_indices_to_pitzer()
Definition: index.h:118