-
Notifications
You must be signed in to change notification settings - Fork 1
/
MPO_totalSpin.h
101 lines (73 loc) · 3.33 KB
/
MPO_totalSpin.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
inline void makeS2_MPO(MPO& H, params &p, double additiveFactor = 0, double multiFactor = 1 ){
// Inspired by http://itensor.org/support/641/to-measure-total-spin-angular-momentum-s-2-on-mps
// Represents a MPO of the total spin operator S^2
// Total spin is a vector sum of all local spin operators; S^2 = \sum_{ij} S_i^z S_j^z + 0.5 ( S_i^+ S_j^- + S_i^- S_j^+ )
// iTensor works with spin in units of 1/2 (ie. the eigenvalue of S_z is 1), so the Sz operators are multiplied by 2.
QN ind0 ( {"Sz", 0},{"Nf", 0} ),
indm ( {"Sz", -2},{"Nf", 0} ),
indp ( {"Sz", +2},{"Nf", 0} );
QN ind_so ( {"Nf", 0} );
//THIS DOES NOT WORK FOR SOME REASON :(
if (!p.problem->spin_conservation()) {
QN ind0 ( {"Nf", 0} ),
indm ( {"Nf", 0} ),
indp ( {"Nf", 0} );
}
std::vector<Index> links;
links.push_back( Index() );
if (p.problem->spin_conservation()){
for (auto i : range1(length(H)+1)){
links.push_back(Index( ind0, 3,
indm, 1,
indp, 1,
Out, "Link" ));
}
}
else {
for (auto i : range1(length(H)+1)){
links.push_back(Index( ind_so, 5,
Out, "Link" ));
}
}
{
int i = 1;
ITensor& W = H.ref(i);
Index right = links.at(i);
W = ITensor(right, p.sites.si(i), p.sites.siP(i) );
W += p.sites.op("Id", i) * setElt(right(1)) * multiFactor;
W += p.sites.op("S2", i) * setElt(right(2)) * multiFactor;
W += p.sites.op("Id", i) * setElt(right(2)) * additiveFactor * multiFactor;
W += p.sites.op("Sz", i) * setElt(right(3)) * 2. * multiFactor;
W += p.sites.op("S+", i) * setElt(right(4)) * multiFactor;
W += p.sites.op("S-", i) * setElt(right(5)) * multiFactor;
}
for (auto i : range1(2, length(H)-1)){
ITensor& W = H.ref(i);
Index left = dag( links.at(i-1) );
Index right = links.at(i);
W = ITensor(left, right, p.sites.si(i), p.sites.siP(i));
W += p.sites.op("S2",i) * setElt(left(1), right(2)) ;
W += p.sites.op("Sz",i) * setElt(left(1), right(3)) * 2.;
W += p.sites.op("S+",i) * setElt(left(1), right(4)) ;
W += p.sites.op("S-",i) * setElt(left(1), right(5)) ;
W += p.sites.op("Sz",i) * setElt(left(3), right(2));
W += p.sites.op("S-",i) * setElt(left(4), right(2));
W += p.sites.op("S+",i) * setElt(left(5), right(2));
W += p.sites.op("Id",i) * setElt(left(1), right(1));
W += p.sites.op("Id",i) * setElt(left(2), right(2));
W += p.sites.op("Id",i) * setElt(left(3), right(3));
W += p.sites.op("Id",i) * setElt(left(4), right(4));
W += p.sites.op("Id",i) * setElt(left(5), right(5));
}
{
int i = length(H);
ITensor& W = H.ref(i);
Index left = dag( links.at(i-1) );
W = ITensor(left, p.sites.si(i), p.sites.siP(i) );
W += p.sites.op("S2", i) * setElt(left(1));
W += p.sites.op("Id", i) * setElt(left(2));
W += p.sites.op("Sz", i) * setElt(left(3));
W += p.sites.op("S-", i) * setElt(left(4));
W += p.sites.op("S+", i) * setElt(left(5));
}
}