-
Notifications
You must be signed in to change notification settings - Fork 1
/
SC_BathMPO_MiddleImp_TwoChannel.h
225 lines (181 loc) · 10.8 KB
/
SC_BathMPO_MiddleImp_TwoChannel.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
inline void Fill_SCBath_MPO_MiddleImp_TwoChannel(MPO& H, const double Eshift, const std::vector<double>& eps_,
const std::vector<double>& v_, const params &p)
{
Expects(odd(length(H)));
// QN objects are necessary to have abelian symmetries in MPS
// automatically find the correct values
QN qn0 = - div( p.sites.op( "Id", 1) ),
cupC = - div( p.sites.op( "Cdagup", 1) ),
cdnC = - div( p.sites.op( "Cdagdn", 1) ),
cupA = - div( p.sites.op( "Cup", 1) ),
cdnA = - div( p.sites.op( "Cdn", 1) );
//std::cout << "g1=" << p.sc1->g() << std::endl;
std::cout << "Ec1=" << p.sc1->Ec() << std::endl;
//std::cout << "g2=" << p.sc2->g() << std::endl;
std::cout << "Ec2=" << p.sc2->Ec() << std::endl;
std::vector<Index> links;
links.push_back( Index() );
//first we create the link indices which carry quantum number information
for(auto i : range1( p.impindex-1 )){
links.push_back(Index( qn0, 2,
cupC, 1,
cdnC, 1,
cupA, 1,
cdnA, 1,
cupA+cdnA, 1,
cupC+cdnC, 1,
qn0, 1, Out, "Link" ));
}
//first we create the link indices which carry quantum number information
for(auto i : range1( p.impindex, length(H)-1 )){
links.push_back(Index( qn0, 2,
cupA, 1,
cdnA, 1,
cupC, 1,
cdnC, 1,
cupA+cdnA, 1,
cupC+cdnC, 1,
qn0, 1, Out, "Link" ));
}
//then we just fill the MPO tensors which can be viewed
//as matrices (vectors) of operators. if one multiplies
//all matrices togehter one obtains the hamiltonian.
//therefore the tensor on the first and last site must be column/ row vectors
//and all sites between matrices
//first site is a vector:
{
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));
// local H on site
W += p.sites.op("Ntot",i) * setElt(right(2)) * (eps_[i] + p.sc1->Ec()*(1-2*p.sc1->n0())); // here use index i
W += p.sites.op("Nup",i) * setElt(right(2)) * p.sc1->EZ()/2.0;
W += p.sites.op("Ndn",i) * setElt(right(2)) * (-1) * p.sc1->EZ()/2.0;
W += p.sites.op("Nupdn",i) * setElt(right(2)) * (p.sc1->g() * pow(p.sc1->y(i), 2) + 2*p.sc1->Ec());
//hybridization
W += p.sites.op("Cdagup*F",i) * setElt(right(3))* (+v_[i]); // here use index i
W += p.sites.op("Cdagdn*F",i) * setElt(right(4))* (+v_[i]); // here use index i
W += p.sites.op("Cup*F", i) * setElt(right(5))* (-v_[i]); // here use index i
W += p.sites.op("Cdn*F", i) * setElt(right(6))* (-v_[i]); // here use index i
//SC pairing
W += p.sites.op("Cdn*Cup", i) * setElt(right(7)) * p.sc1->g() * p.sc1->y(i);
W += p.sites.op("Cdagup*Cdagdn", i) * setElt(right(8)) * p.sc1->g() * p.sc1->y(i);
W += p.sites.op("Ntot",i) * setElt(right(9)) * 2*p.sc1->Ec();
}
// sites 2 ... p.impindex-1 are matrices
for(auto i : range1(2, p.impindex-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("Id",i) * setElt(left(1), right(1));
// local H on site
W += p.sites.op("Ntot",i) * setElt(left(1),right(2)) * (eps_[i] + p.sc1->Ec()*(1-2*p.sc1->n0())); // here use index i
W += p.sites.op("Nup",i) * setElt(left(1),right(2)) * p.sc1->EZ()/2.0;
W += p.sites.op("Ndn",i) * setElt(left(1),right(2)) * (-1) * p.sc1->EZ()/2.0;
W += p.sites.op("Nupdn",i) * setElt(left(1),right(2)) * (p.sc1->g() * pow(p.sc1->y(i), 2) + 2*p.sc1->Ec());
// hybridizations
W += p.sites.op("Cdagup*F",i)*setElt(left(1),right(3))* (+v_[i] ); // here use index i
W += p.sites.op("Cdagdn*F",i)*setElt(left(1),right(4))* (+v_[i] ); // here use index i
W += p.sites.op("Cup*F", i)*setElt(left(1),right(5))* (-v_[i] ); // here use index i
W += p.sites.op("Cdn*F", i)*setElt(left(1),right(6))* (-v_[i] ); // here use index i
//SC pairing
W += p.sites.op("Cdn*Cup",i) * setElt(left(1),right(7)) * p.sc1->g() * p.sc1->y(i);
W += p.sites.op("Cdagup*Cdagdn",i) * setElt(left(1),right(8)) * p.sc1->g() * p.sc1->y(i);
W += p.sites.op("Ntot",i) * setElt(left(1),right(9)) * 2*p.sc1->Ec();
// keep terms
W += p.sites.op("Id",i)*setElt(left(2),right(2));
W += p.sites.op("F" ,i)*setElt(left(3),right(3));
W += p.sites.op("F" ,i)*setElt(left(4),right(4));
W += p.sites.op("F" ,i)*setElt(left(5),right(5));
W += p.sites.op("F" ,i)*setElt(left(6),right(6));
W += p.sites.op("Id",i)*setElt(left(7),right(7));
W += p.sites.op("Id",i)*setElt(left(8),right(8));
W += p.sites.op("Id",i)*setElt(left(9),right(9));
// add SC pairing terms
W += p.sites.op("Cdagup*Cdagdn",i)*setElt(left(7),right(2)) * p.sc1->y(i);
W += p.sites.op("Cdn*Cup",i) *setElt(left(8),right(2)) * p.sc1->y(i);
W += p.sites.op("Ntot",i) *setElt(left(9),right(2)); // !!!
}
// impurity
{
int i = p.impindex;
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("Id",i) * setElt(left(1), right(1));
W += p.sites.op("Ntot",i) * setElt(left(1), right(2)) * p.qd->eps(); //CHECK THIS
W += p.sites.op("Nup",i) * setElt(left(1), right(2)) * p.qd->EZ()/2.0;
W += p.sites.op("Ndn",i) * setElt(left(1), right(2)) * (-1) * p.qd->EZ()/2.0;
W += p.sites.op("Nupdn",i) * setElt(left(1), right(2)) * p.qd->U();
W += p.sites.op("Id",i) * setElt(left(1), right(2)) * Eshift;
// hybridizations
W += p.sites.op("Cup*F", i)*setElt(left(1),right(3)) * (-1);
W += p.sites.op("Cdn*F", i)*setElt(left(1),right(4)) * (-1);
W += p.sites.op("Cdagup*F", i)*setElt(left(1),right(5)) * (+1);
W += p.sites.op("Cdagdn*F", i)*setElt(left(1),right(6)) * (+1);
W += p.sites.op("Id",i) * setElt(left(2), right(2));
// hybridizations
W += p.sites.op("Cup", i)*setElt(left(3),right(2));
W += p.sites.op("Cdn", i)*setElt(left(4),right(2));
W += p.sites.op("Cdagup", i)*setElt(left(5),right(2));
W += p.sites.op("Cdagdn", i)*setElt(left(6),right(2));
//keep SC pairing
W += p.sites.op("Id",i) *setElt(left(7),right(7)) * p.SCSCinteraction; // THESE THREE TERMS COUPLE THE SC1 AND SC2 LEVELS
W += p.sites.op("Id",i) *setElt(left(8),right(8)) * p.SCSCinteraction;
W += p.sites.op("Id",i) *setElt(left(9),right(9)) * p.SCSCinteraction;
}
// sites p.impindex+1 ... N -1 are the same as before
int shift = (length(H)-1)/2; // number of matrices for one channel. i-shift is the index of the i-th level in the second channel.
for(auto i : range1(p.impindex+1, 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("Id",i) * setElt(left(1), right(1));
W += p.sites.op("Ntot",i) * setElt(left(1),right(2)) * (eps_[i-1] + p.sc2->Ec()*(1-2*p.sc2->n0())); // use index i-1
W += p.sites.op("Nup",i) * setElt(left(1),right(2)) * p.sc2->EZ()/2.0;
W += p.sites.op("Ndn",i) * setElt(left(1),right(2)) * (-1) * p.sc2->EZ()/2.0;
W += p.sites.op("Nupdn",i) * setElt(left(1),right(2)) * (p.sc2->g() * pow(p.sc2->y(i-1-shift), 2) + 2.0*p.sc2->Ec()); // MISSING 2.0 FIXED !!
W += p.sites.op("Cdn*Cup",i) * setElt(left(1),right(7)) * p.sc2->g() * p.sc2->y(i-1-shift);
W += p.sites.op("Cdagup*Cdagdn",i) * setElt(left(1),right(8)) * p.sc2->g() * p.sc2->y(i-1-shift);
W += p.sites.op("Ntot",i) * setElt(left(1),right(9)) * 2.0*p.sc2->Ec(); // MISSING 2.0 FIXED !!
W += p.sites.op("Id",i)*setElt(left(2),right(2));
W += p.sites.op("F" ,i)*setElt(left(3),right(3));
W += p.sites.op("F" ,i)*setElt(left(4),right(4));
W += p.sites.op("F" ,i)*setElt(left(5),right(5));
W += p.sites.op("F" ,i)*setElt(left(6),right(6));
W += p.sites.op("Id",i)*setElt(left(7),right(7));
W += p.sites.op("Id",i)*setElt(left(8),right(8));
W += p.sites.op("Id",i)*setElt(left(9),right(9));
W += p.sites.op("Cdagup",i)*setElt(left(3),right(2))* v_[i-1]; // use index i-1
W += p.sites.op("Cdagdn",i)*setElt(left(4),right(2))* v_[i-1]; // use index i-1
W += p.sites.op("Cup", i)*setElt(left(5),right(2))* v_[i-1]; // use index i-1
W += p.sites.op("Cdn", i)*setElt(left(6),right(2))* v_[i-1]; // use index i-1
W += p.sites.op("Cdagup*Cdagdn",i) * setElt(left(7),right(2)) * p.sc2->y(i-1-shift);
W += p.sites.op("Cdn*Cup",i) * setElt(left(8),right(2)) * p.sc2->y(i-1-shift);
W += p.sites.op("Ntot",i) * setElt(left(9),right(2));
}
//site N is a vector again - same as before
{
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("Ntot", i) * setElt(left(1)) * (eps_[i-1] + p.sc2->Ec()*(1-2*p.sc2->n0())); // use index i-1
W += p.sites.op("Nup", i) * setElt(left(1)) * p.sc2->EZ()/2.0;
W += p.sites.op("Ndn", i) * setElt(left(1)) * (-1) * p.sc2->EZ()/2.0;
W += p.sites.op("Nupdn",i) * setElt(left(1)) * (p.sc2->g() * pow(p.sc2->y(i-1-shift), 2) + 2*p.sc2->Ec());
W += p.sites.op("Id", i) * setElt(left(2)) ;
W += p.sites.op("Cdagup",i) * setElt(left(3)) * v_[i-1]; // use index i-1
W += p.sites.op("Cdagdn",i) * setElt(left(4)) * v_[i-1]; // use index i-1
W += p.sites.op("Cup", i) * setElt(left(5)) * v_[i-1]; // use index i-1
W += p.sites.op("Cdn", i) * setElt(left(6)) * v_[i-1]; // use index i-1
W += p.sites.op("Cdagup*Cdagdn",i) * setElt(left(7)) * p.sc2->y(i-1-shift);
W += p.sites.op("Cdn*Cup", i) * setElt(left(8)) * p.sc2->y(i-1-shift);
W += p.sites.op("Ntot", i) * setElt(left(9));
}
}