1#ifndef HUBBARDOBSERVABLES
2#define HUBBARDOBSERVABLES
6#include "ParamHandler.h"
12template<
typename Symmetry,
typename Scalar=
double>
23 HubbardObservables (
const size_t &L,
const vector<Param> ¶ms,
const std::map<string,std::any> &defaults);
31 template<
class Dummy = Symmetry>
32 typename std::enable_if<Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar> >::type
c (
size_t locx,
size_t locy=0,
double factor=1.)
const;
34 template<SPIN_INDEX sigma,
class Dummy = Symmetry>
35 typename std::enable_if<!Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar> >::type
c (
size_t locx,
size_t locy=0,
double factor=1.)
const;
37 template<
class Dummy = Symmetry>
38 typename std::enable_if<Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar>>::type
cdag (
size_t locx,
size_t locy=0,
double factor=std::sqrt(2.))
const;
40 template<SPIN_INDEX sigma,
class Dummy = Symmetry>
41 typename std::enable_if<!Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar> >::type
cdag (
size_t locx,
size_t locy=0,
double factor=1.)
const;
45 template<
class Dummy = Symmetry>
48 template<
class Dummy = Symmetry>
51 template<
typename Dummy = Symmetry>
52 typename std::conditional<Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar>, vector<Mpo<Symmetry,Scalar> > >::type
cdagc (
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,Scalar>, vector<Mpo<Symmetry,Scalar> > >::type
cdag_nc (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0)
const;
57 template<
typename Dummy = Symmetry>
58 typename std::conditional<Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar>, vector<Mpo<Symmetry,Scalar> > >::type
cdagn_c (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0)
const;
60 template<
typename Dummy = Symmetry>
61 typename std::conditional<Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar>, vector<Mpo<Symmetry,Scalar> > >::type
cdagc3 (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0)
const;
63 template<SPIN_INDEX sigma1, SPIN_INDEX sigma2,
typename Dummy = Symmetry>
64 typename std::enable_if<!Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar> >::type
cdagc (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0,
double factor=1.)
const;
66 template<
typename Dummy = Symmetry>
75 template<SPIN_INDEX sigma1, SPIN_INDEX sigma2,
typename Dummy = Symmetry>
76 typename std::enable_if<Dummy::ABELIAN,Mpo<Symmetry,Scalar> >::type
cdagcdag (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0)
const;
78 template<
typename Dummy = Symmetry>
79 typename std::enable_if<Dummy::ABELIAN,Mpo<Symmetry,Scalar> >::type
cdagcdag (
SPIN_INDEX sigma1,
SPIN_INDEX sigma2,
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0)
const;
85 template<SPIN_INDEX sigma1, SPIN_INDEX sigma2,
typename Dummy = Symmetry>
86 typename std::enable_if<Dummy::ABELIAN,Mpo<Symmetry,Scalar> >::type
cc (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0)
const;
88 template<
typename Dummy = Symmetry>
89 typename std::enable_if<Dummy::ABELIAN,Mpo<Symmetry,Scalar> >::type
cc (
SPIN_INDEX sigma1,
SPIN_INDEX sigma2,
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0)
const;
91 template<
typename Dummy = Symmetry>
92 typename std::conditional<Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar>, vector<Mpo<Symmetry,Scalar> > >::type
93 cc3 (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0)
const;
95 template<
typename Dummy = Symmetry>
96 typename std::conditional<Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar>, vector<Mpo<Symmetry,Scalar> > >::type
97 cc1 (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0)
const;
99 template<
typename Dummy = Symmetry>
100 typename std::conditional<Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar>, vector<Mpo<Symmetry,Scalar> > >::type
101 cdagcdag3 (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0)
const;
103 template<
typename Dummy = Symmetry>
104 typename std::conditional<Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar>, vector<Mpo<Symmetry,Scalar> > >::type
105 cdagcdag1 (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0)
const;
107 template<
class Dummy = Symmetry>
110 template<
class Dummy = Symmetry>
113 template<
class Dummy = Symmetry>
116 template<
class Dummy = Symmetry>
119 template<
class Dummy = Symmetry>
123 template<
class Dummy = Symmetry>
125 template<
class Dummy = Symmetry>
132 template<SPIN_INDEX sigma,
typename Dummy = Symmetry>
135 template<
class Dummy = Symmetry>
138 template<SPIN_INDEX sigma1, SPIN_INDEX sigma2,
typename Dummy = Symmetry>
139 typename std::enable_if<!Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar> >::type
nn (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0)
const;
142 template<
typename Dummy = Symmetry>
143 typename std::enable_if<!Dummy::IS_CHARGE_SU2(),
Mpo<Symmetry,Scalar> >::type
hh (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0)
const;
147 template<
typename Dummy = Symmetry>
148 typename std::enable_if<Dummy::IS_CHARGE_SU2(),
Mpo<Symmetry,Scalar> >::type
T (
size_t locx,
size_t locy=0,
double factor=1.)
const;
149 template<
typename Dummy = Symmetry>
150 typename std::enable_if<Dummy::IS_CHARGE_SU2(),
Mpo<Symmetry,Scalar> >::type
Tdag (
size_t locx,
size_t locy=0,
double factor=std::sqrt(3.))
const;
151 template<
typename Dummy = Symmetry>
153 template<
typename Dummy = Symmetry>
155 template<
typename Dummy = Symmetry>
157 template<
typename Dummy = Symmetry>
159 template<
typename Dummy = Symmetry>
161 template<
typename Dummy = Symmetry>
162 typename std::enable_if<!Dummy::IS_CHARGE_SU2(),
Mpo<Symmetry,Scalar> >::type
TpTm (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0,
double fac=1.)
const;
163 template<
typename Dummy = Symmetry>
164 typename std::enable_if<!Dummy::IS_CHARGE_SU2(),
Mpo<Symmetry,Scalar> >::type
TmTp (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0,
double fac=1.)
const;
165 template<
typename Dummy = Symmetry>
166 typename std::enable_if<!Dummy::IS_CHARGE_SU2(),
Mpo<Symmetry,Scalar> >::type
TzTz (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0)
const;
167 template<
typename Dummy = Symmetry>
168 typename std::conditional<Dummy::IS_CHARGE_SU2(),
Mpo<Symmetry,Scalar>, vector<Mpo<Symmetry,Scalar> > >::type
TdagT (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0)
const;
172 template<
typename Dummy = Symmetry>
173 typename std::enable_if<Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar> >::type
S (
size_t locx,
size_t locy=0,
double factor=1.)
const;
174 template<
typename Dummy = Symmetry>
175 typename std::enable_if<Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar> >::type
Sdag (
size_t locx,
size_t locy=0,
double factor=std::sqrt(3.))
const;
176 template<
typename Dummy = Symmetry>
178 template<
typename Dummy = Symmetry>
180 template<
typename Dummy = Symmetry>
182 template<
typename Dummy = Symmetry>
184 template<
typename Dummy = Symmetry>
186 template<
typename Dummy = Symmetry>
188 template<
typename Dummy = Symmetry>
190 template<
typename Dummy = Symmetry>
192 template<
typename Dummy = Symmetry>
194 template<
typename Dummy = Symmetry>
195 typename std::enable_if<!Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar> >::type
SpSm (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0,
double fac=1.)
const {
return ScompScomp(
SP,
SM,locx1,locx2,locy1,locy2,fac);};
196 template<
typename Dummy = Symmetry>
197 typename std::enable_if<!Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar> >::type
SmSp (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0,
double fac=1.)
const {
return ScompScomp(
SM,
SP,locx1,locx2,locy1,locy2,fac);};
198 template<
typename Dummy = Symmetry>
199 typename std::enable_if<!Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar> >::type
SzSz (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0)
const {
return ScompScomp(
SZ,
SZ,locx1,locx2,locy1,locy2,1.);};
200 template<
typename Dummy = Symmetry>
201 typename std::conditional<Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar>, vector<Mpo<Symmetry,Scalar> > >::type
SdagS (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0)
const;
204 template<
class Dummy = Symmetry>
206 template<
class Dummy = Symmetry>
208 template<
typename Dummy = Symmetry>
213 template<
typename Dummy = Symmetry>
214 typename std::enable_if<!Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar> >::type
Stringz (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0)
const;
215 template<
typename Dummy = Symmetry>
220 template<
typename Dummy = Symmetry>
222 template<
typename Dummy = Symmetry>
224 template<
typename Dummy = Symmetry>
226 template<
typename Dummy = Symmetry>
228 template<
typename Dummy = Symmetry>
229 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;
230 template<typename Dummy = Symmetry>
231 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;
236 template<typename Dummy = Symmetry>
237 typename
std::enable_if<Dummy::IS_SPIN_SU2() and !Dummy::IS_CHARGE_SU2(),
Mpo<Symmetry,Scalar> >::type
P (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0) const;
239 template<typename Dummy = Symmetry>
240 typename
std::enable_if<!Dummy::IS_SPIN_SU2(),
Mpo<Symmetry,Scalar> >::type
P (
size_t locx1,
size_t locx2,
size_t locy1=0,
size_t locy2=0) const;
245 Mpo<Symmetry,Scalar>
make_local (
size_t locx,
size_t locy, const
OperatorType &Op,
double factor =1.,
bool FERMIONIC=false,
bool HERMITIAN=false) const;
247 Mpo<Symmetry,Scalar>
make_corr (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2,
249 double factor,
bool FERMIONIC,
bool HERMITIAN) const;
251 Mpo<Symmetry,complex<
double> >
260template<typename Symmetry, typename Scalar>
267template<
typename Symmetry,
typename Scalar>
269HubbardObservables (
const size_t &L,
const vector<Param> ¶ms,
const std::map<string,std::any> &defaults)
271 ParamHandler
P(params,defaults);
272 size_t Lcell =
P.size();
275 for (
size_t l=0; l<L; ++l)
278 P.get<
bool>(
"REMOVE_DOUBLE",l%Lcell),
279 P.get<
bool>(
"REMOVE_EMPTY",l%Lcell),
280 P.get<
bool>(
"REMOVE_UP",l%Lcell),
281 P.get<
bool>(
"REMOVE_DN",l%Lcell),
282 P.get<
int>(
"mfactor",l%Lcell),
283 P.get<
int>(
"k",l%Lcell));
287 if (
P.HAS(
"G")) {
G =
P.get<vector<SUB_LATTICE> >(
"G");}
291 for (
int l=1; l<L; l+=1) G[l] = static_cast<SUB_LATTICE>(-1*
G[l-1]);
297template<
typename Symmetry,
typename Scalar>
299make_local (
size_t locx,
size_t locy,
const OperatorType &Op,
double factor,
bool FERMIONIC,
bool HERMITIAN)
const
301 assert(locx<
F.size() and locy<
F[locx].dim());
303 ss << Op.
label() <<
"(" << locx <<
"," << locy;
304 if (factor != 1.) ss <<
",factor=" << factor;
308 for (
size_t l=0; l<
F.size(); ++l) Mout.
setLocBasis(
F[l].get_basis().qloc(),l);
312 vector<SiteOperator<Symmetry,Scalar> > Signs(locx);
313 for (
size_t l=0; l<locx; ++l) {Signs[l] =
F[l].sign().template plain<double>().template cast<Scalar>();}
315 Mout.
setLocal(locx, (factor * Op).
template plain<double>().
template cast<Scalar>(), Signs);
319 Mout.
setLocal(locx, (factor * Op).
template plain<double>().
template cast<Scalar>());
325template<
typename Symmetry,
typename Scalar>
327make_localSum (
const vector<OperatorType> &Op, vector<double> factor,
bool HERMITIAN)
const
329 assert(Op.size()==
F.size() and factor.size()==
F.size());
331 ss << Op[0].label() <<
"localSum";
334 for (
size_t l=0; l<
F.size(); ++l) {Mout.
setLocBasis(
F[l].get_basis().qloc(),l);}
336 vector<SiteOperator<Symmetry,Scalar>> Op_plain;
337 for (
int i=0; i<Op.size(); ++i)
339 Op_plain.push_back(Op[i].
template plain<double>().
template cast<Scalar>());
341 vector<Scalar> factor_cast(factor.size());
342 for (
int l=0; l<factor.size(); ++l)
344 factor_cast[l] =
static_cast<Scalar
>(factor[l]);
351template<
typename Symmetry,
typename Scalar>
353make_corr (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2,
356 double factor,
bool FERMIONIC,
bool HERMITIAN)
const
358 assert(locx1<
F.size() and locy1<
F[locx1].dim());
359 assert(locx2<
F.size() and locy2<
F[locx2].dim());
362 ss << Op1.
label() <<
"(" << locx1 <<
"," << locy1 <<
")"
363 << Op2.
label() <<
"(" << locx2 <<
"," << locy2 <<
")";
366 for (
size_t l=0; l<
F.size(); ++l) {Mout.
setLocBasis(
F[l].get_basis().qloc(),l);}
374 else if (locx1<locx2)
376 vector<SiteOperator<Symmetry,Scalar> > Signs;
377 for (
size_t l=locx1+1; l<locx2; ++l)
379 Signs.push_back(
F[l].sign().
template plain<double>().
template cast<Scalar>());
385 Mout.
setLocal({locx1, locx2}, {(factor * (Op1 *
F[locx1].sign())).
template plain<double>().template cast<Scalar>(),
386 Op2.template plain<double>().template cast<Scalar>()},
389 else if (locx1>locx2)
391 vector<SiteOperator<Symmetry,Scalar> > Signs;
392 for (
size_t l=locx2+1; l<locx1; ++l)
394 Signs.push_back(
F[l].sign().template plain<double>().template cast<Scalar>());
401 Mout.
setLocal({locx2, locx1}, {(factor * (Op2 *
F[locx2].sign())).template plain<double>().template cast<Scalar>(),
402 -Symmetry::spinorFactor() * Op1.template plain<double>().template cast<Scalar>()},
411 Mout.
setLocal(locx1, product.template plain<double>().template cast<Scalar>());
415 Mout.
setLocal({locx1, locx2}, {(factor*Op1).
template plain<double>().template cast<Scalar>(),
416 Op2.template plain<double>().template cast<Scalar>()});
422template<
typename Symmetry,
typename Scalar>
425 double factor,
bool HERMITIAN,
const vector<complex<double> > &phases)
const
428 ss << name <<
"_ky(";
429 for (
int l=0; l<phases.size(); ++l)
432 if (l!=phases.size()-1) {ss <<
",";}
438 for (
size_t l=0; l<
F.size(); ++l) {Mout.
setLocBasis(
F[l].get_basis().qloc(),l);}
440 vector<complex<double> > phases_x_factor = phases;
441 for (
int l=0; l<phases.size(); ++l)
443 phases_x_factor[l] = phases[l] * factor;
446 vector<SiteOperator<Symmetry,complex<double> > > OpsPlain(Ops.size());
447 for (
int l=0; l<OpsPlain.size(); ++l)
449 OpsPlain[l] = Ops[l].template plain<double>().template cast<complex<double> >();
457template<
typename Symmetry,
typename Scalar>
464template<
typename Symmetry,
typename Scalar>
465template<
typename Dummy>
467StringCorrSpin (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
469 return make_corr(locx1, locx2, locy1, locy2,
F[locx1].
Sdag(locy1),
F[locx2].
S(locy2), Symmetry::qvacuum(), +1.,
true,
false);
472template<
typename Symmetry,
typename Scalar>
473template<
typename Dummy>
475StringCorrTpm (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
477 return make_corr(locx1, locx2, locy1, locy2,
F[locx1].
Tp(locy1),
F[locx2].
Tm(locy2), Symmetry::qvacuum(), +1.,
true,
false);
480template<
typename Symmetry,
typename Scalar>
481template<
typename Dummy>
483StringCorrTz (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
485 return make_corr(locx1, locx2, locy1, locy2,
F[locx1].
Tz(locy1),
F[locx2].
Tz(locy2), Symmetry::qvacuum(), +1.,
true,
false);
488template<
typename Symmetry,
typename Scalar>
489template<
typename Dummy>
491StringCorrId (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
493 return make_corr(locx1, locx2, locy1, locy2,
F[locx1].
Id(locy1),
F[locx2].
Id(locy2), Symmetry::qvacuum(), +1.,
true,
false);
496template<
typename Symmetry,
typename Scalar>
497template<
typename Dummy>
499StringCorrSz (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
501 return make_corr(locx1, locx2, locy1, locy2,
F[locx1].
Sz(locy1),
F[locx2].
Sz(locy2), Symmetry::qvacuum(), +1.,
true,
false);
504template<
typename Symmetry,
typename Scalar>
505template<
typename Dummy>
509 assert(dLphys==2 and
"Only dLphys=2 is implemented!");
511 for (
size_t l=0; l<
F.size(); ++l) {Mout.
setLocBasis(
F[l].get_basis().qloc(),l);}
513 std::vector<typename Symmetry::qType> qList(
F.size()+1);
514 std::vector<SiteOperator<Symmetry,Scalar>> opList(
F.size());
516 for (
int i=0; i<qList.size(); ++i) {qList[i] = Symmetry::qvacuum();}
517 for (
int i=0; i<opList.size(); ++i) {opList[i] =
F[i].Id().template plain<double>();}
519 for (
int i=0; i<
F.size(); i+=dLphys)
520 for (
int j=0; j<
F.size(); j+=dLphys)
524 auto qListWork = qList;
525 auto opListWork = opList;
529 for (
int k=i+3; k<j+1; ++k) qListWork[k] = qarray<Symmetry::Nq>{1,2};
539 opListWork[i] = (
F[i].cdag(0) *
F[i].sign()).template plain<double>();
540 opListWork[i+1] =
F[i+1].cdag(0).template plain<double>();
541 opListWork[j] = (
F[j].c(0) *
F[j].sign()).
template plain<double>();
542 opListWork[j+1] =
F[j+1].c(0).template plain<double>();
544 std::vector<SiteOperator<Symmetry,Scalar>> opRes = std::vector<SiteOperator<Symmetry,Scalar>>(opListWork.begin()+i, opListWork.begin()+j+2);
545 std::vector<typename Symmetry::qType> qRes = std::vector<typename Symmetry::qType>(qListWork.begin()+i, qListWork.begin()+j+3);
556 for (
int k=i+3; k<j+1; ++k) qListWork[k] = qarray<Symmetry::Nq>{1,-2};
566 opListWork[i] = (
F[i].c(0) *
F[i].sign()).template plain<double>();
567 opListWork[i+1] =
F[i+1].c(0).template plain<double>();
568 opListWork[j] = (
F[j].cdag(0) *
F[j].sign()).
template plain<double>();
569 opListWork[j+1] =
F[j+1].cdag(0).template plain<double>();
571 opRes = std::vector<SiteOperator<Symmetry,Scalar>>(opListWork.begin()+i, opListWork.begin()+j+2);
572 qRes = std::vector<typename Symmetry::qType>(qListWork.begin()+i, qListWork.begin()+j+3);
586template<
typename Symmetry,
typename Scalar>
587template<
typename Dummy>
591 assert(dLphys==2 and
"Only dLphys=2 is implemented!");
593 for (
size_t l=0; l<
F.size(); ++l) {Mout.setLocBasis(
F[l].get_basis().qloc(),l);}
595 std::vector<typename Symmetry::qType> qList(
F.size()+1);
596 std::vector<SiteOperator<Symmetry,Scalar>> opList(
F.size());
598 for (
int i=0; i<qList.size(); ++i) {qList[i] = Symmetry::qvacuum();}
599 for (
int i=0; i<opList.size(); ++i) {opList[i] =
F[i].Id().template plain<double>();}
603 auto qListWork = qList;
604 auto opListWork = opList;
606 opListWork[i] = (Sysi *
F[i].sign()).
template plain<double>();
607 opListWork[i+1] = Bathi.template plain<double>();
608 opListWork[j] = (Sysj *
F[j].sign()).
template plain<double>();
609 opListWork[j+1] = Bathj.template plain<double>();
611 qListWork[1+i] = Sysi.Q();
612 qListWork[1+i+1] = Sysi.Q()+Bathi.Q();
613 for (
int k=i+3; k<j+1; ++k) qListWork[k] = Sysi.Q()+Bathi.Q();
614 qListWork[1+j] = Sysi.Q()+Bathi.Q()+Sysj.Q();
615 qListWork[1+j+1] = Sysi.Q()+Bathi.Q()+Sysj.Q()+Bathj.Q();
617 assert(Sysi.Q()+Bathi.Q()+Sysj.Q()+Bathj.Q() == Symmetry::qvacuum());
619 std::vector<SiteOperator<Symmetry,Scalar>> opRes = std::vector<SiteOperator<Symmetry,Scalar>>(opListWork.begin()+i, opListWork.begin()+j+2);
620 std::vector<typename Symmetry::qType> qRes = std::vector<typename Symmetry::qType>(qListWork.begin()+i, qListWork.begin()+j+3);
622 Mout.push_qpath(i, opRes, qRes, sign);
625 for (
int i=0; i<
F.size(); i+=2)
626 for (
int j=0; j<
F.size(); j+=2)
673 Mout.N_phys =
F.size()/dLphys;
675 Mout.precalc_TwoSiteData(
true);
682template<
typename Symmetry,
typename Scalar>
683template<
typename Dummy>
685c (
size_t locx,
size_t locy,
double factor)
const
687 if constexpr(Dummy::IS_CHARGE_SU2())
700template<
typename Symmetry,
typename Scalar>
701template<SPIN_INDEX sigma,
typename Dummy>
703c (
size_t locx,
size_t locy,
double factor)
const
705 if constexpr(Dummy::IS_CHARGE_SU2())
734template<
typename Symmetry,
typename Scalar>
735template<
typename Dummy>
737cdag (
size_t locx,
size_t locy,
double factor)
const
739 if constexpr(Dummy::IS_CHARGE_SU2())
752template<
typename Symmetry,
typename Scalar>
753template<SPIN_INDEX sigma,
typename Dummy>
755cdag (
size_t locx,
size_t locy,
double factor)
const
757 if constexpr(Dummy::IS_CHARGE_SU2())
770template<
typename Symmetry,
typename Scalar>
773cc (
size_t locx,
size_t locy)
const
778template<
typename Symmetry,
typename Scalar>
781cdagcdag (
size_t locx,
size_t locy)
const
786template<
typename Symmetry,
typename Scalar>
787template<
typename Dummy>
789cdagc (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
791 if constexpr (Dummy::IS_SPIN_SU2() and !Dummy::IS_CHARGE_SU2())
795 else if constexpr (Dummy::IS_SPIN_SU2() and Dummy::IS_CHARGE_SU2())
797 assert(locy1==0 and locy2==0);
800 return make_corr(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);
804 vector<Mpo<Symmetry,Scalar> > out(2);
805 out[0] = cdagc<UP,UP>(locx1,locx2,locy1,locy2);
806 out[1] = cdagc<DN,DN>(locx1,locx2,locy1,locy2);
811template<
typename Symmetry,
typename Scalar>
812template<SPIN_INDEX sigma1, SPIN_INDEX sigma2,
typename Dummy>
814cdagc (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2,
double factor)
const
816 if constexpr (Dummy::ABELIAN)
818 auto Qtot = Symmetry::reduceSilent(
F[locx1].
cdag(sigma1,locy1).Q(),
F[locx2].
c(sigma2,locy2).Q())[0];
819 return make_corr(locx1, locx2, locy1, locy2,
F[locx1].
cdag(sigma1,locy1),
F[locx2].
c(sigma2,locy2), Qtot, 1.*factor,
PROP::FERMIONIC,
PROP::NON_HERMITIAN);
823 assert(locy1==0 and locy2==0);
826 return make_corr(locx1, locx2, locy1, locy2,
F[locx1].
cdag(sigma1,Gx1y1,locy1),
F[locx2].
c(sigma2,Gx2y2,locy2), Symmetry::qvacuum(), std::sqrt(2.)*factor,
PROP::FERMIONIC,
PROP::NON_HERMITIAN);
830template<
typename Symmetry,
typename Scalar>
831template<
typename Dummy>
835 if constexpr (Dummy::ABELIAN)
837 auto Qtot = Symmetry::reduceSilent(
F[locx1].
cdag(sigma1,locy1).Q(),
F[locx2].
c(sigma2,locy2).Q())[0];
838 return make_corr(locx1, locx2, locy1, locy2,
F[locx1].
cdag(sigma1,locy1),
F[locx2].
c(sigma2,locy2), Qtot, 1.*factor,
PROP::FERMIONIC,
PROP::NON_HERMITIAN);
842 assert(locy1==0 and locy2==0);
845 return make_corr(locx1, locx2, locy1, locy2,
F[locx1].
cdag(sigma1,Gx1y1,locy1),
F[locx2].
c(sigma2,Gx2y2,locy2), Symmetry::qvacuum(), std::sqrt(2.)*factor,
PROP::FERMIONIC,
PROP::NON_HERMITIAN);
871template<
typename Symmetry,
typename Scalar>
872template<
typename Dummy>
874cdag_nc (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
876 if constexpr (Dummy::IS_SPIN_SU2() and !Dummy::IS_CHARGE_SU2())
880 assert(locy1 == locy2);
888 else if constexpr (Dummy::IS_SPIN_SU2() and Dummy::IS_CHARGE_SU2())
901template<
typename Symmetry,
typename Scalar>
902template<
typename Dummy>
904cdagn_c (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
906 if constexpr (Dummy::IS_SPIN_SU2() and !Dummy::IS_CHARGE_SU2())
910 assert(locy1 == locy2);
918 else if constexpr (Dummy::IS_SPIN_SU2() and Dummy::IS_CHARGE_SU2())
993template<
typename Symmetry,
typename Scalar>
994template<
typename Dummy>
996cdagc3 (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
998 if constexpr (Dummy::IS_SPIN_SU2() and !Dummy::IS_CHARGE_SU2())
1000 return make_corr(locx1, locx2, locy1, locy2,
F[locx1].
cdag(locy1),
F[locx2].
c(locy2), {3,0}, 1./sqrt(3.),
PROP::FERMIONIC,
PROP::NON_HERMITIAN);
1017template<
typename Symmetry,
typename Scalar>
1018template<SPIN_INDEX sigma1, SPIN_INDEX sigma2,
typename Dummy>
1020cc (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
1022 auto Qtot = Symmetry::reduceSilent(
F[locx1].
c(sigma1,locy1).Q(),
F[locx2].
c(sigma2,locy2).Q())[0];
1023 return make_corr(locx1, locx2, locy1, locy2,
F[locx1].
c(sigma1,locy1),
F[locx2].
c(sigma2,locy2), Qtot, 1.,
PROP::FERMIONIC,
PROP::NON_HERMITIAN);
1026template<
typename Symmetry,
typename Scalar>
1027template<
typename Dummy>
1031 auto Qtot = Symmetry::reduceSilent(
F[locx1].
c(sigma1,locy1).Q(),
F[locx2].
c(sigma2,locy2).Q())[0];
1032 return make_corr(locx1, locx2, locy1, locy2,
F[locx1].
c(sigma1,locy1),
F[locx2].
c(sigma2,locy2), Qtot, 1.,
PROP::FERMIONIC,
PROP::NON_HERMITIAN);
1035template<
typename Symmetry,
typename Scalar>
1036template<SPIN_INDEX sigma1, SPIN_INDEX sigma2,
typename Dummy>
1038cdagcdag (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
1040 auto Qtot = Symmetry::reduceSilent(
F[locx1].
cdag(sigma1,locy1).Q(),
F[locx2].
cdag(sigma2,locy2).Q())[0];
1041 return make_corr(locx1, locx2, locy1, locy2,
F[locx1].
cdag(sigma1,locy1),
F[locx2].
cdag(sigma2,locy2), Qtot, 1.,
PROP::FERMIONIC,
PROP::NON_HERMITIAN);
1044template<
typename Symmetry,
typename Scalar>
1045template<
typename Dummy>
1049 auto Qtot = Symmetry::reduceSilent(
F[locx1].
cdag(sigma1,locy1).Q(),
F[locx2].
cdag(sigma2,locy2).Q())[0];
1050 return make_corr(locx1, locx2, locy1, locy2,
F[locx1].
cdag(sigma1,locy1),
F[locx2].
cdag(sigma2,locy2), Qtot, 1.,
PROP::FERMIONIC,
PROP::NON_HERMITIAN);
1053template<
typename Symmetry,
typename Scalar>
1054template<
typename Dummy>
1056cc3 (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
1058 if constexpr (Dummy::IS_SPIN_SU2())
1061 auto Qtots = Symmetry::reduceSilent(
F[locx1].
c(locy1).Q(),
F[locx2].
c(locy2).Q());
1062 typename Symmetry::qType Qtot;
1063 for (
const auto Q : Qtots) {
if (Q[0] == 3) {Qtot = Q;}}
1068 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.");
1069 vector<Mpo<Symmetry,Scalar> > out(2);
1070 out[0] = cc<UP,DN>(locx1,locx2,locy1,locy2);
1071 out[1] = cc<DN,UP>(locx1,locx2,locy1,locy2);
1076template<
typename Symmetry,
typename Scalar>
1077template<
typename Dummy>
1079cdagcdag3 (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
1081 if constexpr (Dummy::IS_SPIN_SU2())
1084 auto Qtots = Symmetry::reduceSilent(
F[locx1].
cdag(locy1).Q(),
F[locx2].
cdag(locy2).Q());
1085 typename Symmetry::qType Qtot;
1086 for (
const auto Q : Qtots) {
if (Q[0] == 3) {Qtot = Q;}}
1091 static_assert(!Dummy::IS_CHARGE_SU2(),
"cc with a spin-triplet coupling cannot be computed for a charge-SU(2) symmetry. Use U(1) charge symmetry instead.");
1092 vector<Mpo<Symmetry,Scalar> > out(2);
1093 out[0] = cdagcdag<UP,DN>(locx1,locx2,locy1,locy2);
1094 out[1] = cdagcdag<DN,UP>(locx1,locx2,locy1,locy2);
1099template<
typename Symmetry,
typename Scalar>
1100template<
typename Dummy>
1102cc1 (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
1104 if constexpr (Dummy::IS_SPIN_SU2())
1107 auto Qtots = Symmetry::reduceSilent(
F[locx1].
c(locy1).Q(),
F[locx2].
c(locy2).Q());
1108 typename Symmetry::qType Qtot;
1109 for (
const auto Q : Qtots) {
if (Q[0] == 1) {Qtot = Q;}}
1122template<
typename Symmetry,
typename Scalar>
1123template<
typename Dummy>
1125cdagcdag1 (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
1127 if constexpr (Dummy::IS_SPIN_SU2())
1130 auto Qtots = Symmetry::reduceSilent(
F[locx1].
cdag(locy1).Q(),
F[locx2].
cdag(locy2).Q());
1131 typename Symmetry::qType Qtot;
1132 for (
const auto Q : Qtots) {
if (Q[0] == 1) {Qtot = Q;}}
1145template<
typename Symmetry,
typename Scalar>
1146template<
typename Dummy>
1148Stringz (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
1150 assert(locx1<
F.size() and locx2<
F.size());
1152 ss <<
"Sz" <<
"(" << locx1 <<
"," << locy1 <<
"," <<
")"
1153 <<
"Sz" <<
"(" << locx2 <<
"," << locy2 <<
"," <<
")";
1155 auto Sz1 =
F[locx1].Sz(locy1);
1156 auto Sz2 =
F[locx2].Sz(locy2);
1158 auto Qtot = Symmetry::reduceSilent(Sz1.Q(), Sz2.Q())[0];
1160 for (
size_t l=0; l<
F.size(); ++l) {Mout.
setLocBasis(
F[l].get_basis().qloc(),l);}
1166 else if (locx1<locx2)
1168 Mout.
setLocal({locx1,locx2}, {Sz1,Sz2},
F[0].nh()-
F[0].
ns());
1171 else if (locx1>locx2)
1180template<
typename Symmetry,
typename Scalar>
1181template<
typename Dummy>
1183StringzDimer (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
1185 assert(locx1<
F.size() and locx2<
F.size());
1187 ss <<
"Sz" <<
"(" << locx1 <<
"," << locy1 <<
"," <<
")"
1188 <<
"Sz" <<
"(" << locx2 <<
"," << locy2 <<
"," <<
")";
1190 auto Sz1 =
F[locx1].Sz(locy1);
1191 auto Sz2 =
F[locx2].Sz(locy2);
1193 auto Qtot = Symmetry::reduceSilent(Sz1.Q(), Sz2.Q())[0];
1195 for (
size_t l=0; l<
F.size(); ++l) {Mout.
setLocBasis(
F[l].get_basis().qloc(),l);}
1202 else if (locx1<locx2)
1204 Mout.
setLocal({locx1,locx2}, {-pow(-4,(locx2-(locx1-1)-2)/2)*Sz1,Sz2},
F[0].Sz());
1206 else if (locx1>locx2)
1216template<
typename Symmetry,
typename Scalar>
1217template<
class Dummy>
1219d (
size_t locx,
size_t locy)
const
1224template<
typename Symmetry,
typename Scalar>
1225template<
class Dummy>
1229 for (
size_t l=0; l<
F.size(); ++l) {assert(
F[l].orbitals()==1);}
1234 for (
size_t l=0; l<
F.size(); ++l) {Mout.
setLocBasis(
F[l].get_basis().qloc(),l);}
1240template<
typename Symmetry,
typename Scalar>
1241template<SPIN_INDEX sigma,
typename Dummy>
1243n (
size_t locx,
size_t locy)
const
1248template<
typename Symmetry,
typename Scalar>
1249template<
typename Dummy>
1251n (
size_t locx,
size_t locy)
const
1256template<
typename Symmetry,
typename Scalar>
1257template<
typename Dummy>
1259T (
size_t locx,
size_t locy,
double factor)
const
1264template<
typename Symmetry,
typename Scalar>
1265template<
typename Dummy>
1267Tdag (
size_t locx,
size_t locy,
double factor)
const
1272template<
typename Symmetry,
typename Scalar>
1273template<
typename Dummy>
1275Tz (
size_t locx,
size_t locy)
const
1280template<
typename Symmetry,
typename Scalar>
1281template<
typename Dummy>
1283Tx (
size_t locx,
size_t locy)
const
1290template<
typename Symmetry,
typename Scalar>
1291template<
typename Dummy>
1293iTy (
size_t locx,
size_t locy)
const
1300template<
typename Symmetry,
typename Scalar>
1301template<
typename Dummy>
1303Tm (
size_t locx,
size_t locy)
const
1310template<
typename Symmetry,
typename Scalar>
1311template<
typename Dummy>
1313Tp (
size_t locx,
size_t locy)
const
1320template<
typename Symmetry,
typename Scalar>
1321template<
typename Dummy>
1323TpTm (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2,
double fac)
const
1327 assert(locy1==0 and locy2==0);
1328 return make_corr(locx1,locx2,locy1,locy2, fac*
F[locx1].
Tp(locy1,
G[locx1]),
F[locx2].
Tm(locy2,
G[locx2]), Symmetry::qvacuum(), 1.,
PROP::NON_FERMIONIC,
PROP::NON_HERMITIAN);
1331template<
typename Symmetry,
typename Scalar>
1332template<
typename Dummy>
1334TmTp (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2,
double fac)
const
1338 assert(locy1==0 and locy2==0);
1339 return make_corr(locx1,locx2,locy1,locy2, fac*
F[locx1].
Tm(locy1,
G[locx1]),
F[locx2].
Tp(locy2,
G[locx2]), Symmetry::qvacuum(), 1.,
PROP::NON_FERMIONIC,
PROP::NON_HERMITIAN);
1342template<
typename Symmetry,
typename Scalar>
1343template<
typename Dummy>
1345TzTz (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
1350template<
typename Symmetry,
typename Scalar>
1351template<
typename Dummy>
1353TdagT (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
1355 if constexpr (Symmetry::IS_CHARGE_SU2())
1362 vector<Mpo<Symmetry,Scalar> > out(3);
1363 out[0] =
TzTz(locx1,locx2,locy1,locy2);
1364 out[1] =
TpTm(locx1,locx2,locy1,locy2,0.5);
1365 out[2] =
TmTp(locx1,locx2,locy1,locy2,0.5);
1370template<
typename Symmetry,
typename Scalar>
1372ns (
size_t locx,
size_t locy)
const
1377template<
typename Symmetry,
typename Scalar>
1379nh (
size_t locx,
size_t locy)
const
1384template<
typename Symmetry,
typename Scalar>
1386nssq (
size_t locx,
size_t locy)
const
1391template<
typename Symmetry,
typename Scalar>
1393nhsq (
size_t locx,
size_t locy)
const
1398template<
typename Symmetry,
typename Scalar>
1399template<SPIN_INDEX sigma1, SPIN_INDEX sigma2,
typename Dummy>
1401nn (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
1403 return make_corr (locx1, locx2, locy1, locy2,
F[locx1].
n(sigma1,locy1),
F[locx2].
n(sigma2,locy2), Symmetry::qvacuum(), 1.,
PROP::BOSONIC,
PROP::HERMITIAN);
1406template<
typename Symmetry,
typename Scalar>
1408nn (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
1413template<
typename Symmetry,
typename Scalar>
1414template<
typename Dummy>
1416hh (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
1418 return make_corr(locx1,locx2,locy1,locy2,
1419 F[locx1].
d(locy1)-
F[locx1].
n(locy1)+
F[locx1].
Id(),
1420 F[locx2].
d(locy2)-
F[locx2].
n(locy2)+
F[locx2].
Id(),
1424template<
typename Symmetry,
typename Scalar>
1425template<
typename Dummy>
1429 bool HERMITIAN = (Sa==
SX or Sa==
SZ)?
true:
false;
1433template<
typename Symmetry,
typename Scalar>
1434template<
typename Dummy>
1436exp_ipiSz (
size_t locx,
size_t locy,
double factor)
const
1438 bool HERMITIAN =
false;
1441 assert(locx<
F.size() and locy<
F[locx].dim());
1443 ss <<
F[locx].exp_ipiSz(locy).label() <<
"(" << locx <<
"," << locy;
1444 if (factor != 1.) ss <<
",factor=" << factor;
1448 for (
size_t l=0; l<
F.size(); ++l) Mout.
setLocBasis(
F[l].get_basis().qloc(),l);
1450 Mout.
setLocal(locx, (factor *
F[locx].
exp_ipiSz(locy)).
template plain<complex<double> >().
template cast<complex<double> >());
1455template<
typename Symmetry,
typename Scalar>
1456template<
typename Dummy>
1460 vector<OperatorType> Ops(
F.size());
1461 vector<Scalar> factors(
F.size());
1462 for (
int l=0; l<
F.size(); ++l)
1464 Ops[l] =
F[l].Scomp(Sa,locy);
1467 for (
int l=0; l<
F.size(); l+=dLphys)
1469 factors[l] = factor;
1474template<
typename Symmetry,
typename Scalar>
1475template<
typename Dummy>
1482 ss <<
"exp[2Ï€" << Sa <<
"(" << locx <<
"," << locy <<
")]";
1486 ss <<
"exp[2Ï€i" << Sa <<
"(" << locx <<
"," << locy <<
")]";
1489 auto Op =
F[locx].Rcomp(Sa,locy).template plain<complex<double> >();
1492 for (
size_t l=0; l<
F.size(); ++l) {Mout.setLocBasis(
F[l].get_basis().qloc(),l);}
1494 Mout.setLocal(locx, Op);
1499template<
typename Symmetry,
typename Scalar>
1500template<
typename Dummy>
1504 return make_corr(locx1,locx2,locy1,locy2,
F[locx1].
Scomp(Sa1,locy1),
F[locx2].
Scomp(Sa2,locy2),
getQ_ScompScomp(Sa1,Sa2), fac,
PROP::NON_FERMIONIC,
PROP::HERMITIAN);
1507template<
typename Symmetry,
typename Scalar>
1508template<
typename Dummy>
1510S (
size_t locx,
size_t locy,
double factor)
const
1515template<
typename Symmetry,
typename Scalar>
1516template<
typename Dummy>
1518Sdag (
size_t locx,
size_t locy,
double factor)
const
1523template<
typename Symmetry,
typename Scalar>
1524template<
typename Dummy>
1526Stot (
size_t locy,
double factor,
int dLphys)
const
1528 vector<OperatorType> Ops(
F.size());
1529 vector<double> factors(
F.size());
1530 for (
int l=0; l<
F.size(); ++l)
1532 Ops[l] =
F[l].S(locy);
1535 for (
int l=0; l<
F.size(); l+=dLphys)
1537 factors[l] = factor;
1542template<
typename Symmetry,
typename Scalar>
1543template<
typename Dummy>
1545Sdagtot (
size_t locy,
double factor,
int dLphys)
const
1547 vector<OperatorType> Ops(
F.size());
1548 vector<double> factors(
F.size());
1549 for (
int l=0; l<
F.size(); ++l)
1551 Ops[l] =
F[l].Sdag(locy);
1554 for (
int l=0; l<
F.size(); l+=dLphys)
1556 factors[l] = factor;
1561template<
typename Symmetry,
typename Scalar>
1562template<
typename Dummy>
1564Sz (
size_t locx,
size_t locy)
const
1569template<
typename Symmetry,
typename Scalar>
1570template<
typename Dummy>
1572SdagS (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
1574 if constexpr (Symmetry::IS_SPIN_SU2())
1581 vector<Mpo<Symmetry,Scalar> > out(3);
1582 out[0] =
SzSz(locx1,locx2,locy1,locy2);
1583 out[1] =
SpSm(locx1,locx2,locy1,locy2,0.5);
1584 out[2] =
SmSp(locx1,locx2,locy1,locy2,0.5);
1589template<
typename Symmetry,
typename Scalar>
1590template<
typename Dummy>
1592S_ky (vector<complex<double> > phases)
const
1594 vector<OperatorType> Ops(
F.size());
1595 for (
size_t l=0; l<
F.size(); ++l)
1602template<
typename Symmetry,
typename Scalar>
1603template<
typename Dummy>
1605Sdag_ky (vector<complex<double> > phases,
double factor)
const
1607 vector<OperatorType> Ops(
F.size());
1608 for (
size_t l=0; l<
F.size(); ++l)
1610 Ops[l] =
F[l].Sdag(0);
1615template<
typename Symmetry,
typename Scalar>
1616template<
typename Dummy>
1618T_ky (vector<complex<double> > phases)
const
1620 vector<OperatorType> Ops(
F.size());
1621 for (
size_t l=0; l<
F.size(); ++l)
1628template<
typename Symmetry,
typename Scalar>
1629template<
typename Dummy>
1631Tdag_ky (vector<complex<double> > phases,
double factor)
const
1633 vector<OperatorType> Ops(
F.size());
1634 for (
size_t l=0; l<
F.size(); ++l)
1636 Ops[l] =
F[l].Tdag(0);
1641template<
typename Symmetry,
typename Scalar>
1642template<
typename Dummy>
1643typename std::enable_if<Dummy::IS_SPIN_SU2() and !Dummy::IS_CHARGE_SU2(),
Mpo<Symmetry,complex<
double> > >::type
HubbardObservables<Symmetry,Scalar>::
1644c_ky (vector<complex<
double> > phases,
double factor)
const
1646 vector<OperatorType> Ops(
F.size());
1647 for (
size_t l=0; l<
F.size(); ++l)
1654template<
typename Symmetry,
typename Scalar>
1655template<
typename Dummy>
1656typename std::enable_if<Dummy::IS_SPIN_SU2() and !Dummy::IS_CHARGE_SU2(),
Mpo<Symmetry,complex<
double> > >::type
HubbardObservables<Symmetry,Scalar>::
1657cdag_ky (vector<complex<
double> > phases,
double factor)
const
1659 vector<OperatorType> Ops(
F.size());
1660 for (
size_t l=0; l<
F.size(); ++l)
1662 Ops[l] =
F[l].cdag(0);
1667template<
typename Symmetry,
typename Scalar>
1670 typename Symmetry::qType out;
1671 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();}
1672 else {assert(
false and
"Quantumnumber for the chosen ScompScomp is not computed. Add in HubbardObservables::getQ_ScompScomp");}
1676template<
typename Symmetry,
typename Scalar>
1677template<
typename Dummy>
1678typename std::enable_if<Dummy::IS_SPIN_SU2() and !Dummy::IS_CHARGE_SU2(),
Mpo<Symmetry,Scalar> >::type
HubbardObservables<Symmetry,Scalar>::
1679P (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
1682 auto ntot =
sum(
n(locx1,locy1),
1684 auto hopping =
sum(
cdagc(locx1,locx2,locy1,locy2),
1685 cdagc(locx2,locx1,locy2,locy1));
1687 auto spin_exchange =
SdagS(locx1,locx2,locy1,locy2); spin_exchange.scale(-2.);
1688 auto dtot =
sum(
d(locx1,locy1),
d(locx2,locy2));
1689 auto density_density =
nn(locx1,locx2,locy1,locy2); density_density.scale(0.5);
1691 auto correlated_hopping1 =
sum(
cdagn_c(locx1,locx2,locy1,locy2),
1692 cdag_nc(locx2,locx1,locy2,locy1));
1693 auto correlated_hopping2 =
sum(
cdag_nc(locx1,locx2,locy1,locy2),
1694 cdagn_c(locx2,locx1,locy2,locy1));
1699 res =
sum(res,hopping);
1700 res =
sum(res,spin_exchange);
1701 res =
sum(res,density_density);
1702 res =
sum(res,pair_hopping);
1704 res =
diff(res,ntot);
1705 res =
diff(res,correlated_hopping1);
1706 res =
diff(res,correlated_hopping2);
1711template<
typename Symmetry,
typename Scalar>
1712template<
typename Dummy>
1714P (
size_t locx1,
size_t locx2,
size_t locy1,
size_t locy2)
const
1717 res_up =
diff(res_up,n<UP>(locx1,locy1));
1718 res_up =
diff(res_up,n<UP>(locx2,locy2));
1719 res_up =
sum(res_up,cdagc<UP,UP>(locx1,locx2,locy1,locy2));
1720 if (!Dummy::IS_CHARGE_SU2())
1722 res_up =
sum(res_up,cdagc<UP,UP>(locx2,locx1,locy2,locy1));
1726 res_dn =
diff(res_dn,n<DN>(locx1,locy1));
1727 res_dn =
diff(res_dn,n<DN>(locx2,locy2));
1728 res_dn =
sum(res_dn,cdagc<DN,DN>(locx1,locx2,locy1,locy2));
1729 if (!Dummy::IS_CHARGE_SU2())
1731 res_dn =
sum(res_dn,cdagc<DN,DN>(locx2,locx1,locy2,locy1));
1734 return prod(res_up,res_dn);
External functions to manipulate Mps and Mpo objects.
Hamiltonian sum(const Hamiltonian &H1, const Hamiltonian &H2, DMRG::VERBOSITY::OPTION VERBOSITY=DMRG::VERBOSITY::SILENT)
Hamiltonian prod(const Hamiltonian &H1, const Hamiltonian &H2, const qarray< Hamiltonian::Symmetry::Nq > &Qtot=Hamiltonian::Symmetry::qvacuum(), DMRG::VERBOSITY::OPTION VERBOSITY=DMRG::VERBOSITY::SILENT)
Mpo< Symmetry, Scalar > diff(const Mpo< Symmetry, Scalar > &H1, const Mpo< Symmetry, Scalar > &H2, DMRG::VERBOSITY::OPTION VERBOSITY=DMRG::VERBOSITY::SILENT)
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, Scalar > >::type hh(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type StringCorrSz(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type Stringz(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
Mpo< Symmetry, Scalar > make_corr(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
std::enable_if< Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type S(size_t locx, size_t locy=0, double factor=1.) const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, Scalar > >::type dtot() const
std::enable_if< Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, Scalar > >::type T(size_t locx, size_t locy=0, double factor=1.) const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, Scalar > >::type d(size_t locx, size_t locy=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type ScompScomp(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, Scalar > >::type SpSm(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0, double fac=1.) const
SiteOperatorQ< Symmetry, Eigen::MatrixXd > OperatorType
std::enable_if< Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, complex< double > > >::type Tdag_ky(vector< complex< double > > phases, double factor=sqrt(3.)) const
std::conditional< Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar >, vector< Mpo< Symmetry, Scalar > > >::type cc1(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::conditional< Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar >, vector< Mpo< Symmetry, Scalar > > >::type cdag_nc(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if< Dummy::ABELIAN, Mpo< Symmetry, Scalar > >::type cc(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type cdagc(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0, double factor=1.) const
std::enable_if< Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, Scalar > >::type Tdag(size_t locx, size_t locy=0, double factor=std::sqrt(3.)) const
std::conditional< Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar >, vector< Mpo< Symmetry, Scalar > > >::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, complex< double > > >::type Rcomp(SPINOP_LABEL Sa, size_t locx, size_t locy=0) const
std::enable_if< Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type c(size_t locx, size_t locy=0, double factor=1.) const
std::enable_if< Dummy::NO_CHARGE_SYM(), Mpo< Symmetry, Scalar > >::type iTy(size_t locx, size_t locy=0) const
Mpo< Symmetry, Scalar > nssq(size_t locx, size_t locy=0) const
std::enable_if< Dummy::IS_SPIN_SU2() and!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, Scalar > >::type P(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
Mpo< Symmetry, Scalar > nh(size_t locx, size_t locy=0) const
Mpo< Symmetry, Scalar > ns(size_t locx, size_t locy=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type Sz(size_t locx, size_t locy=0) const
std::enable_if< Dummy::ABELIAN, Mpo< Symmetry, Scalar > >::type cdagcdag(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::conditional< Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar >, vector< Mpo< Symmetry, Scalar > > >::type cdagcdag1(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type Scomptot(SPINOP_LABEL Sa, size_t locy=0, double factor=1., int dLphys=1) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type StringzDimer(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type SmSp(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, complex< double > > >::type S_ky(vector< complex< double > > phases) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type Sp(size_t locx, size_t locy=0) const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, Scalar > >::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, Scalar > >::type StringCorrSpin(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
Mpo< Symmetry, Scalar > make_local(size_t locx, size_t locy, const OperatorType &Op, double factor=1., bool FERMIONIC=false, bool HERMITIAN=false) 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, Scalar >, vector< Mpo< Symmetry, Scalar > > >::type cdagc(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if< Dummy::NO_CHARGE_SYM(), Mpo< Symmetry, Scalar > >::type Tx(size_t locx, size_t locy=0) const
Mpo< Symmetry, Scalar > Id() const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, Scalar > >::type TzTz(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, Scalar > >::type Tm(size_t locx, size_t locy=0) const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, Scalar > >::type n(size_t locx, size_t locy=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry, complex< double > > >::type exp_ipiSz(size_t locx, size_t locy=0, double factor=1.) const
Mpo< Symmetry, complex< double > > make_FourierYSum(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, Scalar > >::type Stot(size_t locy, double factor, int dLphys) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type SzSz(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type Sm(size_t locx, size_t locy=0) const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, Scalar > >::type TpTm(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, Scalar > >::type Sdagtot(size_t locy, double factor, int dLphys) const
std::enable_if< Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type StringCorrId(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, Scalar > >::type cc(size_t locx, size_t locy=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type Scomp(SPINOP_LABEL Sa, size_t locx, size_t locy=0, double factor=1.) const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, Scalar > >::type Tz(size_t locx, size_t locy=0) const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, Scalar > >::type cdagcdag(size_t locx, size_t locy=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type n(size_t locx, size_t locy=0) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type c(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, Scalar > >::type cdagc(SPIN_INDEX sigma1, SPIN_INDEX sigma2, size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0, double factor=1.) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type nn(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
Mpo< Symmetry, Scalar > make_localSum(const vector< OperatorType > &Op, vector< double > factor, bool HERMITIAN) const
vector< FermionBase< Symmetry > > F
std::enable_if< Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type cdag(size_t locx, size_t locy=0, double factor=std::sqrt(2.)) const
std::conditional< Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar >, vector< Mpo< Symmetry, Scalar > > >::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, Scalar > >::type Sdag(size_t locx, size_t locy=0, double factor=std::sqrt(3.)) const
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type cdag(size_t locx, size_t locy=0, double factor=1.) const
std::enable_if< Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type CanonicalEntangler(int dLphys, double factor=1.) const
std::enable_if< Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar > >::type StringCorrTz(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
HubbardObservables(const size_t &L)
std::enable_if< Dummy::IS_SPIN_SU2(), Mpo< Symmetry, complex< double > > >::type Sdag_ky(vector< complex< double > > phases, double factor=sqrt(3.)) const
std::conditional< Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar >, vector< Mpo< Symmetry, Scalar > > >::type cdagn_c(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
HubbardObservables(const size_t &L, const vector< Param > ¶ms, const std::map< string, std::any > &defaults)
std::conditional< Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, Scalar >, vector< Mpo< Symmetry, Scalar > > >::type TdagT(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::conditional< Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar >, vector< Mpo< Symmetry, Scalar > > >::type cdagc3(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
Mpo< Symmetry, Scalar > 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
std::conditional< Dummy::IS_SPIN_SU2(), Mpo< Symmetry, Scalar >, vector< Mpo< Symmetry, Scalar > > >::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, Scalar > >::type StringCorrTpm(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
Mpo< Symmetry, Scalar > nhsq(size_t locx, size_t locy=0) const
std::enable_if< Dummy::ABELIAN, Mpo< Symmetry, Scalar > >::type cc(SPIN_INDEX sigma1, SPIN_INDEX sigma2, size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo< Symmetry, Scalar > >::type Tp(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, Scalar > >::type cdagcdag(SPIN_INDEX sigma1, SPIN_INDEX sigma2, size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
void finalize(const bool COMPRESS=true, const std::size_t power=1, const double tolerance=::mynumeric_limits< double >::epsilon())
void setLocBasis(const std::vector< std::vector< qType > > &q)
void setLocal(std::size_t loc, const OperatorType &op)
void setLocalSum(const OperatorType &op, Scalar(*f)(int)=localSumTrivial)
void precalc_TwoSiteData(bool FORCE=false)
void push_qpath(const std::size_t loc, const std::vector< OperatorType > &opList, const std::vector< qType > &qList, const Scalar lambda=1.0)
static SiteOperatorQ< Symmetry, MatrixType_ > prod(const SiteOperatorQ< Symmetry, MatrixType_ > &O1, const SiteOperatorQ< Symmetry, MatrixType_ > &O2, const qType &target)