-
Notifications
You must be signed in to change notification settings - Fork 12
/
IrrepSpace.C
72 lines (57 loc) · 1.75 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
/*
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;
}
IrrepSpace operator-(const IrrepSpace lhs)
{
int outirrep = Symmetry::negativeof(lhs.irrep);
return IrrepSpace(outirrep);
}
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)
{
os << Symmetry::stringOfIrrep(s.irrep);
return os;
}
bool IrrepSpace::operator< (const IrrepSpace s) const
{
return irrep<s.irrep;
}
int IrrepSpace::getirrep() const {return irrep;}
}