v2DM-DOCI  1.0
Irreps.cpp
Go to the documentation of this file.
1 /*
2  CheMPS2: a spin-adapted implementation of DMRG for ab initio quantum chemistry
3  Copyright (C) 2013, 2014 Sebastian Wouters
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 
20 #include <stdlib.h>
21 #include <iostream>
22 #include <string>
23 
24 #include "Irreps.h"
25 
26 using std::string;
27 using std::cout;
28 using std::endl;
29 
31 
32  isActivated = false;
33 
34 }
35 
36 CheMPS2::Irreps::Irreps(const int nGroup){
37 
38  if ((nGroup >= 0) && (nGroup <= 7)){
39  isActivated = true;
40  groupNumber = nGroup;
41  nIrreps = getNumberOfIrrepsPrivate(groupNumber);
42  } else {
43  isActivated = false;
44  }
45 
46 }
47 
49 
50 bool CheMPS2::Irreps::setGroup(const int nGroup){
51 
52  if ((nGroup >= 0) && (nGroup <= 7)){
53  isActivated = true;
54  groupNumber = nGroup;
55  nIrreps = getNumberOfIrrepsPrivate(groupNumber);
56  } else {
57  isActivated = false;
58  }
59 
60  return isActivated;
61 
62 }
63 
64 bool CheMPS2::Irreps::getIsActivated() const{ return isActivated; }
65 
66 int CheMPS2::Irreps::getGroupNumber() const{ return isActivated ? groupNumber : -1 ; }
67 
69 
70  return isActivated ? getGroupNamePrivate(groupNumber) : "error" ;
71 
72 }
73 
74 string CheMPS2::Irreps::getGroupName(const int nGroup){
75 
76  return ((nGroup>=0)&&(nGroup<=7)) ? getGroupNamePrivate(nGroup) : "error" ;
77 
78 }
79 
80 string CheMPS2::Irreps::getGroupNamePrivate(const int nGroup){
81 
82  if (nGroup==0) return "c1";
83  if (nGroup==1) return "ci";
84  if (nGroup==2) return "c2";
85  if (nGroup==3) return "cs";
86  if (nGroup==4) return "d2";
87  if (nGroup==5) return "c2v";
88  if (nGroup==6) return "c2h";
89  if (nGroup==7) return "d2h";
90  return "error";
91 
92 }
93 
95 
96  return isActivated ? nIrreps : -1 ;
97 
98 }
99 
101 
102  if (nGroup == 0) return 1;
103  if (nGroup <= 3) return 2;
104  if (nGroup <= 6) return 4;
105  return 8;
106 
107 }
108 
109 string CheMPS2::Irreps::getIrrepName(const int irrepNumber) const{
110 
111  if (!isActivated) return "error1";
112 
113  if ( (irrepNumber<0) || (irrepNumber >= nIrreps) ) return "error2";
114 
115  return getIrrepNamePrivate(groupNumber,irrepNumber);
116 
117 }
118 
119 string CheMPS2::Irreps::getIrrepNamePrivate(const int nGroup, const int nIrrep){
120 
121  if (nGroup == 0){
122  if (nIrrep == 0) return "A";
123  }
124 
125  if (nGroup == 1){
126  if (nIrrep == 0) return "Ag";
127  if (nIrrep == 1) return "Au";
128  }
129 
130  if (nGroup == 2){
131  if (nIrrep == 0) return "A";
132  if (nIrrep == 1) return "B";
133  }
134 
135  if (nGroup == 3){
136  if (nIrrep == 0) return "A'";
137  if (nIrrep == 1) return "A\"";
138  }
139 
140  if (nGroup == 4){
141  if (nIrrep == 0) return "A";
142  if (nIrrep == 1) return "B1";
143  if (nIrrep == 2) return "B2";
144  if (nIrrep == 3) return "B3";
145  }
146 
147  if (nGroup == 5){
148  if (nIrrep == 0) return "A1";
149  if (nIrrep == 1) return "A2";
150  if (nIrrep == 2) return "B1";
151  if (nIrrep == 3) return "B2";
152  }
153 
154  if (nGroup == 6){
155  if (nIrrep == 0) return "Ag";
156  if (nIrrep == 1) return "Bg";
157  if (nIrrep == 2) return "Au";
158  if (nIrrep == 3) return "Bu";
159  }
160 
161  if (nGroup == 7){
162  if (nIrrep == 0) return "Ag";
163  if (nIrrep == 1) return "B1g";
164  if (nIrrep == 2) return "B2g";
165  if (nIrrep == 3) return "B3g";
166  if (nIrrep == 4) return "Au";
167  if (nIrrep == 5) return "B1u";
168  if (nIrrep == 6) return "B2u";
169  if (nIrrep == 7) return "B3u";
170  }
171 
172  return "error2";
173 
174 }
175 
177 
178  for (int thegroup=0; thegroup<8; thegroup++){
179  cout << "######################################################" << endl;
180  cout << "Name = " << getGroupNamePrivate(thegroup) << endl;
181  cout << "nIrreps = " << getNumberOfIrrepsPrivate(thegroup) << endl;
182  cout << "Multiplication table :" << endl;
183  for (int irrep1=-1; irrep1<getNumberOfIrrepsPrivate(thegroup); irrep1++){
184  for (int irrep2=-1; irrep2<getNumberOfIrrepsPrivate(thegroup); irrep2++){
185  if ((irrep1 == -1) && (irrep2 == -1)) cout << "\t";
186  if ((irrep1 == -1) && (irrep2 >= 0 )) cout << getIrrepNamePrivate(thegroup, irrep2) << "\t";
187  if ((irrep2 == -1) && (irrep1 >= 0 )) cout << getIrrepNamePrivate(thegroup, irrep1) << "\t";
188  if ((irrep2 >= 0) && (irrep1 >= 0 )) cout << getIrrepNamePrivate(thegroup, directProd(irrep1, irrep2)) << "\t";
189  }
190  cout << endl;
191  }
192  }
193  cout << "######################################################" << endl;
194 
195 }
196 
197 
bool setGroup(const int nGroup)
Set the group.
Definition: Irreps.cpp:50
int getNumberOfIrreps() const
Get the number of irreps for the currently activated group.
Definition: Irreps.cpp:94
static void printAll()
Print all info contained in this class.
Definition: Irreps.cpp:176
int getGroupNumber() const
Get the group number.
Definition: Irreps.cpp:66
static int getNumberOfIrrepsPrivate(const int nGroup)
Definition: Irreps.cpp:100
bool getIsActivated() const
Whether the group number is already activated.
Definition: Irreps.cpp:64
string getGroupName() const
Get the name of the group.
Definition: Irreps.cpp:68
static string getGroupNamePrivate(const int nGroup)
Definition: Irreps.cpp:80
virtual ~Irreps()
Destructor.
Definition: Irreps.cpp:48
Irreps()
Constructor.
Definition: Irreps.cpp:30
static string getIrrepNamePrivate(const int nGroup, const int nIrrep)
Definition: Irreps.cpp:119
bool isActivated
Definition: Irreps.h:125
string getIrrepName(const int irrepNumber) const
Get the name of the irrep with number irrepNumber of the activated group. The irrep with number 0 is ...
Definition: Irreps.cpp:109