VMPS++
Loading...
Searching...
No Matches
KondoObservables.h
Go to the documentation of this file.
1#ifndef KONDOOBSERVABLES
2#define KONDOOBSERVABLES
3
4#include "bases/FermionBase.h"
5#include "bases/SpinBase.h"
6#include "Mpo.h"
7#include "ParamHandler.h" // from TOOLS
8#include "Geometry2D.h" // from TOOLS
9
10template<typename Symmetry>
12{
14
15public:
16
19 KondoObservables (const size_t &L); // for inheritance purposes
20 KondoObservables (const size_t &L, const vector<Param> &params, const map<string,any> &defaults);
22
24 template<class Dummy = Symmetry>
25 typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry> >::type c (size_t locx, size_t locy=0, double factor=1.) const;
26
27 template<SPIN_INDEX sigma, class Dummy = Symmetry>
28 typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry> >::type c (size_t locx, size_t locy=0, double factor=1.) const;
29
30 template<class Dummy = Symmetry>
31 typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry>>::type cdag (size_t locx, size_t locy=0, double factor=std::sqrt(2.)) const;
32
33 template<SPIN_INDEX sigma, class Dummy = Symmetry>
34 typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry> >::type cdag (size_t locx, size_t locy=0, double factor=1.) const;
36
38 template<class Dummy = Symmetry>
39 typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry> >::type cc (size_t locx, size_t locy=0) const;
40 template<class Dummy = Symmetry>
41 typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry> >::type cdagcdag (size_t locx, size_t locy=0) const;
42
43 template<typename Dummy = Symmetry>
44 typename std::conditional<Dummy::IS_SPIN_SU2(),Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type cdagc (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const;
45
46 template<SPIN_INDEX sigma, typename Dummy = Symmetry>
47 typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry> >::type cdagc (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const;
48
49 // Mpo<Symmetry> triplet (size_t locx, size_t locy=0) const;
51
52 template<SPIN_INDEX sigma1, SPIN_INDEX sigma2, typename Dummy = Symmetry>
53 typename std::enable_if<Dummy::ABELIAN,Mpo<Symmetry> >::type cdagcdag (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const;
54
55 template<SPIN_INDEX sigma1, SPIN_INDEX sigma2, typename Dummy = Symmetry>
56 typename std::enable_if<Dummy::ABELIAN,Mpo<Symmetry> >::type cc (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const;
57
58 template<typename Dummy = Symmetry>
59 typename std::conditional<Dummy::IS_SPIN_SU2(),Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type
60 cc3 (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const;
61 template<typename Dummy = Symmetry>
62 typename std::conditional<Dummy::IS_SPIN_SU2(),Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type
63 cdagcdag3 (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const;
64
66 template<class Dummy = Symmetry>
67 typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry> >::type d (size_t locx, size_t locy=0) const;
68 template<class Dummy = Symmetry>
69 typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry> >::type dtot () const;
70 Mpo<Symmetry> ns (size_t locx, size_t locy=0) const;
71 Mpo<Symmetry> nh (size_t locx, size_t locy=0) const;
72 Mpo<Symmetry> nssq (size_t locx, size_t locy=0) const;
73 Mpo<Symmetry> nhsq (size_t locx, size_t locy=0) const;
74 template<class Dummy = Symmetry>
75 typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry> >::type s (size_t locx, size_t locy=0) const;
76
77 template<SPIN_INDEX sigma, typename Dummy = Symmetry>
78 typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry> >::type n (size_t locx, size_t locy=0) const;
79
80 Mpo<Symmetry> n (size_t locx, size_t locy=0) const;
81
82 template<SPIN_INDEX sigma1, SPIN_INDEX sigma2, typename Dummy = Symmetry>
83 typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry> >::type nn (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const;
84
85 Mpo<Symmetry> nn (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const;
86
87 template<typename Dummy = Symmetry>
88 typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry> >::type hh (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const;
90
92 template<typename Dummy = Symmetry>
93 typename std::enable_if<Dummy::IS_CHARGE_SU2(), Mpo<Symmetry> >::type T (size_t locx, size_t locy=0, double factor=1.) const;
94 template<typename Dummy = Symmetry>
95 typename std::enable_if<Dummy::IS_CHARGE_SU2(), Mpo<Symmetry> >::type Tdag (size_t locx, size_t locy=0, double factor=std::sqrt(3.)) const;
96 template<typename Dummy = Symmetry>
97 typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry> >::type Tp (size_t locx, size_t locy=0) const;
98 template<typename Dummy = Symmetry>
99 typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry> >::type Tm (size_t locx, size_t locy=0) const;
100 template<typename Dummy = Symmetry>
101 typename std::enable_if<Dummy::NO_CHARGE_SYM(), Mpo<Symmetry> >::type Tx (size_t locx, size_t locy=0) const;
102 template<typename Dummy = Symmetry>
103 typename std::enable_if<Dummy::NO_CHARGE_SYM(), Mpo<Symmetry> >::type iTy (size_t locx, size_t locy=0) const;
104 template<typename Dummy = Symmetry>
105 typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry> >::type Tz (size_t locx, size_t locy=0) const;
106 template<typename Dummy = Symmetry>
107 typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry> >::type TpTm (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0, double fac=1.) const;
108 template<typename Dummy = Symmetry>
109 typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry> >::type TmTp (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0, double fac=1.) const;
110 template<typename Dummy = Symmetry>
111 typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry> >::type TzTz (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const;
112 template<typename Dummy = Symmetry>
113 typename std::conditional<Dummy::IS_CHARGE_SU2(), Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type TdagT (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const;
115
117 template<typename Dummy = Symmetry>
118 typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type Simp (size_t locx, size_t locy=0, double factor=1.) const;
119 template<typename Dummy = Symmetry>
120 typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type Ssub (size_t locx, size_t locy=0, double factor=1.) const;
121 template<typename Dummy = Symmetry>
122 typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type Simpdag (size_t locx, size_t locy=0, double factor=std::sqrt(3.)) const;
123 template<typename Dummy = Symmetry>
124 typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type Simp (SPINOP_LABEL Sa, size_t locx, size_t locy=0, double factor=1.) const;
125 template<typename Dummy = Symmetry>
126 typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type Ssub (SPINOP_LABEL Sa, size_t locx, size_t locy=0, double factor=1.) const;
127
128 template<typename Dummy = Symmetry>
129 typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type S ( size_t locx, size_t locy=0, double factor=1.) const
130 {return Simp(locx,locy,factor);};
131
132 template<typename Dummy = Symmetry>
133 typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type Scomp (SPINOP_LABEL Sa, size_t locx, size_t locy=0, double factor=1.) const
134 {return Simp(SZ,locx,locy,factor);}
135
136 template<typename Dummy = Symmetry>
137 typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type Sz (size_t locx, size_t locy=0) const {return Simp(SZ,locx,locy,1.);}
138 template<typename Dummy = Symmetry>
139 typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type SimpSimp (SPINOP_LABEL Sa1, SPINOP_LABEL Sa2, size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0, double fac=1.) const;
140 template<typename Dummy = Symmetry>
141 typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type SsubSsub (SPINOP_LABEL Sa1, SPINOP_LABEL Sa2, size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0, double fac=1.) const;
142 template<typename Dummy = Symmetry>
143 typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type SimpSsub (SPINOP_LABEL Sa1, SPINOP_LABEL Sa2, size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0, double fac=1.) const;
144 template<typename Dummy = Symmetry>
145 typename std::conditional<Dummy::IS_SPIN_SU2(), Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type SimpSimp (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const;
146 template<typename Dummy = Symmetry>
147 typename std::conditional<Dummy::IS_SPIN_SU2(), Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type SsubSsub (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const;
148 template<typename Dummy = Symmetry>
149 typename std::conditional<Dummy::IS_SPIN_SU2(), Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type SimpSsub (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const;
150 template<typename Dummy = Symmetry>
151 typename std::conditional<Dummy::IS_SPIN_SU2(), Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type SdagS (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const {return SimpSimp(locx1,locx2,locy1,locy2);}
152 template<typename Dummy = Symmetry>
153 typename std::conditional<Dummy::IS_SPIN_SU2(), Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type SimpdagSimp (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const {return SimpSimp(locx1,locx2,locy1,locy2);}
154 template<typename Dummy = Symmetry>
155 typename std::conditional<Dummy::IS_SPIN_SU2(), Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type SsubdagSsub (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const {return SsubSsub(locx1,locx2,locy1,locy2);}
156 template<typename Dummy = Symmetry>
157 typename std::conditional<Dummy::IS_SPIN_SU2(), Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type SimpdagSsub (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const {return SimpSsub(locx1,locx2,locy1,locy2);}
158 // template<typename Dummy = Symmetry>
159 // typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry, complex<double> > >::type Rcomp (SPINOP_LABEL Sa, size_t locx, size_t locy=0) const;
161
162 template<typename Dummy = Symmetry>
163 typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry> >::type Stringz (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const;
164 template<typename Dummy = Symmetry>
165 typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry> >::type StringzDimer (size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const;
166
167 template<typename Dummy = Symmetry>
168 typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,complex<double> > >::type Simp_ky (vector<complex<double> > phases) const;
169 template<typename Dummy = Symmetry>
170 typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,complex<double> > >::type Simpdag_ky (vector<complex<double> > phases, double factor=sqrt(3.)) const;
171 template<typename Dummy = Symmetry>
172 typename std::enable_if<Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,complex<double> > >::type T_ky (vector<complex<double> > phases) const;
173 template<typename Dummy = Symmetry>
174 typename std::enable_if<Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,complex<double> > >::type Tdag_ky (vector<complex<double> > phases, double factor=sqrt(3.)) const;
175 template<typename Dummy = Symmetry>
176 typename std::enable_if<Dummy::IS_SPIN_SU2() and !Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,complex<double> > >::type c_ky (vector<complex<double> > phases, double factor=1.) const;
177 template<typename Dummy = Symmetry>
178 typename std::enable_if<Dummy::IS_SPIN_SU2() and !Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,complex<double> > >::type cdag_ky (vector<complex<double> > phases, double factor=sqrt(2.)) const;
179
181 Mpo<Symmetry> JordanWignerString() const;
183
185// Mpo<Symmetry> SimpSsubSimpSimp (size_t locx1, SPINOP_LABEL SOP1, size_t locx2, SPINOP_LABEL SOP2,
186// size_t loc3x, SPINOP_LABEL SOP3, size_t loc4x, SPINOP_LABEL SOP4,
187// size_t locy1=0, size_t locy2=0, size_t loc3y=0, size_t loc4y=0) const;
188// Mpo<Symmetry> SimpSsubSimpSsub (size_t locx1, SPINOP_LABEL SOP1, size_t locx2, SPINOP_LABEL SOP2,
189// size_t loc3x, SPINOP_LABEL SOP3, size_t loc4x, SPINOP_LABEL SOP4,
190// size_t locy1=0, size_t locy2=0, size_t loc3y=0, size_t loc4y=0) const;
192
193protected:
194
195 Mpo<Symmetry> make_local (KONDO_SUBSYSTEM SUBSYS, size_t locx, size_t locy,
196 const OperatorType &Op,
197 double factor =1.,
198 bool FERMIONIC=false, bool HERMITIAN=false) const;
199 Mpo<Symmetry> make_corr (KONDO_SUBSYSTEM SUBSYS, size_t locx1, size_t locx2, size_t locy1, size_t locy2,
200 const OperatorType &Op1, const OperatorType &Op2, qarray<Symmetry::Nq> Qtot,
201 double factor, bool FERMIONIC, bool HERMITIAN) const;
202
203 Mpo<Symmetry,complex<double> >
204 make_FourierYSum (KONDO_SUBSYSTEM SUBSYS, string name, const vector<OperatorType> &Ops, double factor, bool HERMITIAN, const vector<complex<double> > &phases) const;
205
206 typename Symmetry::qType getQ_ScompScomp(SPINOP_LABEL Sa1, SPINOP_LABEL Sa2) const;
207
208 vector<SpinBase <Symmetry> > B;
209 vector<FermionBase<Symmetry> > F;
210 vector<SUB_LATTICE> G;
211};
212
213template<typename Symmetry>
215KondoObservables (const size_t &L)
216{
217 F.resize(L);
218}
219
220template<typename Symmetry>
222KondoObservables (const size_t &L, const vector<Param> &params, const map<string,any> &defaults)
223{
224 ParamHandler P(params,defaults);
225 size_t Lcell = P.size();
226 B.resize(L); F.resize(L);
227
228 for (size_t l=0; l<L; ++l)
229 {
230 B[l] = SpinBase<Symmetry> (P.get<size_t>("Ly",l%Lcell), P.get<size_t>("D",l%Lcell), P.get<int>("mfactor",l%Lcell));
231 F[l] = FermionBase<Symmetry>(P.get<size_t>("Ly",l%Lcell),
232 P.get<bool>("REMOVE_DOUBLE",l%Lcell),
233 P.get<bool>("REMOVE_EMPTY",l%Lcell),
234 P.get<bool>("REMOVE_UP",l%Lcell),
235 P.get<bool>("REMOVE_DN",l%Lcell),
236 P.get<int>("mfactor",l%Lcell),
237 P.get<int>("k",l%Lcell));
238 }
239
240 G.resize(L);
241 if (P.HAS("G")) {G = P.get<vector<SUB_LATTICE> >("G");}
242 else // set default (-1)^l
243 {
244 G[0] = static_cast<SUB_LATTICE>(1);
245 for (int l=1; l<L; l+=1) G[l] = static_cast<SUB_LATTICE>(-1*G[l-1]);
246 }
247}
248
249//-------------
250
251template<typename Symmetry>
253make_local (KONDO_SUBSYSTEM SUBSYS, size_t locx, size_t locy, const OperatorType &Op, double factor, bool FERMIONIC, bool HERMITIAN) const
254{
255 assert(locx<F.size() and locy<F[locx].dim());
256 assert(SUBSYS != IMPSUB);
257 stringstream ss;
258 ss << Op.label() << "(" << locx << "," << locy;
259 if (factor != 1.) ss << ",factor=" << factor;
260 ss << ")";
261
262 Mpo<Symmetry> Mout(F.size(), Op.Q(), ss.str(), HERMITIAN);
263 for (size_t l=0; l<F.size(); ++l) {Mout.setLocBasis(B[l].get_basis().combine(F[l].get_basis()).qloc(),l);}
264
265 OperatorType OpExt, SignExt;
266
267 if (SUBSYS == SUB)
268 {
269 OpExt = kroneckerProduct(B[locx].Id(), Op);
270 }
271 else if (SUBSYS == IMP)
272 {
273 assert(!FERMIONIC and "Impurity cannot be fermionic!");
274 OpExt = kroneckerProduct(Op, F[locx].Id());
275 }
276
277 if (FERMIONIC)
278 {
279 vector<SiteOperator<Symmetry,double> > Signs(locx);
280 for (size_t l=0; l<locx; ++l) {Signs[l] = kroneckerProduct(B[l].Id(),F[l].sign()).template plain<double>();}
281
282 Mout.setLocal(locx, (factor * OpExt).template plain<double>(), Signs);
283 }
284 else
285 {
286 Mout.setLocal(locx, (factor * OpExt).template plain<double>());
287 }
288 return Mout;
289}
290
291template<typename Symmetry>
293make_corr (KONDO_SUBSYSTEM SUBSYS, size_t locx1, size_t locx2, size_t locy1, size_t locy2,
294 const OperatorType &Op1, const OperatorType &Op2, qarray<Symmetry::Nq> Qtot,
295 double factor, bool FERMIONIC, bool HERMITIAN) const
296{
297 assert(locx1<F.size() and locx2<F.size() and locy1<F[locx1].dim() and locy2<F[locx2].dim());
298 stringstream ss;
299 ss << Op1.label() << "(" << locx1 << "," << locy1 << ")"
300 << Op2.label() << "(" << locx2 << "," << locy2 << ")";
301
302 Mpo<Symmetry> Mout(F.size(), Qtot, ss.str(), HERMITIAN);
303 for (size_t l=0; l<F.size(); ++l) {Mout.setLocBasis(B[l].get_basis().combine(F[l].get_basis()).qloc(),l);}
304
305 OperatorType Op1Ext;
306 OperatorType Op2Ext;
307
308 if (SUBSYS == SUB)
309 {
310 Op1Ext = kroneckerProduct(B[locx1].Id(), Op1);
311 Op2Ext = kroneckerProduct(B[locx2].Id(), Op2);
312 }
313 else if (SUBSYS == IMP)
314 {
315 Op1Ext = kroneckerProduct(Op1, F[locx1].Id());
316 Op2Ext = kroneckerProduct(Op2, F[locx2].Id());
317 }
318 else if (SUBSYS == IMPSUB)
319 {
320 Op1Ext = kroneckerProduct(Op1, F[locx1].Id());
321 Op2Ext = kroneckerProduct(B[locx2].Id(), Op2);
322 }
323
324 if (FERMIONIC)
325 {
326 if (locx1 == locx2)
327 {
328 Mout.setLocal(locx1, factor * OperatorType::prod(Op1Ext,Op2Ext,Qtot).template plain<double>());
329 }
330 else if (locx1<locx2)
331 {
332 Mout.setLocal({locx1, locx2}, {(factor * (Op1Ext * kroneckerProduct(B[locx1].Id(),F[locx1].sign()))).template plain<double>(),
333 Op2Ext.template plain<double>()},
334 kroneckerProduct(B[0].Id(),F[0].sign()).template plain<double>());
335 }
336 else if (locx1>locx2)
337 {
338 Mout.setLocal({locx2, locx1}, {(factor * (Op2Ext * kroneckerProduct(B[locx2].Id(),F[locx2].sign()))).template plain<double>(),
339 -Symmetry::spinorFactor() * Op1Ext.template plain<double>()},
340 kroneckerProduct(B[0].Id(),F[0].sign()).template plain<double>());
341 }
342 }
343 else
344 {
345 if (locx1 == locx2)
346 {
347 auto product = factor*OperatorType::prod(Op1Ext, Op2Ext, Qtot);
348 Mout.setLocal(locx1, product.template plain<double>());
349 }
350 else
351 {
352 Mout.setLocal({locx1, locx2}, {(factor*Op1Ext).template plain<double>(), Op2Ext.template plain<double>()});
353 }
354 }
355 return Mout;
356}
357
358template<typename Symmetry>
360make_FourierYSum (KONDO_SUBSYSTEM SUBSYS, string name, const vector<OperatorType> &Ops,
361 double factor, bool HERMITIAN, const vector<complex<double> > &phases) const
362{
363 stringstream ss;
364 ss << name << "_ky(";
365 for (int l=0; l<phases.size(); ++l)
366 {
367 ss << phases[l];
368 if (l!=phases.size()-1) {ss << ",";}
369 else {ss << ")";}
370 }
371
372 // all Ops[l].Q() must match
373 Mpo<Symmetry,complex<double> > Mout(F.size(), Ops[0].Q(), ss.str(), HERMITIAN);
374 for (size_t l=0; l<F.size(); ++l) {Mout.setLocBasis(B[l].get_basis().combine(F[l].get_basis()).qloc(),l);}
375
376 vector<complex<double> > phases_x_factor = phases;
377 for (int l=0; l<phases.size(); ++l)
378 {
379 phases_x_factor[l] = phases[l] * factor;
380 }
381
382 vector<SiteOperator<Symmetry,complex<double> > > OpsPlain(Ops.size());
383 for (int l=0; l<OpsPlain.size(); ++l)
384 {
385 if (SUBSYS == SUB)
386 {
387 OpsPlain[l] = kroneckerProduct(B[l].Id(),Ops[l]).template plain<double>().template cast<complex<double> >();
388 }
389 else if (SUBSYS == IMP)
390 {
391 OpsPlain[l] = kroneckerProduct(Ops[l],F[l].Id()).template plain<double>().template cast<complex<double> >();
392 }
393 }
394
395 Mout.setLocalSum(OpsPlain, phases_x_factor);
396 return Mout;
397}
398
399template<typename Symmetry>
401JordanWignerString() const
402{
403 stringstream ss;
404 ss << "JordanWignerStringFull";
405
406 auto Id = kroneckerProduct(B[0].Id(),F[0].Id());
407
408 Mpo<Symmetry> Mout(F.size(), Symmetry::qvacuum(), ss.str());
409 for (size_t l=0; l<F.size(); ++l) {Mout.setLocBasis(B[l].get_basis().combine(F[l].get_basis()).qloc(),l);}
410
411 Mout.setLocal({0, F.size()-1}, {kroneckerProduct(B[0].Id(),F[0].sign()).template plain<double>(), kroneckerProduct(B[F.size()-1].Id(),F[F.size()-1].sign()).template plain<double>()},
412 kroneckerProduct(B[0].Id(),F[0].sign()).template plain<double>());
413
414 return Mout;
415}
416
417//-------------
418
419template<typename Symmetry>
420template<typename Dummy>
421typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry> >::type KondoObservables<Symmetry>::
422c (size_t locx, size_t locy, double factor) const
423{
424 if constexpr(Dummy::IS_CHARGE_SU2())
425 {
426 auto Gxy = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx+locy)));
427 return make_local(SUB,locx,locy, F[locx].c(Gxy,locy), factor, PROP::FERMIONIC);
428 }
429 else
430 {
431 return make_local(SUB,locx,locy, F[locx].c(locy), factor, PROP::FERMIONIC);
432 }
433}
434
435template<typename Symmetry>
436template<SPIN_INDEX sigma, typename Dummy>
437typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry> >::type KondoObservables<Symmetry>::
438c (size_t locx, size_t locy, double factor) const
439{
440 if constexpr(Dummy::IS_CHARGE_SU2())
441 {
442 auto Gxy = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx+locy)));
443 return make_local(SUB,locx,locy, F[locx].c(sigma,Gxy,locy), factor, PROP::FERMIONIC);
444 }
445 else
446 {
447 return make_local(SUB,locx,locy, F[locx].c(sigma,locy), factor, PROP::FERMIONIC);
448 }
449}
450
451// template<typename Symmetry>
452// template<SPIN_INDEX sigma, SUB_LATTICE G, typename Dummy>
453// typename std::enable_if<Dummy::IS_CHARGE_SU2() and !Dummy::IS_SPIN_SU2(),Mpo<Symmetry> >::type KondoObservables<Symmetry>::
454// c (size_t locx, size_t locy, double factor) const
455// {
456// return make_local(locx,locy, F[locx].c(sigma,G,locy), factor, PROP::FERMIONIC);
457// }
458
459// template<typename Symmetry>
460// template<SUB_LATTICE G, typename Dummy>
461// typename std::enable_if<Dummy::IS_CHARGE_SU2() and Dummy::IS_SPIN_SU2(),Mpo<Symmetry> >::type KondoObservables<Symmetry>::
462// c (size_t locx, size_t locy, double factor) const
463// {
464// return make_local(locx,locy, F[locx].c(G,locy), factor, PROP::FERMIONIC);
465// }
466
467template<typename Symmetry>
468template<typename Dummy>
469typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry> >::type KondoObservables<Symmetry>::
470cdag (size_t locx, size_t locy, double factor) const
471{
472 if constexpr(Dummy::IS_CHARGE_SU2())
473 {
474 auto Gxy = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx+locy)));
475 return make_local(SUB,locx,locy, F[locx].cdag(Gxy,locy), factor, PROP::FERMIONIC);
476 }
477 else
478 {
479 return make_local(SUB,locx,locy, F[locx].cdag(locy), factor, PROP::FERMIONIC);
480 }
481}
482
483template<typename Symmetry>
484template<SPIN_INDEX sigma, typename Dummy>
485typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry> >::type KondoObservables<Symmetry>::
486cdag (size_t locx, size_t locy, double factor) const
487{
488 if constexpr(Dummy::IS_CHARGE_SU2())
489 {
490 auto Gxy = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx+locy)));
491 return make_local(SUB,locx,locy, F[locx].cdag(sigma,Gxy,locy), factor, PROP::FERMIONIC);
492 }
493 else
494 {
495 return make_local(SUB,locx,locy, F[locx].cdag(sigma,locy), factor, PROP::FERMIONIC);
496 }
497}
498
499template<typename Symmetry>
500template<class Dummy>
501typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry> >::type KondoObservables<Symmetry>::
502cc (size_t locx, size_t locy) const
503{
504 return make_local(SUB,locx,locy, F[locx].cc(locy), 1., PROP::BOSONIC);
505}
506
507template<typename Symmetry>
508template<class Dummy>
509typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry> >::type KondoObservables<Symmetry>::
510cdagcdag (size_t locx, size_t locy) const
511{
512 return make_local(SUB,locx,locy, F[locx].cdagcdag(locy), 1., PROP::BOSONIC);
513}
514
515template<typename Symmetry>
516template<typename Dummy>
517typename std::conditional<Dummy::IS_SPIN_SU2(),Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type KondoObservables<Symmetry>::
518cdagc (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
519{
520 if constexpr (Dummy::IS_SPIN_SU2() and !Dummy::IS_CHARGE_SU2())
521 {
522 return make_corr(SUB,locx1, locx2, locy1, locy2, F[locx1].cdag(locy1), F[locx2].c(locy2), Symmetry::qvacuum(), sqrt(2.), PROP::FERMIONIC, PROP::NON_HERMITIAN);
523 }
524 else if constexpr (Dummy::IS_SPIN_SU2() and Dummy::IS_CHARGE_SU2())
525 {
526 auto Gx1y1 = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx1+locy1)));
527 auto Gx2y2 = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx2+locy2)));
528 return make_corr(SUB,locx1, locx2, locy1, locy2, F[locx1].cdag(Gx1y1,locy1), F[locx2].c(Gx2y2,locy2), Symmetry::qvacuum(), sqrt(2.)*sqrt(2.), PROP::FERMIONIC, PROP::NON_HERMITIAN);
529 }
530 else
531 {
532 vector<Mpo<Symmetry> > out(2);
533 out[0] = cdagc<UP>(locx1,locx2,locy1,locy2);
534 out[1] = cdagc<DN>(locx1,locx2,locy1,locy2);
535 return out;
536 }
537}
538
539template<typename Symmetry>
540template<SPIN_INDEX sigma, typename Dummy>
541typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry> >::type KondoObservables<Symmetry>::
542cdagc (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
543{
544 if constexpr (Dummy::ABELIAN)
545 {
546 return make_corr(SUB,locx1, locx2, locy1, locy2, F[locx1].cdag(sigma,locy1), F[locx2].c(sigma,locy2), Symmetry::qvacuum(), 1., PROP::FERMIONIC, PROP::NON_HERMITIAN);
547 }
548 else
549 {
550 auto Gx1y1 = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx1+locy1)));
551 auto Gx2y2 = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx2+locy2)));
552 return make_corr(SUB,locx1, locx2, locy1, locy2, F[locx1].cdag(sigma,Gx1y1,locy1), F[locx2].c(sigma,Gx2y2,locy2), Symmetry::qvacuum(), 1., PROP::FERMIONIC, PROP::NON_HERMITIAN);
553 }
554}
555
556template<typename Symmetry>
557template<SPIN_INDEX sigma1, SPIN_INDEX sigma2, typename Dummy>
558typename std::enable_if<Dummy::ABELIAN,Mpo<Symmetry> >::type KondoObservables<Symmetry>::
559cc (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
560{
561 return make_corr(SUB,locx1, locx2, locy1, locy2, F[locx1].c(sigma1,locy1), F[locx2].c(sigma2,locy2), Symmetry::qvacuum(), 1., PROP::FERMIONIC, PROP::NON_HERMITIAN);
562}
563
564template<typename Symmetry>
565template<SPIN_INDEX sigma1, SPIN_INDEX sigma2, typename Dummy>
566typename std::enable_if<Dummy::ABELIAN,Mpo<Symmetry> >::type KondoObservables<Symmetry>::
567cdagcdag (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
568{
569 return make_corr(SUB,locx1, locx2, locy1, locy2, F[locx1].cdag(sigma1,locy1), F[locx2].cdag(sigma2,locy2), Symmetry::qvacuum(), 1., PROP::FERMIONIC, PROP::NON_HERMITIAN);
570}
571
572template<typename Symmetry>
573template<typename Dummy>
574typename std::conditional<Dummy::IS_SPIN_SU2(),Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type KondoObservables<Symmetry>::
575cc3 (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
576{
577 if constexpr (Dummy::IS_SPIN_SU2())
578 {
579 //Determine Qtot to the spin triplet quantumnumber.
580 auto Qtots = Symmetry::reduceSilent(F[locx1].c(locy1).Q(), F[locx2].c(locy2).Q());
581 typename Symmetry::qType Qtot;
582 for (const auto Q : Qtots) {if (Q[0] == 3) {Qtot = Q;}}
583 return make_corr(SUB,locx1, locx2, locy1, locy2, F[locx1].c(locy1), F[locx2].c(locy2), Qtot, sqrt(2.), PROP::FERMIONIC, PROP::NON_HERMITIAN);
584 }
585 else
586 {
587 static_assert(!Dummy::IS_CHARGE_SU2(),"cc with a spin-triplet coupling cannot be computed for a charge SU2 symmetry. Use U1 charge symmetry instead.");
588 vector<Mpo<Symmetry> > out(2);
589 out[0] = cc<UP,DN>(locx1,locx2,locy1,locy2);
590 out[1] = cc<DN,UP>(locx1,locx2,locy1,locy2);
591 return out;
592 }
593}
594
595template<typename Symmetry>
596template<typename Dummy>
597typename std::conditional<Dummy::IS_SPIN_SU2(),Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type KondoObservables<Symmetry>::
598cdagcdag3 (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
599{
600 if constexpr (Dummy::IS_SPIN_SU2())
601 {
602 //Determine Qtot to the spin triplet quantumnumber.
603 auto Qtots = Symmetry::reduceSilent(F[locx1].cdag(locy1).Q(), F[locx2].cdag(locy2).Q());
604 typename Symmetry::qType Qtot;
605 for (const auto Q : Qtots) {if (Q[0] == 3) {Qtot = Q;}}
606 return make_corr(SUB,locx1, locx2, locy1, locy2, F[locx1].cdag(locy1), F[locx2].cdag(locy2), Qtot, sqrt(2.), PROP::FERMIONIC, PROP::NON_HERMITIAN);
607 }
608 else
609 {
610 static_assert(!Dummy::IS_CHARGE_SU2(),"cc with a spin-triplet coupling cannot be computed for a charge SU2 symmetry. Use U1 charge symmetry instead.");
611 vector<Mpo<Symmetry> > out(2);
612 out[0] = cdagcdag<UP,DN>(locx1,locx2,locy1,locy2);
613 out[1] = cdagcdag<DN,UP>(locx1,locx2,locy1,locy2);
614 return out;
615 }
616}
617
618template<typename Symmetry>
619template<typename Dummy>
620typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry> >::type KondoObservables<Symmetry>::
621Stringz (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
622{
623 assert(locx1<F.size() and locx2<F.size());
624 stringstream ss;
625 ss << "Sz" << "(" << locx1 << "," << locy1 << "," << ")"
626 << "Sz" << "(" << locx2 << "," << locy2 << "," << ")";
627
628 auto Sz1 = kroneckerProduct(B[locx1].Id(),F[locx1].Sz(locy1)).template plain<double>();
629 auto Sz2 = kroneckerProduct(B[locx2].Id(),F[locx2].Sz(locy2)).template plain<double>();
630
631 Mpo<Symmetry> Mout(F.size(), Sz1.Q()+Sz2.Q(), ss.str());
632 for (size_t l=0; l<F.size(); ++l) {Mout.setLocBasis(B[l].get_basis().combine(F[l].get_basis()).qloc(),l);}
633
634 if (locx1 == locx2)
635 {
636 Mout.setLocal(locx1, Sz1*Sz2);
637 }
638 else if (locx1<locx2)
639 {
640 Mout.setLocal({locx1,locx2}, {Sz1,Sz2}, kroneckerProduct(B[locx1].Id(),F[0].nh()-F[0].ns()).template plain<double>());
641// Mout.setLocal({locx1,locx2}, {F[0].Id(),F[0].Id()}, F[0].nh()-F[0].ns());
642 }
643 else if (locx1>locx2)
644 {
645 throw;
646// Mout.setLocal({locx2, locx1}, {c*F[locx2].sign(), -1.*cdag}, F[0].sign());
647 }
648
649 return Mout;
650}
651
652template<typename Symmetry>
653template<typename Dummy>
654typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry> >::type KondoObservables<Symmetry>::
655StringzDimer (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
656{
657 assert(locx1<F.size() and locx2<F.size());
658 stringstream ss;
659 ss << "Sz" << "(" << locx1 << "," << locy1 << "," << ")"
660 << "Sz" << "(" << locx2 << "," << locy2 << "," << ")";
661
662 auto Sz1 = kroneckerProduct(B[locx1].Id(),F[locx1].Sz(locy1)).template plain<double>();
663 auto Sz2 = kroneckerProduct(B[locx2].Id(),F[locx2].Sz(locy2)).template plain<double>();
664
665 Mpo<Symmetry> Mout(F.size(), Sz1.Q()+Sz2.Q(), ss.str());
666 for (size_t l=0; l<F.size(); ++l) {Mout.setLocBasis(B[l].get_basis().combine(F[l].get_basis()).qloc(),l);}
667
668 if (locx1 == locx2)
669 {
670 throw;
671// Mout.setLocal(locx1, Sz1*Sz2);
672 }
673 else if (locx1<locx2)
674 {
675 Mout.setLocal({locx1,locx2}, {-pow(-4,(locx2-(locx1-1)-2)/2)*Sz1,Sz2}, kroneckerProduct(B[locx1].Id(),F[0].Sz()).template plain<double>());
676 }
677 else if (locx1>locx2)
678 {
679 throw;
680 }
681
682 return Mout;
683}
684
685//-------------
686
687template<typename Symmetry>
688template<class Dummy>
689typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry> >::type KondoObservables<Symmetry>::
690d (size_t locx, size_t locy) const
691{
692 return make_local(SUB,locx,locy, F[locx].d(locy), 1., PROP::BOSONIC, PROP::HERMITIAN);
693}
694
695template<typename Symmetry>
696template<class Dummy>
697typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry> >::type KondoObservables<Symmetry>::
698dtot() const
699{
700 for (size_t l=0; l<F.size(); ++l) {assert(F[l].orbitals()==1);}
701
702 OperatorType Op = F[0].d();
703
704 Mpo<Symmetry> Mout(F.size(), Op.Q, "double_occ_total", PROP::HERMITIAN);
705 for (size_t l=0; l<F.size(); ++l) {Mout.setLocBasis(B[l].get_basis().combine(F[l].get_basis()).qloc(),l);}
706
707 Mout.setLocalSum(kroneckerProduct(B[0].Id(),Op).template plain<double>());
708 return Mout;
709}
710
711template<typename Symmetry>
712template<class Dummy>
713typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry> >::type KondoObservables<Symmetry>::
714s (size_t locx, size_t locy) const
715{
716 return make_local(SUB,locx,locy, F[locx].n(locy)-2.*F[locx].d(locy), 1., PROP::BOSONIC, PROP::HERMITIAN);
717}
718
719template<typename Symmetry>
720template<SPIN_INDEX sigma, typename Dummy>
721typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry> >::type KondoObservables<Symmetry>::
722n (size_t locx, size_t locy) const
723{
724 return make_local(SUB,locx,locy, F[locx].n(sigma,locy), 1., PROP::BOSONIC, PROP::HERMITIAN);
725}
726
727template<typename Symmetry>
729n (size_t locx, size_t locy) const
730{
731 return make_local(SUB,locx,locy, F[locx].n(locy), 1., PROP::BOSONIC, PROP::HERMITIAN);
732}
733
734template<typename Symmetry>
735template<typename Dummy>
736typename std::enable_if<Dummy::IS_CHARGE_SU2(), Mpo<Symmetry> >::type KondoObservables<Symmetry>::
737T (size_t locx, size_t locy, double factor) const
738{
739 return make_local(SUB,locx,locy, F[locx].T(locy), factor, PROP::BOSONIC, PROP::NON_HERMITIAN);
740}
741
742template<typename Symmetry>
743template<typename Dummy>
744typename std::enable_if<Dummy::IS_CHARGE_SU2(), Mpo<Symmetry> >::type KondoObservables<Symmetry>::
745Tdag (size_t locx, size_t locy, double factor) const
746{
747 return make_local(SUB,locx,locy, F[locx].Tdag(locy), factor, PROP::BOSONIC, PROP::NON_HERMITIAN);
748}
749
750template<typename Symmetry>
751template<typename Dummy>
752typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry> >::type KondoObservables<Symmetry>::
753Tz (size_t locx, size_t locy) const
754{
755 return make_local(SUB,locx,locy, F[locx].Tz(locy), 1., PROP::BOSONIC, PROP::HERMITIAN);
756}
757
758template<typename Symmetry>
759template<typename Dummy>
760typename std::enable_if<Dummy::NO_CHARGE_SYM(), Mpo<Symmetry> >::type KondoObservables<Symmetry>::
761Tx (size_t locx, size_t locy) const
762{
763 auto G = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx+locy)));
764 return make_local(SUB,locx,locy, F[locx].Tx(locy,G), 1., PROP::BOSONIC, PROP::HERMITIAN);
765}
766
767template<typename Symmetry>
768template<typename Dummy>
769typename std::enable_if<Dummy::NO_CHARGE_SYM(), Mpo<Symmetry> >::type KondoObservables<Symmetry>::
770iTy (size_t locx, size_t locy) const
771{
772 auto G = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx+locy)));
773 return make_local(SUB,locx,locy, F[locx].iTy(locy,G), 1. , PROP::BOSONIC, PROP::HERMITIAN); //0.5*pow(-1,locx+locy)*(F[locx].cdagcdag(locy)-F[locx].cc(locy))
774}
775
776template<typename Symmetry>
777template<typename Dummy>
778typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry> >::type KondoObservables<Symmetry>::
779Tm (size_t locx, size_t locy) const
780{
781 auto G = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx+locy)));
782 return make_local(SUB,locx,locy, F[locx].Tm(locy,G), 1., PROP::BOSONIC, PROP::NON_HERMITIAN);
783}
784
785template<typename Symmetry>
786template<typename Dummy>
787typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry> >::type KondoObservables<Symmetry>::
788Tp (size_t locx, size_t locy) const
789{
790 auto G = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx+locy)));
791 return make_local(SUB,locx,locy, F[locx].Tp(locy,G), 1., PROP::BOSONIC, PROP::NON_HERMITIAN);
792}
793
794template<typename Symmetry>
795template<typename Dummy>
796typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry> >::type KondoObservables<Symmetry>::
797TpTm (size_t locx1, size_t locx2, size_t locy1, size_t locy2, double fac) const
798{
799 auto G1 = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx1+locy1)));
800 auto G2 = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx2+locy2)));
801 return make_corr(SUB,locx1,locx2,locy1,locy2, fac*F[locx1].Tp(locy1,G1), F[locx2].Tm(locy2,G2), Symmetry::qvacuum(), 1., PROP::NON_FERMIONIC, PROP::NON_HERMITIAN);
802}
803
804template<typename Symmetry>
805template<typename Dummy>
806typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry> >::type KondoObservables<Symmetry>::
807TmTp (size_t locx1, size_t locx2, size_t locy1, size_t locy2, double fac) const
808{
809 auto G1 = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx1+locy1)));
810 auto G2 = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx2+locy2)));
811 return make_corr(SUB,locx1,locx2,locy1,locy2, fac*F[locx1].Tm(locy1,G1), F[locx2].Tp(locy2,G2), Symmetry::qvacuum(), 1., PROP::NON_FERMIONIC, PROP::NON_HERMITIAN);
812}
813
814template<typename Symmetry>
815template<typename Dummy>
816typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry> >::type KondoObservables<Symmetry>::
817TzTz (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
818{
819 return make_corr(SUB,locx1,locx2,locy1,locy2, F[locx1].Tz(locy1), F[locx2].Tz(locy2), Symmetry::qvacuum(), 1., PROP::NON_FERMIONIC, PROP::HERMITIAN);
820}
821
822template<typename Symmetry>
823template<typename Dummy>
824typename std::conditional<Dummy::IS_CHARGE_SU2(), Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type KondoObservables<Symmetry>::
825TdagT (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
826{
827 if constexpr (Symmetry::IS_CHARGE_SU2())
828 {
829 return make_corr(SUB,locx1, locx2, locy1, locy2, F[locx1].Tdag(locy1), F[locx2].T(locy2), Symmetry::qvacuum(), sqrt(3.), PROP::BOSONIC, PROP::HERMITIAN);
830 // return make_corr("Tā€ ", "T", locx1, locx2, locy1, locy2, F[locx1].Tdag(locy1), F[locx2].T(locy2), Symmetry::qvacuum(), std::sqrt(3.), PROP::NON_FERMIONIC, PROP::HERMITIAN);
831 }
832 else
833 {
834 vector<Mpo<Symmetry> > out(3);
835 out[0] = TzTz(SUB,locx1,locx2,locy1,locy2);
836 out[1] = TpTm(SUB,locx1,locx2,locy1,locy2,0.5);
837 out[2] = TmTp(SUB,locx1,locx2,locy1,locy2,0.5);
838 return out;
839 }
840}
841
842template<typename Symmetry>
844ns (size_t locx, size_t locy) const
845{
846 return make_local(SUB,locx,locy, F[locx].ns(locy), 1., PROP::BOSONIC, PROP::HERMITIAN);
847}
848
849template<typename Symmetry>
851nh (size_t locx, size_t locy) const
852{
853 return make_local(SUB,locx,locy, F[locx].nh(locy), 1., PROP::BOSONIC, PROP::HERMITIAN);
854}
855
856template<typename Symmetry>
858nssq (size_t locx, size_t locy) const
859{
860 return make_local(SUB,locx,locy, F[locx].ns(locy) * F[locx].ns(locy), 1., PROP::BOSONIC, PROP::HERMITIAN);
861}
862
863template<typename Symmetry>
865nhsq (size_t locx, size_t locy) const
866{
867 return make_local(SUB,locx,locy, F[locx].nh(locy) * F[locx].nh(locy), 1., PROP::BOSONIC, PROP::HERMITIAN);
868}
869
870template<typename Symmetry>
871template<SPIN_INDEX sigma1, SPIN_INDEX sigma2, typename Dummy>
872typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry> >::type KondoObservables<Symmetry>::
873nn (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
874{
875 return make_corr (SUB,locx1, locx2, locy1, locy2, F[locx1].n(sigma1,locy1), F[locx2].n(sigma2,locy2), Symmetry::qvacuum(), 1., PROP::NON_FERMIONIC, PROP::HERMITIAN);
876}
877
878template<typename Symmetry>
880nn (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
881{
882 return make_corr (SUB,locx1, locx2, locy1, locy2, F[locx1].n(locy1), F[locx2].n(locy2), Symmetry::qvacuum(), 1., PROP::NON_FERMIONIC, PROP::HERMITIAN);
883}
884
885template<typename Symmetry>
886template<typename Dummy>
887typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry> >::type KondoObservables<Symmetry>::
888hh (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
889{
890 return make_corr(SUB,locx1,locx2,locy1,locy2,
891 F[locx1].d(locy1)-F[locx1].n(locy1)+F[locx1].Id(),
892 F[locx2].d(locy2)-F[locx2].n(locy2)+F[locx2].Id(),
893 Symmetry::qvacuum(), 1., PROP::NON_FERMIONIC, PROP::HERMITIAN);
894}
895
896template<typename Symmetry>
897template<typename Dummy>
898typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type KondoObservables<Symmetry>::
899Simp (SPINOP_LABEL Sa, size_t locx, size_t locy, double factor) const
900{
901 bool HERMITIAN = (Sa==SX or Sa==SZ)? true:false;
902 return make_local(IMP,locx,locy, B[locx].Scomp(Sa,locy), factor, PROP::BOSONIC, HERMITIAN);
903}
904
905template<typename Symmetry>
906template<typename Dummy>
907typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type KondoObservables<Symmetry>::
908Ssub (SPINOP_LABEL Sa, size_t locx, size_t locy, double factor) const
909{
910 bool HERMITIAN = (Sa==SX or Sa==SZ)? true:false;
911 return make_local(SUB,locx,locy, F[locx].Scomp(Sa,locy), factor, PROP::BOSONIC, HERMITIAN);
912}
913
914// template<typename Symmetry>
915// template<typename Dummy>
916// typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry,complex<double> > >::type KondoObservables<Symmetry>::
917// Rcomp (SPINOP_LABEL Sa, size_t locx, size_t locy) const
918// {
919// stringstream ss;
920// if (Sa==iSY)
921// {
922// ss << "exp[2Ļ€" << Sa << "(" << locx << "," << locy << ")]";
923// }
924// else
925// {
926// ss << "exp[2Ļ€i" << Sa << "(" << locx << "," << locy << ")]";
927// }
928
929// auto Op = F[locx].Rcomp(Sa,locy).template plain<complex<double> >();
930
931// Mpo<Symmetry,complex<double>> Mout(F.size(), Op.Q, ss.str(), false);
932// for (size_t l=0; l<F.size(); ++l) {Mout.setLocBasis(F[l].get_basis().qloc(),l);}
933
934// Mout.setLocal(locx, Op);
935
936// return Mout;
937// }
938
939template<typename Symmetry>
940template<typename Dummy>
941typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type KondoObservables<Symmetry>::
942SimpSimp (SPINOP_LABEL Sa1, SPINOP_LABEL Sa2, size_t locx1, size_t locx2, size_t locy1, size_t locy2, double fac) const
943{
944 return make_corr(IMP,locx1,locx2,locy1,locy2, B[locx1].Scomp(Sa1,locy1), B[locx2].Scomp(Sa2,locy2), getQ_ScompScomp(Sa1,Sa2), fac, PROP::NON_FERMIONIC, PROP::HERMITIAN);
945}
946
947template<typename Symmetry>
948template<typename Dummy>
949typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type KondoObservables<Symmetry>::
950SsubSsub (SPINOP_LABEL Sa1, SPINOP_LABEL Sa2, size_t locx1, size_t locx2, size_t locy1, size_t locy2, double fac) const
951{
952 return make_corr(IMP,locx1,locx2,locy1,locy2, F[locx1].Scomp(Sa1,locy1), F[locx2].Scomp(Sa2,locy2), getQ_ScompScomp(Sa1,Sa2), fac, PROP::NON_FERMIONIC, PROP::HERMITIAN);
953}
954
955template<typename Symmetry>
956template<typename Dummy>
957typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type KondoObservables<Symmetry>::
958SimpSsub (SPINOP_LABEL Sa1, SPINOP_LABEL Sa2, size_t locx1, size_t locx2, size_t locy1, size_t locy2, double fac) const
959{
960 return make_corr(IMPSUB,locx1,locx2,locy1,locy2, B[locx1].Scomp(Sa1,locy1), F[locx2].Scomp(Sa2,locy2), getQ_ScompScomp(Sa1,Sa2), fac, PROP::NON_FERMIONIC, PROP::HERMITIAN);
961}
962
963template<typename Symmetry>
964template<typename Dummy>
965typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type KondoObservables<Symmetry>::
966Simp (size_t locx, size_t locy, double factor) const
967{
968 return make_local(IMP,locx,locy, B[locx].S(locy), factor, PROP::BOSONIC, PROP::NON_HERMITIAN);
969}
970
971template<typename Symmetry>
972template<typename Dummy>
973typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type KondoObservables<Symmetry>::
974Ssub (size_t locx, size_t locy, double factor) const
975{
976 return make_local(SUB,locx,locy, F[locx].S(locy), factor, PROP::NON_FERMIONIC, PROP::NON_HERMITIAN);
977}
978
979template<typename Symmetry>
980template<typename Dummy>
981typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type KondoObservables<Symmetry>::
982Simpdag (size_t locx, size_t locy, double factor) const
983{
984 return make_local(IMP,locx,locy, F[locx].Sdag(locy), factor, PROP::BOSONIC, PROP::NON_HERMITIAN);
985}
986
987template<typename Symmetry>
988template<typename Dummy>
989typename std::conditional<Dummy::IS_SPIN_SU2(), Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type KondoObservables<Symmetry>::
990SimpSimp (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
991{
992 if constexpr (Symmetry::IS_SPIN_SU2())
993 {
994 return make_corr(IMP,locx1, locx2, locy1, locy2, B[locx1].Sdag(locy1), B[locx2].S(locy2), Symmetry::qvacuum(), sqrt(3.), PROP::BOSONIC, PROP::HERMITIAN);
995 // return make_corr("Tā€ ", "T", locx1, locx2, locy1, locy2, F[locx1].Tdag(locy1), F[locx2].T(locy2), Symmetry::qvacuum(), std::sqrt(3.), PROP::NON_FERMIONIC, PROP::HERMITIAN);
996 }
997 else
998 {
999 vector<Mpo<Symmetry> > out(3);
1000 out[0] = SimpSimp(SZ,SZ,locx1,locx2,locy1,locy2);
1001 out[1] = SimpSimp(SP,SM,locx1,locx2,locy1,locy2,0.5);
1002 out[2] = SimpSimp(SM,SP,locx1,locx2,locy1,locy2,0.5);
1003 return out;
1004 }
1005}
1006
1007template<typename Symmetry>
1008template<typename Dummy>
1009typename std::conditional<Dummy::IS_SPIN_SU2(), Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type KondoObservables<Symmetry>::
1010SsubSsub (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1011{
1012 if constexpr (Symmetry::IS_SPIN_SU2())
1013 {
1014 return make_corr(SUB,locx1, locx2, locy1, locy2, F[locx1].Sdag(locy1), F[locx2].S(locy2), Symmetry::qvacuum(), sqrt(3.), PROP::BOSONIC, PROP::HERMITIAN);
1015 // return make_corr("Tā€ ", "T", locx1, locx2, locy1, locy2, F[locx1].Tdag(locy1), F[locx2].T(locy2), Symmetry::qvacuum(), std::sqrt(3.), PROP::NON_FERMIONIC, PROP::HERMITIAN);
1016 }
1017 else
1018 {
1019 vector<Mpo<Symmetry> > out(3);
1020 out[0] = SsubSsub(SZ,SZ,locx1,locx2,locy1,locy2);
1021 out[1] = SsubSsub(SP,SM,locx1,locx2,locy1,locy2,0.5);
1022 out[2] = SsubSsub(SM,SP,locx1,locx2,locy1,locy2,0.5);
1023 return out;
1024 }
1025}
1026
1027template<typename Symmetry>
1028template<typename Dummy>
1029typename std::conditional<Dummy::IS_SPIN_SU2(), Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type KondoObservables<Symmetry>::
1030SimpSsub (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1031{
1032 if constexpr (Symmetry::IS_SPIN_SU2())
1033 {
1034 return make_corr(IMPSUB,locx1, locx2, locy1, locy2, B[locx1].Sdag(locy1), F[locx2].S(locy2), Symmetry::qvacuum(), sqrt(3.), PROP::BOSONIC, PROP::HERMITIAN);
1035 // return make_corr("Tā€ ", "T", locx1, locx2, locy1, locy2, F[locx1].Tdag(locy1), F[locx2].T(locy2), Symmetry::qvacuum(), std::sqrt(3.), PROP::NON_FERMIONIC, PROP::HERMITIAN);
1036 }
1037 else
1038 {
1039 vector<Mpo<Symmetry> > out(3);
1040 out[0] = SimpSsub(SZ,SZ,locx1,locx2,locy1,locy2);
1041 out[1] = SimpSsub(SP,SM,locx1,locx2,locy1,locy2,0.5);
1042 out[2] = SimpSsub(SM,SP,locx1,locx2,locy1,locy2,0.5);
1043 return out;
1044 }
1045}
1046
1047template<typename Symmetry>
1048template<typename Dummy>
1049typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,complex<double> > >::type KondoObservables<Symmetry>::
1050Simp_ky (vector<complex<double> > phases) const
1051{
1052 vector<OperatorType> Ops(F.size());
1053 for (size_t l=0; l<F.size(); ++l)
1054 {
1055 Ops[l] = F[l].S(0);
1056 }
1057 return make_FourierYSum(IMP,"S", Ops, 1., false, phases);
1058}
1059
1060template<typename Symmetry>
1061template<typename Dummy>
1062typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,complex<double> > >::type KondoObservables<Symmetry>::
1063Simpdag_ky (vector<complex<double> > phases, double factor) const
1064{
1065 vector<OperatorType> Ops(F.size());
1066 for (size_t l=0; l<F.size(); ++l)
1067 {
1068 Ops[l] = F[l].Sdag(0);
1069 }
1070 return make_FourierYSum(IMP,"Sā€ ", Ops, 1., false, phases);
1071}
1072
1073template<typename Symmetry>
1074template<typename Dummy>
1075typename std::enable_if<Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,complex<double> > >::type KondoObservables<Symmetry>::
1076T_ky (vector<complex<double> > phases) const
1077{
1078 vector<OperatorType> Ops(F.size());
1079 for (size_t l=0; l<F.size(); ++l)
1080 {
1081 Ops[l] = F[l].T(0);
1082 }
1083 return make_FourierYSum(SUB,"T", Ops, 1., false, phases);
1084}
1085
1086template<typename Symmetry>
1087template<typename Dummy>
1088typename std::enable_if<Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,complex<double> > >::type KondoObservables<Symmetry>::
1089Tdag_ky (vector<complex<double> > phases, double factor) const
1090{
1091 vector<OperatorType> Ops(F.size());
1092 for (size_t l=0; l<F.size(); ++l)
1093 {
1094 Ops[l] = F[l].Tdag(0);
1095 }
1096 return make_FourierYSum(SUB,"Tā€ ", Ops, 1., false, phases);
1097}
1098
1099template<typename Symmetry>
1100template<typename Dummy>
1101typename std::enable_if<Dummy::IS_SPIN_SU2() and !Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,complex<double> > >::type KondoObservables<Symmetry>::
1102c_ky (vector<complex<double> > phases, double factor) const
1103{
1104 vector<OperatorType> Ops(F.size());
1105 for (size_t l=0; l<F.size(); ++l)
1106 {
1107 Ops[l] = F[l].c(0);
1108 }
1109 return make_FourierYSum(SUB,"c", Ops, 1., false, phases);
1110}
1111
1112template<typename Symmetry>
1113template<typename Dummy>
1114typename std::enable_if<Dummy::IS_SPIN_SU2() and !Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,complex<double> > >::type KondoObservables<Symmetry>::
1115cdag_ky (vector<complex<double> > phases, double factor) const
1116{
1117 vector<OperatorType> Ops(F.size());
1118 for (size_t l=0; l<F.size(); ++l)
1119 {
1120 Ops[l] = F[l].cdag(0);
1121 }
1122 return make_FourierYSum(SUB,"cā€ ", Ops, 1., false, phases);
1123}
1124
1125template<typename Symmetry>
1127{
1128 typename Symmetry::qType out;
1129
1130 // if no spin symmetry:
1131 if (!Symmetry::IS_SPIN_SU2() and !Symmetry::IS_SPIN_U1())
1132 {
1133 out = Symmetry::qvacuum();
1134 }
1135 else
1136 {
1137 if ( (Sa1 == SZ and Sa2 == SZ) or (Sa1 == SP and Sa2 == SM) or (Sa1 == SM and Sa2 == SP) or (Sa1 == SX or Sa1 == iSY) )
1138 {
1139 out = Symmetry::qvacuum();
1140 }
1141 else
1142 {
1143 lout << "Sa1=" << Sa1 << ", Sa2=" << Sa2 << endl;
1144 assert(false and "Quantum number for the chosen ScompScomp is not computed. Add in KondoObservables::getQ_ScompScomp");
1145 }
1146 }
1147 return out;
1148}
1149
1150// template<typename Symmetry>
1151// template<SPIN_INDEX sigma>
1152// Mpo<Symmetry> KondoObservables<Symmetry>::
1153// c (size_t locx, size_t locy) const
1154// {
1155// stringstream ss;
1156// ss << "c" << sigma;
1157// return make_local(SUB, ss.str(), locx,locy, F[locx].c(sigma,locy), true);
1158// }
1159
1160// template<typename Symmetry>
1161// template<SPIN_INDEX sigma>
1162// Mpo<Symmetry> KondoObservables<Symmetry>::
1163// cdag (size_t locx, size_t locy) const
1164// {
1165// stringstream ss;
1166// ss << "cā€ " << sigma;
1167// return make_local(SUB, ss.str(), locx,locy, F[locx].cdag(sigma,locy), true);
1168// }
1169
1170// template<typename Symmetry>
1171// Mpo<Symmetry> KondoObservables<Symmetry>::
1172// n (size_t locx, size_t locy) const
1173// {
1174// return make_local(SUB, "n", locx,locy, F[locx].n(locy), false, true);
1175// }
1176
1177// template<typename Symmetry>
1178// template<SPIN_INDEX sigma>
1179// Mpo<Symmetry> KondoObservables<Symmetry>::
1180// n (size_t locx, size_t locy) const
1181// {
1182// return make_local(SUB, "n", locx,locy, F[locx].n(sigma,locy), false, true);
1183// // FERMIONIC=false, HERMITIAN=true
1184// }
1185
1186// template<typename Symmetry>
1187// Mpo<Symmetry> KondoObservables<Symmetry>::
1188// d (size_t locx, size_t locy) const
1189// {
1190// return make_local(SUB, "d", locx,locy, F[locx].d(locy), false, true);
1191// }
1192
1193// template<typename Symmetry>
1194// Mpo<Symmetry> KondoObservables<Symmetry>::
1195// cc (size_t locx, size_t locy) const
1196// {
1197// stringstream ss;
1198// ss << "c" << UP << "c" << DN;
1199// return make_local(SUB, ss.str(), locx,locy, F[locx].c(UP,locy)*F[locx].c(DN,locy), false, false);
1200// }
1201
1202// template<typename Symmetry>
1203// Mpo<Symmetry> KondoObservables<Symmetry>::
1204// cdagcdag (size_t locx, size_t locy) const
1205// {
1206// stringstream ss;
1207// ss << "cā€ " << DN << "cā€ " << UP;
1208// return make_local(SUB, ss.str(), locx,locy, F[locx].cdag(DN,locy)*F[locx].cdag(UP,locy), false, false);
1209// }
1210
1211// template<typename Symmetry>
1212// Mpo<Symmetry> KondoObservables<Symmetry>::
1213// nn (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1214// {
1215// return make_corr(SUB, "n","n", locx1,locx2,locy1,locy2, F[locx1].n(UPDN,locy1), F[locx2].n(UPDN,locy2));
1216// }
1217
1218// template<typename Symmetry>
1219// Mpo<Symmetry> KondoObservables<Symmetry>::
1220// Simp (SPINOP_LABEL Sa, size_t locx, size_t locy, double factor) const
1221// {
1222// stringstream ss;
1223// ss << Sa << "imp";
1224// bool HERMITIAN = (Sa==SX or Sa==SZ)? true:false;
1225// return make_local(IMP, ss.str(), locx, locy, factor * B[locx].Scomp(Sa,locy), false, HERMITIAN);
1226// }
1227
1228// template<typename Symmetry>
1229// Mpo<Symmetry> KondoObservables<Symmetry>::
1230// Ssub (SPINOP_LABEL Sa, size_t locx, size_t locy, double factor) const
1231// {
1232// stringstream ss;
1233// ss << Sa << "sub";
1234// bool HERMITIAN = (Sa==SX or Sa==SZ)? true:false;
1235// return make_local(SUB, ss.str(), locx,locy, factor * F[locx].Scomp(Sa,locy), false, HERMITIAN);
1236// }
1237
1238// template<typename Symmetry>
1239// Mpo<Symmetry> KondoObservables<Symmetry>::
1240// SimpSimp (SPINOP_LABEL SOP1, SPINOP_LABEL SOP2, size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1241// {
1242// stringstream ss1; ss1 << SOP1 << "imp";
1243// stringstream ss2; ss2 << SOP2 << "imp";
1244
1245// return make_corr(IMP, ss1.str(),ss2.str(), locx1,locx2,locy1,locy2, B[locx1].Scomp(SOP1,locy1), B[locx2].Scomp(SOP2,locy2));
1246// }
1247
1248// template<typename Symmetry>
1249// Mpo<Symmetry> KondoObservables<Symmetry>::
1250// SsubSsub (SPINOP_LABEL SOP1, SPINOP_LABEL SOP2, size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1251// {
1252// stringstream ss1; ss1 << SOP1 << "sub";
1253// stringstream ss2; ss2 << SOP2 << "sub";
1254
1255// return make_corr(SUB, ss1.str(),ss2.str(), locx1,locx2,locy1,locy2, F[locx1].Scomp(SOP1,locy1), F[locx2].Scomp(SOP2,locy2));
1256// }
1257
1258// template<typename Symmetry>
1259// Mpo<Symmetry> KondoObservables<Symmetry>::
1260// SimpSsub (SPINOP_LABEL SOP1, SPINOP_LABEL SOP2, size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1261// {
1262// stringstream ss1; ss1 << SOP1 << "imp";
1263// stringstream ss2; ss2 << SOP2 << "sub";
1264
1265// return make_corr(IMPSUB, ss1.str(),ss2.str(), locx1,locx2,locy1,locy2, B[locx1].Scomp(SOP1,locy1), F[locx2].Scomp(SOP2,locy2));
1266// }
1267
1268// template<typename Symmetry>
1269// template<typename MpsType>
1270// double KondoObservables<Symmetry>::
1271// SvecSvecAvgImpSub (const MpsType &Psi, size_t locx1, size_t locx2, size_t locy1, size_t locy2)
1272// {
1273// return isReal(avg(Psi,SimpSsub(SZ,SZ,locx1,locx2,locy1,locy2),Psi))+
1274// isReal(avg(Psi,SimpSsub(SP,SM,locx1,locx2,locy1,locy2),Psi));
1275// }
1276
1277// template<typename Symmetry>
1278// template<SPIN_INDEX sigma>
1279// Mpo<Symmetry> KondoObservables<Symmetry>::
1280// cdagc (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1281// {
1282// assert(locx1<F.size() and locx2<F.size() and locy1<F[locx1].dim() and locy2<F[locx2].dim());
1283// stringstream ss;
1284// ss << "cā€ " << sigma << "(" << locx1 << "," << locy1 << "," << ")"
1285// << "c " << sigma << "(" << locx2 << "," << locy2 << "," << ")";
1286
1287// auto cdag = kroneckerProduct(B[locx1].Id(),F[locx1].cdag(sigma,locy1));
1288// auto c = kroneckerProduct(B[locx2].Id(),F[locx2].c (sigma,locy2));
1289// auto sign = kroneckerProduct(B[0].Id(),F[0].sign());
1290
1291// Mpo<Symmetry> Mout(F.size(), cdag.Q+c.Q, ss.str());
1292// for (size_t l=0; l<F.size(); ++l) {Mout.setLocBasis(Symmetry::reduceSilent(B[l].get_basis(),F[l].get_basis()),l);}
1293
1294// if (locx1 == locx2)
1295// {
1296// Mout.setLocal(locx1, cdag*c);
1297// }
1298// else if (locx1<locx2)
1299// {
1300// Mout.setLocal({locx1, locx2}, {cdag*sign, c}, sign);
1301// }
1302// else if (locx1>locx2)
1303// {
1304// Mout.setLocal({locx2, locx1}, {c*sign, -1.*cdag}, sign);
1305// }
1306
1307// return Mout;
1308// }
1309
1310// Mpo<Sym::U1xU1<double> > KondoU1xU1::
1311// SimpSsubSimpSimp (size_t locx1, SPINOP_LABEL SOP1, size_t locx2, SPINOP_LABEL SOP2, size_t loc3x, SPINOP_LABEL SOP3, size_t loc4x, SPINOP_LABEL SOP4,
1312// size_t locy1, size_t locy2, size_t loc3y, size_t loc4y)
1313// {
1314// assert(locx1<this->F.size() and locx2<this->F.size() and loc3x<this->F.size() and loc4x<this->F.size());
1315// stringstream ss;
1316// ss << SOP1 << "(" << locx1 << "," << locy1 << ")" << SOP2 << "(" << locx2 << "," << locy2 << ")" <<
1317// SOP3 << "(" << loc3x << "," << loc3y << ")" << SOP4 << "(" << loc4x << "," << loc4y << ")";
1318// Mpo<Symmetry> Mout(this->F.size(), this->N_legs, locBasis(), {0,0}, KondoU1xU1::NMlabel, ss.str());
1319// Mout.setLocal({locx1, locx2, loc3x, loc4x},
1320// {kroneckerProduct(B.Scomp(SOP1,locy1),F.Id()),
1321// kroneckerProduct(B.Id(),F.Scomp(SOP2,locy2)),
1322// kroneckerProduct(B.Scomp(SOP3,loc3y),F.Id()),
1323// kroneckerProduct(B.Scomp(SOP4,loc4y),F.Id())});
1324// return Mout;
1325// }
1326
1327// Mpo<Sym::U1xU1<double> > KondoU1xU1::
1328// SimpSsubSimpSsub (size_t locx1, SPINOP_LABEL SOP1, size_t locx2, SPINOP_LABEL SOP2, size_t loc3x, SPINOP_LABEL SOP3, size_t loc4x, SPINOP_LABEL SOP4,
1329// size_t locy1, size_t locy2, size_t loc3y, size_t loc4y)
1330// {
1331// assert(locx1<this->F.size() and locx2<this->F.size() and loc3x<this->F.size() and loc4x<this->F.size());
1332// stringstream ss;
1333// ss << SOP1 << "(" << locx1 << "," << locy1 << ")" << SOP2 << "(" << locx2 << "," << locy2 << ")" <<
1334// SOP3 << "(" << loc3x << "," << loc3y << ")" << SOP4 << "(" << loc4x << "," << loc4y << ")";
1335// Mpo<Symmetry> Mout(this->F.size(), this->N_legs, locBasis(), {0,0}, KondoU1xU1::NMlabel, ss.str());
1336// SparseMatrixXd IdSub(F.dim(),F.dim()); IdSub.setIdentity();
1337// SparseMatrixXd IdImp(Mpo<Symmetry>::qloc[locx2].size()/F.dim(), Mpo<Symmetry>::qloc[locx2].size()/F.dim()); IdImp.setIdentity();
1338// Mout.setLocal({locx1, locx2, loc3x, loc4x},
1339// {kroneckerProduct(B.Scomp(SOP1,locy1),F.Id()),
1340// kroneckerProduct(B.Id(),F.Scomp(SOP2,locy2)),
1341// kroneckerProduct(B.Scomp(SOP3,loc3y),F.Id()),
1342// kroneckerProduct(B.Id(),F.Scomp(SOP4,loc4y))});
1343// return Mout;
1344// }
1345
1346#endif
SPINOP_LABEL
Definition: DmrgTypedefs.h:60
@ iSY
Definition: DmrgTypedefs.h:60
@ SZ
Definition: DmrgTypedefs.h:60
@ SP
Definition: DmrgTypedefs.h:60
@ SX
Definition: DmrgTypedefs.h:60
@ SM
Definition: DmrgTypedefs.h:60
KONDO_SUBSYSTEM
Definition: DmrgTypedefs.h:132
@ SUB
Definition: DmrgTypedefs.h:132
@ IMP
Definition: DmrgTypedefs.h:132
@ IMPSUB
Definition: DmrgTypedefs.h:132
SUB_LATTICE
Definition: DmrgTypedefs.h:130
SiteOperator< Symmetry, Scalar_ > kroneckerProduct(const SiteOperator< Symmetry, Scalar_ > &O1, const SiteOperator< Symmetry, Scalar_ > &O2)
Definition: SiteOperator.h:164
std::enable_if< Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type cdag(size_t locx, size_t locy=0, double factor=std::sqrt(2.)) const
std::enable_if< Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type c(size_t locx, size_t locy=0, double factor=1.) const
Mpo< Symmetry > ns(size_t locx, size_t locy=0) const
std::enable_if< Dummy::IS_SPIN_SU2() and!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, complex< double > > >::type cdag_ky(vector< complex< double > > phases, double factor=sqrt(2.)) const
std::conditional< Dummy::IS_SPIN_SU2(), Mpo< Symmetry >, vector< Mpo< Symmetry > > >::type cc3(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type SsubSsub(SPINOP_LABEL Sa1, SPINOP_LABEL Sa2, size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0, double fac=1.) const
std::conditional< Dummy::IS_CHARGE_SU2(), Mpo< Symmetry >, vector< Mpo< Symmetry > > >::type TdagT(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
Mpo< Symmetry, complex< double > > make_FourierYSum(KONDO_SUBSYSTEM SUBSYS, string name, const vector< OperatorType > &Ops, double factor, bool HERMITIAN, const vector< complex< double > > &phases) const
SiteOperatorQ< Symmetry, Eigen::MatrixXd > OperatorType
Mpo< Symmetry > nssq(size_t locx, size_t locy=0) const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry > >::type hh(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
Mpo< Symmetry > n(size_t locx, size_t locy=0) const
std::enable_if< Dummy::IS_SPIN_SU2() and!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, complex< double > > >::type c_ky(vector< complex< double > > phases, double factor=1.) const
std::enable_if< Dummy::ABELIAN, Mpo< Symmetry > >::type cdagcdag(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type Ssub(SPINOP_LABEL Sa, size_t locx, size_t locy=0, double factor=1.) const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry > >::type s(size_t locx, size_t locy=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type SimpSimp(SPINOP_LABEL Sa1, SPINOP_LABEL Sa2, size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0, double fac=1.) const
std::enable_if< Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type S(size_t locx, size_t locy=0, double factor=1.) const
vector< SpinBase< Symmetry > > B
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry > >::type Tm(size_t locx, size_t locy=0) const
std::enable_if< Dummy::IS_CHARGE_SU2(), Mpo< Symmetry > >::type Tdag(size_t locx, size_t locy=0, double factor=std::sqrt(3.)) const
Mpo< Symmetry > make_corr(KONDO_SUBSYSTEM SUBSYS, size_t locx1, size_t locx2, size_t locy1, size_t locy2, const OperatorType &Op1, const OperatorType &Op2, qarray< Symmetry::Nq > Qtot, double factor, bool FERMIONIC, bool HERMITIAN) const
KondoObservables(const size_t &L)
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry > >::type cc(size_t locx, size_t locy=0) const
std::conditional< Dummy::IS_SPIN_SU2(), Mpo< Symmetry >, vector< Mpo< Symmetry > > >::type SimpdagSimp(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::conditional< Dummy::IS_SPIN_SU2(), Mpo< Symmetry >, vector< Mpo< Symmetry > > >::type cdagc(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry > >::type TpTm(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0, double fac=1.) const
std::conditional< Dummy::IS_SPIN_SU2(), Mpo< Symmetry >, vector< Mpo< Symmetry > > >::type cdagcdag3(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type Stringz(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry > >::type d(size_t locx, size_t locy=0) const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry > >::type dtot() const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type Sz(size_t locx, size_t locy=0) const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry > >::type Tp(size_t locx, size_t locy=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type c(size_t locx, size_t locy=0, double factor=1.) const
std::conditional< Dummy::IS_SPIN_SU2(), Mpo< Symmetry >, vector< Mpo< Symmetry > > >::type SsubSsub(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
vector< FermionBase< Symmetry > > F
Mpo< Symmetry > nh(size_t locx, size_t locy=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type n(size_t locx, size_t locy=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type SimpSsub(SPINOP_LABEL Sa1, SPINOP_LABEL Sa2, size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0, double fac=1.) const
std::enable_if< Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, complex< double > > >::type Tdag_ky(vector< complex< double > > phases, double factor=sqrt(3.)) const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry > >::type cdagcdag(size_t locx, size_t locy=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type Simp(SPINOP_LABEL Sa, size_t locx, size_t locy=0, double factor=1.) const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry > >::type TmTp(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0, double fac=1.) const
std::enable_if< Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type Simpdag(size_t locx, size_t locy=0, double factor=std::sqrt(3.)) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type StringzDimer(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if< Dummy::NO_CHARGE_SYM(), Mpo< Symmetry > >::type iTy(size_t locx, size_t locy=0) const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry > >::type TzTz(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
KondoObservables(const size_t &L, const vector< Param > &params, const map< string, any > &defaults)
Mpo< Symmetry > nn(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry > >::type Tz(size_t locx, size_t locy=0) const
vector< SUB_LATTICE > G
std::enable_if< Dummy::NO_CHARGE_SYM(), Mpo< Symmetry > >::type Tx(size_t locx, size_t locy=0) const
std::enable_if< Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type Simp(size_t locx, size_t locy=0, double factor=1.) const
std::enable_if< Dummy::IS_CHARGE_SU2(), Mpo< Symmetry > >::type T(size_t locx, size_t locy=0, double factor=1.) const
std::conditional< Dummy::IS_SPIN_SU2(), Mpo< Symmetry >, vector< Mpo< Symmetry > > >::type SdagS(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if< Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type Ssub(size_t locx, size_t locy=0, double factor=1.) const
std::enable_if< Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, complex< double > > >::type T_ky(vector< complex< double > > phases) const
std::enable_if< Dummy::IS_SPIN_SU2(), Mpo< Symmetry, complex< double > > >::type Simpdag_ky(vector< complex< double > > phases, double factor=sqrt(3.)) const
std::conditional< Dummy::IS_SPIN_SU2(), Mpo< Symmetry >, vector< Mpo< Symmetry > > >::type SsubdagSsub(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::conditional< Dummy::IS_SPIN_SU2(), Mpo< Symmetry >, vector< Mpo< Symmetry > > >::type SimpSsub(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if< Dummy::ABELIAN, Mpo< Symmetry > >::type cc(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
Mpo< Symmetry > make_local(KONDO_SUBSYSTEM SUBSYS, size_t locx, size_t locy, const OperatorType &Op, double factor=1., bool FERMIONIC=false, bool HERMITIAN=false) const
not implemented
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type cdag(size_t locx, size_t locy=0, double factor=1.) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type cdagc(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type Scomp(SPINOP_LABEL Sa, size_t locx, size_t locy=0, double factor=1.) const
std::conditional< Dummy::IS_SPIN_SU2(), Mpo< Symmetry >, vector< Mpo< Symmetry > > >::type SimpdagSsub(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if< Dummy::IS_SPIN_SU2(), Mpo< Symmetry, complex< double > > >::type Simp_ky(vector< complex< double > > phases) const
Mpo< Symmetry > nhsq(size_t locx, size_t locy=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type nn(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
Symmetry::qType getQ_ScompScomp(SPINOP_LABEL Sa1, SPINOP_LABEL Sa2) const
Mpo< Symmetry > JordanWignerString() const
std::conditional< Dummy::IS_SPIN_SU2(), Mpo< Symmetry >, vector< Mpo< Symmetry > > >::type SimpSimp(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
void setLocBasis(const std::vector< std::vector< qType > > &q)
Definition: MpoTerms.h:715
Definition: Mpo.h:40
void setLocal(std::size_t loc, const OperatorType &op)
void setLocalSum(const OperatorType &op, Scalar(*f)(int)=localSumTrivial)
static SiteOperatorQ< Symmetry, MatrixType_ > prod(const SiteOperatorQ< Symmetry, MatrixType_ > &O1, const SiteOperatorQ< Symmetry, MatrixType_ > &O2, const qType &target)
std::string & label()
const bool FERMIONIC
Definition: DmrgTypedefs.h:496
const bool NON_FERMIONIC
Definition: DmrgTypedefs.h:497
const bool NON_HERMITIAN
Definition: DmrgTypedefs.h:493
const bool HERMITIAN
Definition: DmrgTypedefs.h:492
const bool BOSONIC
Definition: DmrgTypedefs.h:498
STL namespace.
Definition: qarray.h:26