-
Notifications
You must be signed in to change notification settings - Fork 33
/
SpinQuantum.h
87 lines (68 loc) · 2.83 KB
/
SpinQuantum.h
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
80
81
82
83
84
85
86
/*
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
*/
#ifndef SPINQUANTUM_HEADER
#define SPINQUANTUM_HEADER
#include <iostream>
#include <stdio.h>
#include "Symmetry.h"
#include "IrrepSpace.h"
#include <vector>
#include <boost/serialization/serialization.hpp>
#include "SpinSpace.h"
#ifndef DEC
using namespace std;
#endif
namespace SpinAdapted{
/// @brief Quantum numbers in DMRG
///
/// SpinQuantum carries particle number, orbital symmetry (Abelian and non-Abelian)
/// and Spin (Sz or S2) labels. Arithmetic (addition, subtraction, comparison) of
/// quantum numbers is defined. For non-Abelian groups, addition of two quantum
/// numbers produces a set of quantum numbers (e.g. a Clebsch-Gordon series).
class SpinQuantum
{
private:
friend class boost::serialization::access;
template<class Archive> void serialize(Archive & ar, const unsigned int version)
{
ar & particleNumber & totalSpin & orbitalSymmetry;
}
public:
int particleNumber;
SpinSpace totalSpin;
IrrepSpace orbitalSymmetry;
SpinQuantum ();
SpinQuantum (const int p, const SpinSpace s, const SpinAdapted::IrrepSpace orbS);
SpinQuantum operator-() const;
/// \return Vector of (Sz type) quantum numbers with Sz=-S ... +S
vector<SpinQuantum> spinToNonSpin() const;
int insertionNum(const SpinQuantum& ql, const SpinQuantum& qr) const;
/// Adds quantum number (to self)
/// \return Clebsch-Gordon sum of quantum numbers (if non-Abelian)
/// or length-1 vector if Abelian.
vector<SpinQuantum> operator+ (const SpinQuantum& q) const;
vector<SpinQuantum> operator+ (const vector<SpinQuantum>& q) const;
vector<SpinQuantum> operator- (const SpinQuantum& q) const;
vector<SpinQuantum> operator- (const vector<SpinQuantum>& q) const;
bool operator== (const SpinQuantum q) const;
bool operator!= (const SpinQuantum q) const;
bool operator< (const SpinQuantum q) const;
/// \return True if particleNumber is odd..
friend bool IsFermion (const SpinQuantum q);
friend ostream& operator<< (ostream& os, const SpinQuantum q);
void Save (std::ofstream &ofs);
void Load (std::ifstream &ifs);
SpinAdapted::SpinSpace get_s() const {return totalSpin;}
int get_n() const {return particleNumber;}
SpinAdapted::IrrepSpace get_symm() const {return orbitalSymmetry;}
/// \return true if self is contained in (Clebsch-Gordon) sum, s1+s2.
bool allow(const SpinQuantum s1, const SpinQuantum s2) const;
static bool can_complement (SpinQuantum q);
vector<SpinQuantum> get_complement() const;
};
}
#endif