VMPS++
Loading...
Searching...
No Matches
KondoNecklaceObservables.h
Go to the documentation of this file.
1#ifndef KONDOONECKLACEBSERVABLES
2#define KONDOONECKLACEBSERVABLES
3
4#include "bases/SpinBase.h"
5#include "Mpo.h"
6#include "ParamHandler.h" // from TOOLS
7#include "Geometry2D.h" // from TOOLS
8
9template<typename Symmetry>
11{
13
14public:
15
18 KondoNecklaceObservables (const size_t &L); // for inheritance purposes
19 KondoNecklaceObservables (const size_t &L, const vector<Param> &params, const map<string,any> &defaults);
21
23 template<typename Dummy = Symmetry>
24 typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type Simp (size_t locx, size_t locy=0, double factor=1.) const;
25 template<typename Dummy = Symmetry>
26 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;
27 template<typename Dummy = Symmetry>
28 typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type Ssub (size_t locx, size_t locy=0, double factor=1.) const;
29 template<typename Dummy = Symmetry>
30 typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type Ssubdag (size_t locx, size_t locy=0, double factor=std::sqrt(3.)) const;
31 template<typename Dummy = Symmetry>
32 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;
33 template<typename Dummy = Symmetry>
34 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;
35
36 template<typename Dummy = Symmetry>
37 typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type S ( size_t locx, size_t locy=0, double factor=1.) const
38 {return Simp(locx,locy,factor);};
39
40 template<typename Dummy = Symmetry>
41 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
42 {return Simp(SZ,locx,locy,factor);}
43
44 template<typename Dummy = Symmetry>
45 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.);}
46 template<typename Dummy = Symmetry>
47 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;
48 template<typename Dummy = Symmetry>
49 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;
50 template<typename Dummy = Symmetry>
51 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;
52 template<typename Dummy = Symmetry>
53 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;
54 template<typename Dummy = Symmetry>
55 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;
56 template<typename Dummy = Symmetry>
57 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;
58 template<typename Dummy = Symmetry>
59 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 SimpdagSimp(locx1,locx2,locy1,locy2);}
60 // template<typename Dummy = Symmetry>
61 // 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;
63
64 template<typename Dummy = Symmetry>
65 typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,complex<double> > >::type Simp_ky (vector<complex<double> > phases) const;
66 template<typename Dummy = Symmetry>
67 typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,complex<double> > >::type Simpdag_ky (vector<complex<double> > phases, double factor=sqrt(3.)) const;
68
69
71// Mpo<Symmetry> SimpSsubSimpSimp (size_t locx1, SPINOP_LABEL SOP1, size_t locx2, SPINOP_LABEL SOP2,
72// size_t loc3x, SPINOP_LABEL SOP3, size_t loc4x, SPINOP_LABEL SOP4,
73// size_t locy1=0, size_t locy2=0, size_t loc3y=0, size_t loc4y=0) const;
74// Mpo<Symmetry> SimpSsubSimpSsub (size_t locx1, SPINOP_LABEL SOP1, size_t locx2, SPINOP_LABEL SOP2,
75// size_t loc3x, SPINOP_LABEL SOP3, size_t loc4x, SPINOP_LABEL SOP4,
76// size_t locy1=0, size_t locy2=0, size_t loc3y=0, size_t loc4y=0) const;
78
79protected:
80
81 Mpo<Symmetry> make_local (KONDO_SUBSYSTEM SUBSYS, size_t locx, size_t locy,
82 const OperatorType &Op,
83 double factor =1.,
84 bool HERMITIAN=false) const;
85 Mpo<Symmetry> make_corr (KONDO_SUBSYSTEM SUBSYS, size_t locx1, size_t locx2, size_t locy1, size_t locy2,
86 const OperatorType &Op1, const OperatorType &Op2, qarray<Symmetry::Nq> Qtot,
87 double factor, bool HERMITIAN) const;
88
90 make_FourierYSum (KONDO_SUBSYSTEM SUBSYS, string name, const vector<OperatorType> &Ops, double factor, bool HERMITIAN, const vector<complex<double> > &phases) const;
91
92 typename Symmetry::qType getQ_ScompScomp(SPINOP_LABEL Sa1, SPINOP_LABEL Sa2) const;
93
94 vector<SpinBase<Symmetry> > Bimp;
95 vector<SpinBase<Symmetry> > Bsub;
96};
97
98template<typename Symmetry>
100KondoNecklaceObservables (const size_t &L)
101{
102 Bimp.resize(L);
103 Bsub.resize(L);
104}
105
106template<typename Symmetry>
108KondoNecklaceObservables (const size_t &L, const vector<Param> &params, const map<string,any> &defaults)
109{
110 ParamHandler P(params,defaults);
111 size_t Lcell = P.size();
112 Bimp.resize(L); Bsub.resize(L);
113
114 for (size_t l=0; l<L; ++l)
115 {
116 Bsub[l] = SpinBase<Symmetry>(P.get<size_t>("Ly",l%Lcell), P.get<size_t>("Dsub",l%Lcell));
117 Bimp[l] = SpinBase<Symmetry>(P.get<size_t>("Ly",l%Lcell), P.get<size_t>("Dimp",l%Lcell));
118 }
119}
120
121//-------------
122
123template<typename Symmetry>
125make_local (KONDO_SUBSYSTEM SUBSYS, size_t locx, size_t locy, const OperatorType &Op, double factor, bool HERMITIAN) const
126{
127 assert(locx<Bimp.size() and locy<Bimp[locx].dim());
128 assert(SUBSYS != IMPSUB);
129 stringstream ss;
130 ss << Op.label() << "(" << locx << "," << locy;
131 if (factor != 1.) ss << ",factor=" << factor;
132 ss << ")";
133
134 Mpo<Symmetry> Mout(Bimp.size(), Op.Q(), ss.str(), HERMITIAN);
135 for (size_t l=0; l<Bimp.size(); ++l) {Mout.setLocBasis(Bsub[l].get_basis().combine(Bimp[l].get_basis()).qloc(),l);}
136
137 OperatorType OpExt;
138
139 if (SUBSYS == SUB)
140 {
141 OpExt = kroneckerProduct(Op, Bimp[locx].Id());
142 }
143 else if (SUBSYS == IMP)
144 {
145 OpExt = kroneckerProduct(Bsub[locx].Id(), Op);
146 }
147
148 Mout.setLocal(locx, (factor * OpExt).template plain<double>());
149 return Mout;
150}
151
152template<typename Symmetry>
154make_corr (KONDO_SUBSYSTEM SUBSYS, size_t locx1, size_t locx2, size_t locy1, size_t locy2,
155 const OperatorType &Op1, const OperatorType &Op2, qarray<Symmetry::Nq> Qtot,
156 double factor, bool HERMITIAN) const
157{
158 assert(locx1<Bimp.size() and locx2<Bimp.size() and locy1<Bimp[locx1].dim() and locy2<Bimp[locx2].dim());
159 stringstream ss;
160 ss << Op1.label() << "(" << locx1 << "," << locy1 << ")"
161 << Op2.label() << "(" << locx2 << "," << locy2 << ")";
162
163 Mpo<Symmetry> Mout(Bimp.size(), Qtot, ss.str(), HERMITIAN);
164 for (size_t l=0; l<Bimp.size(); ++l) {Mout.setLocBasis(Bsub[l].get_basis().combine(Bimp[l].get_basis()).qloc(),l);}
165
166 OperatorType Op1Ext;
167 OperatorType Op2Ext;
168
169 if (SUBSYS == SUB)
170 {
171 Op1Ext = kroneckerProduct(Op1, Bimp[locx1].Id());
172 Op2Ext = kroneckerProduct(Op2, Bimp[locx2].Id());
173 }
174 else if (SUBSYS == IMP)
175 {
176 Op1Ext = kroneckerProduct(Bsub[locx1].Id(), Op1);
177 Op2Ext = kroneckerProduct(Bsub[locx2].Id(), Op2);
178 }
179 else if (SUBSYS == IMPSUB)
180 {
181 Op1Ext = kroneckerProduct(Bsub[locx1].Id(), Op1);
182 Op2Ext = kroneckerProduct(Op2, Bimp[locx2].Id());
183 }
184
185 if (locx1 == locx2)
186 {
187 auto product = factor*OperatorType::prod(Op1Ext, Op2Ext, Qtot);
188 Mout.setLocal(locx1, product.template plain<double>());
189 }
190 else
191 {
192 Mout.setLocal({locx1, locx2}, {(factor*Op1Ext).template plain<double>(), Op2Ext.template plain<double>()});
193 }
194
195 return Mout;
196}
197
198template<typename Symmetry>
200make_FourierYSum (KONDO_SUBSYSTEM SUBSYS, string name, const vector<OperatorType> &Ops,
201 double factor, bool HERMITIAN, const vector<complex<double> > &phases) const
202{
203 stringstream ss;
204 ss << name << "_ky(";
205 for (int l=0; l<phases.size(); ++l)
206 {
207 ss << phases[l];
208 if (l!=phases.size()-1) {ss << ",";}
209 else {ss << ")";}
210 }
211
212 // all Ops[l].Q() must match
213 Mpo<Symmetry,complex<double> > Mout(Bimp.size(), Ops[0].Q(), ss.str(), HERMITIAN);
214 for (size_t l=0; l<Bimp.size(); ++l) {Mout.setLocBasis(Bsub[l].get_basis().combine(Bimp[l].get_basis()).qloc(),l);}
215
216 vector<complex<double> > phases_x_factor = phases;
217 for (int l=0; l<phases.size(); ++l)
218 {
219 phases_x_factor[l] = phases[l] * factor;
220 }
221
222 vector<SiteOperator<Symmetry,complex<double> > > OpsPlain(Ops.size());
223 for (int l=0; l<OpsPlain.size(); ++l)
224 {
225 if (SUBSYS == SUB)
226 {
227 OpsPlain[l] = kroneckerProduct(Ops[l], Bimp[l].Id()).template plain<double>().template cast<complex<double> >();
228 }
229 else if (SUBSYS == IMP)
230 {
231 OpsPlain[l] = kroneckerProduct(Bsub[l].Id(),Ops[l]).template plain<double>().template cast<complex<double> >();
232 }
233 }
234
235 Mout.setLocalSum(OpsPlain, phases_x_factor);
236 return Mout;
237}
238
239template<typename Symmetry>
240template<typename Dummy>
241typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type KondoNecklaceObservables<Symmetry>::
242Simp (SPINOP_LABEL Sa, size_t locx, size_t locy, double factor) const
243{
244 bool HERMITIAN = (Sa==SX or Sa==SZ)? true:false;
245 return make_local(IMP,locx,locy, Bimp[locx].Scomp(Sa,locy), factor, HERMITIAN);
246}
247
248template<typename Symmetry>
249template<typename Dummy>
250typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type KondoNecklaceObservables<Symmetry>::
251Ssub (SPINOP_LABEL Sa, size_t locx, size_t locy, double factor) const
252{
253 bool HERMITIAN = (Sa==SX or Sa==SZ)? true:false;
254 return make_local(SUB,locx,locy, Bsub[locx].Scomp(Sa,locy), factor, HERMITIAN);
255}
256
257template<typename Symmetry>
258template<typename Dummy>
259typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type KondoNecklaceObservables<Symmetry>::
260SimpSimp (SPINOP_LABEL Sa1, SPINOP_LABEL Sa2, size_t locx1, size_t locx2, size_t locy1, size_t locy2, double fac) const
261{
262 return make_corr(IMP,locx1,locx2,locy1,locy2, Bimp[locx1].Scomp(Sa1,locy1), Bimp[locx2].Scomp(Sa2,locy2), getQ_ScompScomp(Sa1,Sa2), fac, PROP::HERMITIAN);
263}
264
265template<typename Symmetry>
266template<typename Dummy>
267typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type KondoNecklaceObservables<Symmetry>::
268SsubSsub (SPINOP_LABEL Sa1, SPINOP_LABEL Sa2, size_t locx1, size_t locx2, size_t locy1, size_t locy2, double fac) const
269{
270 return make_corr(SUB,locx1,locx2,locy1,locy2, Bsub[locx1].Scomp(Sa1,locy1), Bsub[locx2].Scomp(Sa2,locy2), getQ_ScompScomp(Sa1,Sa2), fac, PROP::HERMITIAN);
271}
272
273template<typename Symmetry>
274template<typename Dummy>
275typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type KondoNecklaceObservables<Symmetry>::
276SimpSsub (SPINOP_LABEL Sa1, SPINOP_LABEL Sa2, size_t locx1, size_t locx2, size_t locy1, size_t locy2, double fac) const
277{
278 return make_corr(IMPSUB,locx1,locx2,locy1,locy2, Bimp[locx1].Scomp(Sa1,locy1), Bsub[locx2].Scomp(Sa2,locy2), getQ_ScompScomp(Sa1,Sa2), fac, PROP::HERMITIAN);
279}
280
281template<typename Symmetry>
282template<typename Dummy>
283typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type KondoNecklaceObservables<Symmetry>::
284Simp (size_t locx, size_t locy, double factor) const
285{
286 return make_local(IMP,locx,locy, Bimp[locx].S(locy), factor, PROP::NON_HERMITIAN);
287}
288
289template<typename Symmetry>
290template<typename Dummy>
291typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type KondoNecklaceObservables<Symmetry>::
292Simpdag (size_t locx, size_t locy, double factor) const
293{
294 return make_local(IMP,locx,locy, Bimp[locx].Sdag(locy), factor, PROP::NON_HERMITIAN);
295}
296
297template<typename Symmetry>
298template<typename Dummy>
299typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type KondoNecklaceObservables<Symmetry>::
300Ssub(size_t locx, size_t locy, double factor) const
301{
302 return make_local(SUB,locx,locy, Bsub[locx].S(locy), factor, PROP::NON_HERMITIAN);
303}
304
305template<typename Symmetry>
306template<typename Dummy>
307typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry> >::type KondoNecklaceObservables<Symmetry>::
308Ssubdag (size_t locx, size_t locy, double factor) const
309{
310 return make_local(SUB,locx,locy, Bsub[locx].Sdag(locy), factor, PROP::NON_HERMITIAN);
311}
312
313template<typename Symmetry>
314template<typename Dummy>
315typename std::conditional<Dummy::IS_SPIN_SU2(), Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type KondoNecklaceObservables<Symmetry>::
316SimpdagSimp (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
317{
318 if constexpr (Symmetry::IS_SPIN_SU2())
319 {
320 return make_corr(IMP,locx1, locx2, locy1, locy2, Bimp[locx1].Sdag(locy1), Bimp[locx2].S(locy2), Symmetry::qvacuum(), sqrt(3.), PROP::HERMITIAN);
321 // return make_corr("T†", "T", locx1, locx2, locy1, locy2, F[locx1].Tdag(locy1), F[locx2].T(locy2), Symmetry::qvacuum(), std::sqrt(3.), PROP::HERMITIAN);
322 }
323 else
324 {
325 vector<Mpo<Symmetry> > out(3);
326 out[0] = SimpSimp(SZ,SZ,locx1,locx2,locy1,locy2);
327 out[1] = SimpSimp(SP,SM,locx1,locx2,locy1,locy2,0.5);
328 out[2] = SimpSimp(SM,SP,locx1,locx2,locy1,locy2,0.5);
329 return out;
330 }
331}
332
333template<typename Symmetry>
334template<typename Dummy>
335typename std::conditional<Dummy::IS_SPIN_SU2(), Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type KondoNecklaceObservables<Symmetry>::
336SsubdagSsub (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
337{
338 if constexpr (Symmetry::IS_SPIN_SU2())
339 {
340 return make_corr(SUB,locx1, locx2, locy1, locy2, Bsub[locx1].Sdag(locy1), Bsub[locx2].S(locy2), Symmetry::qvacuum(), sqrt(3.), PROP::HERMITIAN);
341 // return make_corr("T†", "T", locx1, locx2, locy1, locy2, F[locx1].Tdag(locy1), F[locx2].T(locy2), Symmetry::qvacuum(), std::sqrt(3.), PROP::HERMITIAN);
342 }
343 else
344 {
345 vector<Mpo<Symmetry> > out(3);
346 out[0] = SsubSsub(SZ,SZ,locx1,locx2,locy1,locy2);
347 out[1] = SsubSsub(SP,SM,locx1,locx2,locy1,locy2,0.5);
348 out[2] = SsubSsub(SM,SP,locx1,locx2,locy1,locy2,0.5);
349 return out;
350 }
351}
352
353template<typename Symmetry>
354template<typename Dummy>
355typename std::conditional<Dummy::IS_SPIN_SU2(), Mpo<Symmetry>, vector<Mpo<Symmetry> > >::type KondoNecklaceObservables<Symmetry>::
356SimpdagSsub (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
357{
358 if constexpr (Symmetry::IS_SPIN_SU2())
359 {
360 return make_corr(IMPSUB,locx1, locx2, locy1, locy2, Bimp[locx1].Sdag(locy1), Bsub[locx2].S(locy2), Symmetry::qvacuum(), sqrt(3.), PROP::HERMITIAN);
361 // return make_corr("T†", "T", locx1, locx2, locy1, locy2, F[locx1].Tdag(locy1), F[locx2].T(locy2), Symmetry::qvacuum(), std::sqrt(3.), PROP::HERMITIAN);
362 }
363 else
364 {
365 vector<Mpo<Symmetry> > out(3);
366 out[0] = SimpSsub(SZ,SZ,locx1,locx2,locy1,locy2);
367 out[1] = SimpSsub(SP,SM,locx1,locx2,locy1,locy2,0.5);
368 out[2] = SimpSsub(SM,SP,locx1,locx2,locy1,locy2,0.5);
369 return out;
370 }
371}
372
373template<typename Symmetry>
374template<typename Dummy>
375typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,complex<double> > >::type KondoNecklaceObservables<Symmetry>::
376Simp_ky (vector<complex<double> > phases) const
377{
378 vector<OperatorType> Ops(Bimp.size());
379 for (size_t l=0; l<Bimp.size(); ++l)
380 {
381 Ops[l] = Bimp[l].S(0);
382 }
383 return make_FourierYSum(IMP,"S", Ops, 1., false, phases);
384}
385
386template<typename Symmetry>
387template<typename Dummy>
388typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,complex<double> > >::type KondoNecklaceObservables<Symmetry>::
389Simpdag_ky (vector<complex<double> > phases, double factor) const
390{
391 vector<OperatorType> Ops(Bimp.size());
392 for (size_t l=0; l<Bimp.size(); ++l)
393 {
394 Ops[l] = Bimp[l].Sdag(0);
395 }
396 return make_FourierYSum(IMP,"S†", Ops, 1., false, phases);
397}
398
399template<typename Symmetry>
401{
402 typename Symmetry::qType out;
403 if ( (Sa1 == SZ and Sa2 == SZ) or (Sa1 == SP and Sa2 == SM) or (Sa1 == SM and Sa2 == SP) or (Sa1 == SX or Sa1 == iSY) ) {out = Symmetry::qvacuum();}
404 else {assert(false and "Quantumnumber for the chosen ScompScomp is not computed. Add in KondoNecklaceObservables::getQ_ScompScomp");}
405 return out;
406}
407
408// template<typename Symmetry>
409// template<SPIN_INDEX sigma>
410// Mpo<Symmetry> KondoNecklaceObservables<Symmetry>::
411// c (size_t locx, size_t locy) const
412// {
413// stringstream ss;
414// ss << "c" << sigma;
415// return make_local(SUB, ss.str(), locx,locy, F[locx].c(sigma,locy), true);
416// }
417
418// template<typename Symmetry>
419// template<SPIN_INDEX sigma>
420// Mpo<Symmetry> KondoNecklaceObservables<Symmetry>::
421// cdag (size_t locx, size_t locy) const
422// {
423// stringstream ss;
424// ss << "c†" << sigma;
425// return make_local(SUB, ss.str(), locx,locy, F[locx].cdag(sigma,locy), true);
426// }
427
428// template<typename Symmetry>
429// Mpo<Symmetry> KondoNecklaceObservables<Symmetry>::
430// n (size_t locx, size_t locy) const
431// {
432// return make_local(SUB, "n", locx,locy, F[locx].n(locy), false, true);
433// }
434
435// template<typename Symmetry>
436// template<SPIN_INDEX sigma>
437// Mpo<Symmetry> KondoNecklaceObservables<Symmetry>::
438// n (size_t locx, size_t locy) const
439// {
440// return make_local(SUB, "n", locx,locy, F[locx].n(sigma,locy), false, true);
441// // FERMIONIC=false, HERMITIAN=true
442// }
443
444// template<typename Symmetry>
445// Mpo<Symmetry> KondoNecklaceObservables<Symmetry>::
446// d (size_t locx, size_t locy) const
447// {
448// return make_local(SUB, "d", locx,locy, F[locx].d(locy), false, true);
449// }
450
451// template<typename Symmetry>
452// Mpo<Symmetry> KondoNecklaceObservables<Symmetry>::
453// cc (size_t locx, size_t locy) const
454// {
455// stringstream ss;
456// ss << "c" << UP << "c" << DN;
457// return make_local(SUB, ss.str(), locx,locy, F[locx].c(UP,locy)*F[locx].c(DN,locy), false, false);
458// }
459
460// template<typename Symmetry>
461// Mpo<Symmetry> KondoNecklaceObservables<Symmetry>::
462// cdagcdag (size_t locx, size_t locy) const
463// {
464// stringstream ss;
465// ss << "c†" << DN << "c†" << UP;
466// return make_local(SUB, ss.str(), locx,locy, F[locx].cdag(DN,locy)*F[locx].cdag(UP,locy), false, false);
467// }
468
469// template<typename Symmetry>
470// Mpo<Symmetry> KondoNecklaceObservables<Symmetry>::
471// nn (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
472// {
473// return make_corr(SUB, "n","n", locx1,locx2,locy1,locy2, F[locx1].n(UPDN,locy1), F[locx2].n(UPDN,locy2));
474// }
475
476// template<typename Symmetry>
477// Mpo<Symmetry> KondoNecklaceObservables<Symmetry>::
478// Simp (SPINOP_LABEL Sa, size_t locx, size_t locy, double factor) const
479// {
480// stringstream ss;
481// ss << Sa << "imp";
482// bool HERMITIAN = (Sa==SX or Sa==SZ)? true:false;
483// return make_local(IMP, ss.str(), locx, locy, factor * B[locx].Scomp(Sa,locy), false, HERMITIAN);
484// }
485
486// template<typename Symmetry>
487// Mpo<Symmetry> KondoNecklaceObservables<Symmetry>::
488// Ssub (SPINOP_LABEL Sa, size_t locx, size_t locy, double factor) const
489// {
490// stringstream ss;
491// ss << Sa << "sub";
492// bool HERMITIAN = (Sa==SX or Sa==SZ)? true:false;
493// return make_local(SUB, ss.str(), locx,locy, factor * F[locx].Scomp(Sa,locy), false, HERMITIAN);
494// }
495
496// template<typename Symmetry>
497// Mpo<Symmetry> KondoNecklaceObservables<Symmetry>::
498// SimpSimp (SPINOP_LABEL SOP1, SPINOP_LABEL SOP2, size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
499// {
500// stringstream ss1; ss1 << SOP1 << "imp";
501// stringstream ss2; ss2 << SOP2 << "imp";
502
503// return make_corr(IMP, ss1.str(),ss2.str(), locx1,locx2,locy1,locy2, B[locx1].Scomp(SOP1,locy1), B[locx2].Scomp(SOP2,locy2));
504// }
505
506// template<typename Symmetry>
507// Mpo<Symmetry> KondoNecklaceObservables<Symmetry>::
508// SsubSsub (SPINOP_LABEL SOP1, SPINOP_LABEL SOP2, size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
509// {
510// stringstream ss1; ss1 << SOP1 << "sub";
511// stringstream ss2; ss2 << SOP2 << "sub";
512
513// return make_corr(SUB, ss1.str(),ss2.str(), locx1,locx2,locy1,locy2, F[locx1].Scomp(SOP1,locy1), F[locx2].Scomp(SOP2,locy2));
514// }
515
516// template<typename Symmetry>
517// Mpo<Symmetry> KondoNecklaceObservables<Symmetry>::
518// SimpSsub (SPINOP_LABEL SOP1, SPINOP_LABEL SOP2, size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
519// {
520// stringstream ss1; ss1 << SOP1 << "imp";
521// stringstream ss2; ss2 << SOP2 << "sub";
522
523// return make_corr(IMPSUB, ss1.str(),ss2.str(), locx1,locx2,locy1,locy2, B[locx1].Scomp(SOP1,locy1), F[locx2].Scomp(SOP2,locy2));
524// }
525
526// template<typename Symmetry>
527// template<typename MpsType>
528// double KondoNecklaceObservables<Symmetry>::
529// SvecSvecAvgImpSub (const MpsType &Psi, size_t locx1, size_t locx2, size_t locy1, size_t locy2)
530// {
531// return isReal(avg(Psi,SimpSsub(SZ,SZ,locx1,locx2,locy1,locy2),Psi))+
532// isReal(avg(Psi,SimpSsub(SP,SM,locx1,locx2,locy1,locy2),Psi));
533// }
534
535// template<typename Symmetry>
536// template<SPIN_INDEX sigma>
537// Mpo<Symmetry> KondoNecklaceObservables<Symmetry>::
538// cdagc (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
539// {
540// assert(locx1<F.size() and locx2<F.size() and locy1<F[locx1].dim() and locy2<F[locx2].dim());
541// stringstream ss;
542// ss << "c†" << sigma << "(" << locx1 << "," << locy1 << "," << ")"
543// << "c " << sigma << "(" << locx2 << "," << locy2 << "," << ")";
544
545// auto cdag = kroneckerProduct(B[locx1].Id(),F[locx1].cdag(sigma,locy1));
546// auto c = kroneckerProduct(B[locx2].Id(),F[locx2].c (sigma,locy2));
547// auto sign = kroneckerProduct(B[0].Id(),F[0].sign());
548
549// Mpo<Symmetry> Mout(F.size(), cdag.Q+c.Q, ss.str());
550// for (size_t l=0; l<F.size(); ++l) {Mout.setLocBasis(Symmetry::reduceSilent(B[l].get_basis(),F[l].get_basis()),l);}
551
552// if (locx1 == locx2)
553// {
554// Mout.setLocal(locx1, cdag*c);
555// }
556// else if (locx1<locx2)
557// {
558// Mout.setLocal({locx1, locx2}, {cdag*sign, c}, sign);
559// }
560// else if (locx1>locx2)
561// {
562// Mout.setLocal({locx2, locx1}, {c*sign, -1.*cdag}, sign);
563// }
564
565// return Mout;
566// }
567
568// Mpo<Sym::U1xU1<double> > KondoU1xU1::
569// 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,
570// size_t locy1, size_t locy2, size_t loc3y, size_t loc4y)
571// {
572// assert(locx1<this->F.size() and locx2<this->F.size() and loc3x<this->F.size() and loc4x<this->F.size());
573// stringstream ss;
574// ss << SOP1 << "(" << locx1 << "," << locy1 << ")" << SOP2 << "(" << locx2 << "," << locy2 << ")" <<
575// SOP3 << "(" << loc3x << "," << loc3y << ")" << SOP4 << "(" << loc4x << "," << loc4y << ")";
576// Mpo<Symmetry> Mout(this->F.size(), this->N_legs, locBasis(), {0,0}, KondoU1xU1::NMlabel, ss.str());
577// Mout.setLocal({locx1, locx2, loc3x, loc4x},
578// {kroneckerProduct(B.Scomp(SOP1,locy1),F.Id()),
579// kroneckerProduct(B.Id(),F.Scomp(SOP2,locy2)),
580// kroneckerProduct(B.Scomp(SOP3,loc3y),F.Id()),
581// kroneckerProduct(B.Scomp(SOP4,loc4y),F.Id())});
582// return Mout;
583// }
584
585// Mpo<Sym::U1xU1<double> > KondoU1xU1::
586// 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,
587// size_t locy1, size_t locy2, size_t loc3y, size_t loc4y)
588// {
589// assert(locx1<this->F.size() and locx2<this->F.size() and loc3x<this->F.size() and loc4x<this->F.size());
590// stringstream ss;
591// ss << SOP1 << "(" << locx1 << "," << locy1 << ")" << SOP2 << "(" << locx2 << "," << locy2 << ")" <<
592// SOP3 << "(" << loc3x << "," << loc3y << ")" << SOP4 << "(" << loc4x << "," << loc4y << ")";
593// Mpo<Symmetry> Mout(this->F.size(), this->N_legs, locBasis(), {0,0}, KondoU1xU1::NMlabel, ss.str());
594// SparseMatrixXd IdSub(F.dim(),F.dim()); IdSub.setIdentity();
595// SparseMatrixXd IdImp(Mpo<Symmetry>::qloc[locx2].size()/F.dim(), Mpo<Symmetry>::qloc[locx2].size()/F.dim()); IdImp.setIdentity();
596// Mout.setLocal({locx1, locx2, loc3x, loc4x},
597// {kroneckerProduct(B.Scomp(SOP1,locy1),F.Id()),
598// kroneckerProduct(B.Id(),F.Scomp(SOP2,locy2)),
599// kroneckerProduct(B.Scomp(SOP3,loc3y),F.Id()),
600// kroneckerProduct(B.Id(),F.Scomp(SOP4,loc4y))});
601// return Mout;
602// }
603
604#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
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 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
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
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_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
KondoNecklaceObservables(const size_t &L, const vector< Param > &params, const map< string, any > &defaults)
std::enable_if< Dummy::IS_SPIN_SU2(), Mpo< Symmetry, complex< double > > >::type Simp_ky(vector< complex< double > > phases) 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::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::enable_if< Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type S(size_t locx, size_t locy=0, double factor=1.) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry > >::type Sz(size_t locx, size_t locy=0) const
SiteOperatorQ< Symmetry, Eigen::MatrixXd > OperatorType
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 HERMITIAN) 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
vector< SpinBase< Symmetry > > Bsub
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::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::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
Mpo< Symmetry > make_local(KONDO_SUBSYSTEM SUBSYS, size_t locx, size_t locy, const OperatorType &Op, double factor=1., bool HERMITIAN=false) const
not implemented
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 > >::type Simp(size_t locx, size_t locy=0, double factor=1.) const
vector< SpinBase< Symmetry > > Bimp
Symmetry::qType getQ_ScompScomp(SPINOP_LABEL Sa1, SPINOP_LABEL Sa2) 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 Ssubdag(size_t locx, size_t locy=0, double factor=std::sqrt(3.)) 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, complex< double > > >::type Simpdag_ky(vector< complex< double > > phases, double factor=sqrt(3.)) 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)
std::string & label()
const bool NON_HERMITIAN
Definition: DmrgTypedefs.h:493
const bool HERMITIAN
Definition: DmrgTypedefs.h:492
Definition: qarray.h:26