forked from naokin/Block
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIrrepSpace.C
79 lines (64 loc) · 1.95 KB
/
IrrepSpace.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
Developed by Sandeep Sharma and Garnet K.-L. Chan, 2012
Copyright (c) 2012, Garnet K.-L. Chan
This program is integrated in Molpro with the permission of
Sandeep Sharma and Garnet K.-L. Chan
*/
#include "IrrepSpace.h"
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>
namespace SpinAdapted{
std::vector<IrrepSpace> IrrepSpace::operator+=(IrrepSpace rhs)
{
std::vector<int> irreps = Symmetry::add(irrep, rhs.irrep);
std::vector<IrrepSpace> vec;
for (int i=0; i<irreps.size(); i++) {
vec.push_back(IrrepSpace(irreps[i]));
}
return vec;
}
bool IrrepSpace::operator==(IrrepSpace rhs) const
{
return irrep == rhs.irrep;
}
bool IrrepSpace::operator!=(IrrepSpace rhs) const
{
return irrep != rhs.irrep;
}
std::vector<IrrepSpace> operator+(IrrepSpace lhs, IrrepSpace rhs)
{
return lhs+=rhs;
}
void IrrepSpace::Save(std::ofstream &ofs)
{
boost::archive::binary_oarchive save_sym(ofs);
save_sym << *this;
}
void IrrepSpace::Load (std::ifstream &ifs)
{
boost::archive::binary_iarchive load_sym(ifs);
load_sym >> *this;
}
ostream& operator<< (ostream& os, const IrrepSpace s)
{
if (sym == "dinfh") {
char goru = s.irrep%2 == 0 ? 'g' : 'u';
os<< max(0,(s.irrep-2)/2)<<goru;
if (s.irrep <2) os<< '+';
else if (s.irrep >=2 && s.irrep <4 ) os<< '-';
}
else if (sym == "trans") {
std::vector<int> irreps = Symmetry::decompress(s.irrep);
os<<irreps[2]<<irreps[1]<<irreps[0];
}
else {
os<< s.irrep+1;
}
return os;
}
bool IrrepSpace::operator< (const IrrepSpace s) const
{
return irrep<s.irrep;
}
int IrrepSpace::getirrep() const {return irrep;}
}