VMPS++
Loading...
Searching...
No Matches
HubbardObservables.h
Go to the documentation of this file.
1#ifndef HUBBARDOBSERVABLES
2#define HUBBARDOBSERVABLES
3
4#include "bases/FermionBase.h"
5#include "Mpo.h"
6#include "ParamHandler.h" // from HELPERS
7
8#include "DmrgLinearAlgebra.h" // is needed for P operator
9//include "DmrgExternal.h"
10//include "tensors/SiteOperator.h"
11
12template<typename Symmetry, typename Scalar=double>
14{
15// typedef SiteOperatorQ<Symmetry,Eigen::Matrix<Scalar,Dynamic,Dynamic>> OperatorType;
17
18public:
19
22 HubbardObservables (const size_t &L); // for inheritance purposes
23 HubbardObservables (const size_t &L, const vector<Param> &params, const std::map<string,std::any> &defaults);
25
29
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;
33
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;
36
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;
39
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;
43
45 template<class Dummy = Symmetry>
46 typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,Scalar> >::type cc (size_t locx, size_t locy=0) const;
47
48 template<class Dummy = Symmetry>
49 typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,Scalar> >::type cdagcdag (size_t locx, size_t locy=0) const;
50
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;
53
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;
56
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;
59
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;
62
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;
65
66 template<typename Dummy = Symmetry>
67 typename 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;
68
69// template<typename Dummy = Symmetry>
70// typename 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) const;
71
72 // Mpo<Symmetry,Scalar> triplet (size_t locx, size_t locy=0) const;
74
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;
77
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;
80
81// template<SPIN_INDEX sigma1, SPIN_INDEX sigma2, SPIN_INDEX sigma3, SPIN_INDEX sigma4, typename Dummy = Symmetry>
82// typename std::enable_if<Dummy::ABELIAN,Mpo<Symmetry,Scalar> >::type cdagcdagcc (size_t locx1, size_t locx2, size_t locx3, size_t locx4,
83// size_t locy1=0, size_t locy2=0, size_t locy3=0, size_t locy4=0) const;
84
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;
87
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;
90
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;
94
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;
98
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;
102
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;
106
107 template<class Dummy = Symmetry>
108 typename 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;
109
110 template<class Dummy = Symmetry>
111 typename 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;
112
113 template<class Dummy = Symmetry>
114 typename 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;
115
116 template<class Dummy = Symmetry>
117 typename 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;
118
119 template<class Dummy = Symmetry>
120 typename 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;
121
123 template<class Dummy = Symmetry>
124 typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,Scalar> >::type d (size_t locx, size_t locy=0) const;
125 template<class Dummy = Symmetry>
126 typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,Scalar> >::type dtot() const;
127 Mpo<Symmetry,Scalar> ns (size_t locx, size_t locy=0) const;
128 Mpo<Symmetry,Scalar> nh (size_t locx, size_t locy=0) const;
129 Mpo<Symmetry,Scalar> nssq (size_t locx, size_t locy=0) const;
130 Mpo<Symmetry,Scalar> nhsq (size_t locx, size_t locy=0) const;
131
132 template<SPIN_INDEX sigma, typename Dummy = Symmetry>
133 typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type n (size_t locx, size_t locy=0) const;
134
135 template<class Dummy = Symmetry>
136 typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,Scalar> >::type n (size_t locx, size_t locy=0) const;
137
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;
140
141 Mpo<Symmetry,Scalar> 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;
145
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>
152 typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry,Scalar> >::type Tp (size_t locx, size_t locy=0) const;
153 template<typename Dummy = Symmetry>
154 typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry,Scalar> >::type Tm (size_t locx, size_t locy=0) const;
155 template<typename Dummy = Symmetry>
156 typename std::enable_if<Dummy::NO_CHARGE_SYM(), Mpo<Symmetry,Scalar> >::type Tx (size_t locx, size_t locy=0) const;
157 template<typename Dummy = Symmetry>
158 typename std::enable_if<Dummy::NO_CHARGE_SYM(), Mpo<Symmetry,Scalar> >::type iTy (size_t locx, size_t locy=0) const;
159 template<typename Dummy = Symmetry>
160 typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry,Scalar> >::type Tz (size_t locx, size_t locy=0) const;
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;
170
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>
177 typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry,Scalar> >::type Stot (size_t locy, double factor, int dLphys) const;
178 template<typename Dummy = Symmetry>
179 typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry,Scalar> >::type Sdagtot (size_t locy, double factor, int dLphys) const;
180 template<typename Dummy = Symmetry>
181 typename 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;
182 template<typename Dummy = Symmetry>
183 typename 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;
184 template<typename Dummy = Symmetry>
185 typename 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;
186 template<typename Dummy = Symmetry>
187 typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry,Scalar> >::type Sz (size_t locx, size_t locy=0) const;
188 template<typename Dummy = Symmetry>
189 typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry,Scalar> >::type Sp (size_t locx, size_t locy=0) const {return Scomp(SP,locx,locy);};
190 template<typename Dummy = Symmetry>
191 typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry,Scalar> >::type Sm (size_t locx, size_t locy=0) const {return Scomp(SM,locx,locy);};
192 template<typename Dummy = Symmetry>
193 typename 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;
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;
202
204 template<class Dummy = Symmetry>
205 typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry,Scalar> >::type CanonicalEntangler (int dLphys, double factor=1.) const;
206 template<class Dummy = Symmetry>
207 typename std::enable_if<Dummy::IS_SPIN_U1(), Mpo<Symmetry,Scalar> >::type CanonicalEntangler (int dLphys, double factor=1.) const;
208 template<typename Dummy = Symmetry>
209 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;
211
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>
216 typename 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;
218
220 template<typename Dummy = Symmetry>
221 typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,complex<double> > >::type S_ky (vector<complex<double> > phases) const;
222 template<typename Dummy = Symmetry>
223 typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,complex<double> > >::type Sdag_ky (vector<complex<double> > phases, double factor=sqrt(3.)) const;
224 template<typename Dummy = Symmetry>
225 typename std::enable_if<Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,complex<double> > >::type T_ky (vector<complex<double> > phases) const;
226 template<typename Dummy = Symmetry>
227 typename std::enable_if<Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,complex<double> > >::type Tdag_ky (vector<complex<double> > phases, double factor=sqrt(3.)) const;
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;
233
234 // Fermionic permutation operators
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;
238
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;
242
243protected:
244
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;
246 Mpo<Symmetry,Scalar> make_localSum (const vector<OperatorType> &Op, vector<double> factor, bool HERMITIAN) const;
247 Mpo<Symmetry,Scalar> make_corr (size_t locx1, size_t locx2, size_t locy1, size_t locy2,
248 const OperatorType &Op1, const OperatorType &Op2, qarray<Symmetry::Nq> Qtot,
249 double factor, bool FERMIONIC, bool HERMITIAN) const;
250
251 Mpo<Symmetry,complex<double> >
252 make_FourierYSum (string name, const vector<OperatorType> &Ops, double factor, bool HERMITIAN, const vector<complex<double> > &phases) const;
253
254 typename Symmetry::qType getQ_ScompScomp(SPINOP_LABEL Sa1, SPINOP_LABEL Sa2) const;
255
256 vector<FermionBase<Symmetry> > F;
257 vector<SUB_LATTICE> G;
258};
259
260template<typename Symmetry, typename Scalar>
261HubbardObservables<Symmetry,Scalar>::
262HubbardObservables (const size_t &L)
263{
264 F.resize(L);
265}
266
267template<typename Symmetry, typename Scalar>
269HubbardObservables (const size_t &L, const vector<Param> &params, const std::map<string,std::any> &defaults)
270{
271 ParamHandler P(params,defaults);
272 size_t Lcell = P.size();
273 F.resize(L);
274
275 for (size_t l=0; l<L; ++l)
276 {
277 F[l] = FermionBase<Symmetry>(P.get<size_t>("Ly",l%Lcell),
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));
284 }
285
286 G.resize(L);
287 if (P.HAS("G")) {G = P.get<vector<SUB_LATTICE> >("G");}
288 else // set default (-1)^l
289 {
290 G[0] = static_cast<SUB_LATTICE>(1);
291 for (int l=1; l<L; l+=1) G[l] = static_cast<SUB_LATTICE>(-1*G[l-1]);
292 }
293}
294
295//-------------
296
297template<typename Symmetry, typename Scalar>
299make_local (size_t locx, size_t locy, const OperatorType &Op, double factor, bool FERMIONIC, bool HERMITIAN) const
300{
301 assert(locx<F.size() and locy<F[locx].dim());
302 stringstream ss;
303 ss << Op.label() << "(" << locx << "," << locy;
304 if (factor != 1.) ss << ",factor=" << factor;
305 ss << ")";
306
307 Mpo<Symmetry,Scalar> Mout(F.size(), Op.Q(), ss.str(), HERMITIAN);
308 for (size_t l=0; l<F.size(); ++l) Mout.setLocBasis(F[l].get_basis().qloc(),l);
309
310 if (FERMIONIC)
311 {
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>();}
314
315 Mout.setLocal(locx, (factor * Op).template plain<double>().template cast<Scalar>(), Signs);
316 }
317 else
318 {
319 Mout.setLocal(locx, (factor * Op).template plain<double>().template cast<Scalar>());
320 }
321
322 return Mout;
323}
324
325template<typename Symmetry, typename Scalar>
327make_localSum (const vector<OperatorType> &Op, vector<double> factor, bool HERMITIAN) const
328{
329 assert(Op.size()==F.size() and factor.size()==F.size());
330 stringstream ss;
331 ss << Op[0].label() << "localSum";
332
333 Mpo<Symmetry,Scalar> Mout(F.size(), Op[0].Q(), ss.str(), HERMITIAN);
334 for (size_t l=0; l<F.size(); ++l) {Mout.setLocBasis(F[l].get_basis().qloc(),l);}
335
336 vector<SiteOperator<Symmetry,Scalar>> Op_plain;
337 for (int i=0; i<Op.size(); ++i)
338 {
339 Op_plain.push_back(Op[i].template plain<double>().template cast<Scalar>());
340 }
341 vector<Scalar> factor_cast(factor.size());
342 for (int l=0; l<factor.size(); ++l)
343 {
344 factor_cast[l] = static_cast<Scalar>(factor[l]);
345 }
346 Mout.setLocalSum(Op_plain, factor_cast);
347
348 return Mout;
349}
350
351template<typename Symmetry, typename Scalar>
353make_corr (size_t locx1, size_t locx2, size_t locy1, size_t locy2,
354 const OperatorType &Op1, const OperatorType &Op2,
356 double factor, bool FERMIONIC, bool HERMITIAN) const
357{
358 assert(locx1<F.size() and locy1<F[locx1].dim());
359 assert(locx2<F.size() and locy2<F[locx2].dim());
360
361 stringstream ss;
362 ss << Op1.label() << "(" << locx1 << "," << locy1 << ")"
363 << Op2.label() << "(" << locx2 << "," << locy2 << ")";
364
365 Mpo<Symmetry,Scalar> Mout(F.size(), Qtot, ss.str(), HERMITIAN);
366 for (size_t l=0; l<F.size(); ++l) {Mout.setLocBasis(F[l].get_basis().qloc(),l);}
367
368 if (FERMIONIC)
369 {
370 if (locx1 == locx2)
371 {
372 Mout.setLocal(locx1, factor * OperatorType::prod(Op1,Op2,Qtot).template plain<double>().template cast<Scalar>());
373 }
374 else if (locx1<locx2)
375 {
376 vector<SiteOperator<Symmetry,Scalar> > Signs;
377 for (size_t l=locx1+1; l<locx2; ++l)
378 {
379 Signs.push_back(F[l].sign().template plain<double>().template cast<Scalar>());
380 }
381
382// Mout.setLocal({locx1, locx2}, {(factor * (Op1 * F[locx1].sign())).template plain<double>().template cast<Scalar>(),
383// Op2.template plain<double>().template cast<Scalar>()},
384// F[0].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>()},
387 Signs);
388 }
389 else if (locx1>locx2)
390 {
391 vector<SiteOperator<Symmetry,Scalar> > Signs;
392 for (size_t l=locx2+1; l<locx1; ++l)
393 {
394 Signs.push_back(F[l].sign().template plain<double>().template cast<Scalar>());
395 }
396
397// Mout.setLocal({locx2, locx1}, {(factor * (Op2 * F[locx2].sign())).template plain<double>().template cast<Scalar>(),
398// -Symmetry::spinorFactor() * Op1.template plain<double>().template cast<Scalar>()},
399// F[0].sign().template plain<double>().template cast<Scalar>());
400
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>()},
403 Signs);
404 }
405 }
406 else
407 {
408 if (locx1 == locx2)
409 {
410 auto product = factor * OperatorType::prod(Op1, Op2, Qtot);
411 Mout.setLocal(locx1, product.template plain<double>().template cast<Scalar>());
412 }
413 else
414 {
415 Mout.setLocal({locx1, locx2}, {(factor*Op1).template plain<double>().template cast<Scalar>(),
416 Op2.template plain<double>().template cast<Scalar>()});
417 }
418 }
419 return Mout;
420}
421
422template<typename Symmetry, typename Scalar>
424make_FourierYSum (string name, const vector<OperatorType> &Ops,
425 double factor, bool HERMITIAN, const vector<complex<double> > &phases) const
426{
427 stringstream ss;
428 ss << name << "_ky(";
429 for (int l=0; l<phases.size(); ++l)
430 {
431 ss << phases[l];
432 if (l!=phases.size()-1) {ss << ",";}
433 else {ss << ")";}
434 }
435
436 // all Ops[l].Q() must match
437 Mpo<Symmetry,complex<double> > Mout(F.size(), Ops[0].Q(), ss.str(), HERMITIAN);
438 for (size_t l=0; l<F.size(); ++l) {Mout.setLocBasis(F[l].get_basis().qloc(),l);}
439
440 vector<complex<double> > phases_x_factor = phases;
441 for (int l=0; l<phases.size(); ++l)
442 {
443 phases_x_factor[l] = phases[l] * factor;
444 }
445
446 vector<SiteOperator<Symmetry,complex<double> > > OpsPlain(Ops.size());
447 for (int l=0; l<OpsPlain.size(); ++l)
448 {
449 OpsPlain[l] = Ops[l].template plain<double>().template cast<complex<double> >();
450 }
451
452 Mout.setLocalSum(OpsPlain, phases_x_factor);
453
454 return Mout;
455}
456
457template<typename Symmetry, typename Scalar>
459Id () const
460{
461 return make_local(0,0, F[0].Id(), 1., PROP::BOSONIC, PROP::HERMITIAN);
462}
463
464template<typename Symmetry, typename Scalar>
465template<typename Dummy>
466typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
467StringCorrSpin (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
468{
469 return make_corr(locx1, locx2, locy1, locy2, F[locx1].Sdag(locy1), F[locx2].S(locy2), Symmetry::qvacuum(), +1., true, false); // FERMIONIC=true!
470}
471
472template<typename Symmetry, typename Scalar>
473template<typename Dummy>
474typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
475StringCorrTpm (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
476{
477 return make_corr(locx1, locx2, locy1, locy2, F[locx1].Tp(locy1), F[locx2].Tm(locy2), Symmetry::qvacuum(), +1., true, false); // FERMIONIC=true!
478}
479
480template<typename Symmetry, typename Scalar>
481template<typename Dummy>
482typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
483StringCorrTz (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
484{
485 return make_corr(locx1, locx2, locy1, locy2, F[locx1].Tz(locy1), F[locx2].Tz(locy2), Symmetry::qvacuum(), +1., true, false); // FERMIONIC=true!
486}
487
488template<typename Symmetry, typename Scalar>
489template<typename Dummy>
490typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
491StringCorrId (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
492{
493 return make_corr(locx1, locx2, locy1, locy2, F[locx1].Id(locy1), F[locx2].Id(locy2), Symmetry::qvacuum(), +1., true, false); // FERMIONIC=true!
494}
495
496template<typename Symmetry, typename Scalar>
497template<typename Dummy>
498typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
499StringCorrSz (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
500{
501 return make_corr(locx1, locx2, locy1, locy2, F[locx1].Sz(locy1), F[locx2].Sz(locy2), Symmetry::qvacuum(), +1., true, false); // FERMIONIC=true!
502}
503
504template<typename Symmetry, typename Scalar>
505template<typename Dummy>
506typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
507CanonicalEntangler (int dLphys, double factor) const
508{
509 assert(dLphys==2 and "Only dLphys=2 is implemented!");
510 Mpo<Symmetry,Scalar> Mout(F.size(), Symmetry::qvacuum(), "CanonicalEntangler", PROP::HERMITIAN, false, BC::OPEN, DMRG::VERBOSITY::HALFSWEEPWISE);
511 for (size_t l=0; l<F.size(); ++l) {Mout.setLocBasis(F[l].get_basis().qloc(),l);}
512
513 std::vector<typename Symmetry::qType> qList(F.size()+1);
514 std::vector<SiteOperator<Symmetry,Scalar>> opList(F.size());
515
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>();}
518
519 for (int i=0; i<F.size(); i+=dLphys)
520 for (int j=0; j<F.size(); j+=dLphys)
521 {
522 if (i<j)
523 {
524 auto qListWork = qList;
525 auto opListWork = opList;
526
527 qListWork[1+i] = qarray<Symmetry::Nq>{2,1}; // cdag
528 qListWork[1+i+1] = qarray<Symmetry::Nq>{1,2}; // cdag
529 for (int k=i+3; k<j+1; ++k) qListWork[k] = qarray<Symmetry::Nq>{1,2};
530 qListWork[1+j] = qarray<Symmetry::Nq>{2,1}; // c
531 qListWork[1+j+1] = qarray<Symmetry::Nq>{1,0}; // c
532
533// qListWork[1+i] = qarray<Symmetry::Nq>{2,1}; // cdag
534// qListWork[1+i+1] = qarray<Symmetry::Nq>{1,0}; // c
535// for (int k=i+3; k<j+1; ++k) qListWork[k] = qarray<Symmetry::Nq>{1,0};
536// qListWork[1+j] = qarray<Symmetry::Nq>{2,1}; // cdag
537// qListWork[1+j+1] = qarray<Symmetry::Nq>{1,0}; // c
538
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>();
543
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);
546
547 // sign: global minus; another global minus of unclear origin
548 Mout.push_qpath(i, opRes, qRes, +1.*factor);
549// Mout.push_qpath(i, opRes, qRes, +2.*factor);
550
551 qListWork = qList;
552 opListWork = opList;
553
554 qListWork[1+i] = qarray<Symmetry::Nq>{2,-1}; // c
555 qListWork[1+i+1] = qarray<Symmetry::Nq>{1,-2}; // c
556 for (int k=i+3; k<j+1; ++k) qListWork[k] = qarray<Symmetry::Nq>{1,-2};
557 qListWork[1+j] = qarray<Symmetry::Nq>{2,-1}; // cdag
558 qListWork[1+j+1] = qarray<Symmetry::Nq>{1,0}; // cdag
559
560// qListWork[1+i] = qarray<Symmetry::Nq>{2,-1}; // c
561// qListWork[1+i+1] = qarray<Symmetry::Nq>{1,0}; // cdag
562// for (int k=i+3; k<j+1; ++k) qListWork[k] = qarray<Symmetry::Nq>{1,0};
563// qListWork[1+j] = qarray<Symmetry::Nq>{2,-1}; // c
564// qListWork[1+j+1] = qarray<Symmetry::Nq>{1,0}; // cdag
565
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>();
570
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);
573
574 Mout.push_qpath(i, opRes, qRes, 1.*factor);
575// Mout.push_qpath(i, opRes, qRes, 2.*factor);
576 }
577 }
578
579 Mout.N_phys = F.size()/dLphys;
580 Mout.finalize(PROP::COMPRESS, 1); // power=1
581 Mout.precalc_TwoSiteData(true);
582
583 return Mout;
584}
585
586template<typename Symmetry, typename Scalar>
587template<typename Dummy>
588typename std::enable_if<Dummy::IS_SPIN_U1(), Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
589CanonicalEntangler (int dLphys, double factor) const
590{
591 assert(dLphys==2 and "Only dLphys=2 is implemented!");
592 Mpo<Symmetry,Scalar> Mout(F.size(), Symmetry::qvacuum(), "CanonicalEntangler", PROP::HERMITIAN);
593 for (size_t l=0; l<F.size(); ++l) {Mout.setLocBasis(F[l].get_basis().qloc(),l);}
594
595 std::vector<typename Symmetry::qType> qList(F.size()+1);
596 std::vector<SiteOperator<Symmetry,Scalar>> opList(F.size());
597
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>();}
600
601 auto add_term = [&qList, &opList, &Mout, this] (int i, int j, const OperatorType &Sysi, const OperatorType &Bathi, const OperatorType &Sysj, const OperatorType &Bathj, double sign)
602 {
603 auto qListWork = qList;
604 auto opListWork = opList;
605
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>();
610
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();
616
617 assert(Sysi.Q()+Bathi.Q()+Sysj.Q()+Bathj.Q() == Symmetry::qvacuum());
618
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);
621
622 Mout.push_qpath(i, opRes, qRes, sign);
623 };
624
625 for (int i=0; i<F.size(); i+=2)
626 for (int j=0; j<F.size(); j+=2)
627 {
628 if (i<j)
629 {
630 // variant 1: singlet-singlet coupling: strange behaviour, maybe only good for tJ model
631 // sign: global minus; one transposition
632// add_term(i, j, F[i].cdag(UP), F[i+1].cdag(DN), F[j].c(UP), F[j+1].c(DN), +0.5); // ↑↓*↑↓
633// add_term(i, j, F[i].c(UP), F[i+1].c(DN), F[j].cdag(UP), F[j+1].cdag(DN), +0.5);
634//
635// add_term(i, j, F[i].cdag(DN), F[i+1].cdag(UP), F[j].c(UP), F[j+1].c(DN), -0.5); // ↓↑*↑↓
636// add_term(i, j, F[i].c(DN), F[i+1].c(UP), F[j].cdag(UP), F[j+1].cdag(DN), -0.5);
637//
638// add_term(i, j, F[i].cdag(UP), F[i+1].cdag(DN), F[j].c(DN), F[j+1].c(UP), -0.5); // ↑↓*↓↑
639// add_term(i, j, F[i].c(UP), F[i+1].c(DN), F[j].cdag(DN), F[j+1].cdag(UP), -0.5);
640//
641// add_term(i, j, F[i].cdag(DN), F[i+1].cdag(UP), F[j].c(DN), F[j+1].c(UP), +0.5); // ↓↑*↓↑
642// add_term(i, j, F[i].c(DN), F[i+1].c(UP), F[j].cdag(DN), F[j+1].cdag(UP), +0.5);
643//
644// // variant 2: conserves N and Sz
645// add_term(i, j, F[i].cdag(UP), F[i+1].cdag(UP), F[j].c(UP), F[j+1].c(UP), +1.*factor); // ↑↑*↑↑
646// add_term(i, j, F[i].c(UP), F[i+1].c(UP), F[j].cdag(UP), F[j+1].cdag(UP), +1.*factor);
647//
648// add_term(i, j, F[i].cdag(DN), F[i+1].cdag(DN), F[j].c(DN), F[j+1].c(DN), +1.*factor); // ↓↓*↓↓
649// add_term(i, j, F[i].c(DN), F[i+1].c(DN), F[j].cdag(DN), F[j+1].cdag(DN), +1.*factor);
650//
651 // variant 3: conserves N and Sz
652 add_term(i, j, F[i].cdag(UP), F[i+1].cdag(DN), F[j].c(UP), F[j+1].c(DN), +1.*factor); // ↑↓*↑↓
653 add_term(i, j, F[i].c(UP), F[i+1].c(DN), F[j].cdag(UP), F[j+1].cdag(DN), +1.*factor);
654
655 add_term(i, j, F[i].cdag(DN), F[i+1].cdag(UP), F[j].c(DN), F[j+1].c(UP), +1.*factor); // ↓↑*↓↑
656 add_term(i, j, F[i].c(DN), F[i+1].c(UP), F[j].cdag(DN), F[j+1].cdag(UP), +1.*factor);
657//
658// // variant 4: bad
659// add_term(i, j, F[i].cdag(UP), F[i+1].cdag(DN), F[j].c(DN), F[j+1].c(UP), +1.*factor); // ↑↓*↓↑
660// add_term(i, j, F[i].c(UP), F[i+1].c(DN), F[j].cdag(DN), F[j+1].cdag(UP), +1.*factor);
661//
662// add_term(i, j, F[i].cdag(DN), F[i+1].cdag(UP), F[j].c(UP), F[j+1].c(DN), +1.*factor); // ↓↑*↑↓
663// add_term(i, j, F[i].c(DN), F[i+1].c(UP), F[j].cdag(UP), F[j+1].cdag(DN), +1.*factor);
664//
665// // test variant
666// add_term(i, j, F[i].Sp(), F[i+1].Sm(), F[j].Sm(), F[j+1].Sp(), -1.*factor);
667// add_term(i, j, F[i].Sm(), F[i+1].Sp(), F[j].Sp(), F[j+1].Sm(), -1.*factor);
668// add_term(i, j, F[i].Tp(), F[i+1].Tm(), F[j].Tm(), F[j+1].Tp(), -1.*factor);
669// add_term(i, j, F[i].Tm(), F[i+1].Tp(), F[j].Tp(), F[j+1].Tm(), -1.*factor);
670 }
671 }
672
673 Mout.N_phys = F.size()/dLphys;
674 Mout.finalize(PROP::COMPRESS, 1); // power=1
675 Mout.precalc_TwoSiteData(true);
676
677 return Mout;
678}
679
680//-------------
681
682template<typename Symmetry, typename Scalar>
683template<typename Dummy>
684typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
685c (size_t locx, size_t locy, double factor) const
686{
687 if constexpr(Dummy::IS_CHARGE_SU2())
688 {
689 //auto Gxy = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,loscx+locy)));
690 assert(locy==0);
691 auto Gxy = G[locx];
692 return make_local(locx,locy, F[locx].c(Gxy,locy), factor, PROP::FERMIONIC);
693 }
694 else
695 {
696 return make_local(locx,locy, F[locx].c(locy), factor, PROP::FERMIONIC);
697 }
698}
699
700template<typename Symmetry, typename Scalar>
701template<SPIN_INDEX sigma, typename Dummy>
702typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
703c (size_t locx, size_t locy, double factor) const
704{
705 if constexpr(Dummy::IS_CHARGE_SU2())
706 {
707 //auto Gxy = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx+locy)));
708 assert(locy==0);
709 auto Gxy = G[locx];
710 return make_local(locx,locy, F[locx].c(sigma,Gxy,locy), factor, PROP::FERMIONIC);
711 }
712 else
713 {
714 return make_local(locx,locy, F[locx].c(sigma,locy), factor, PROP::FERMIONIC);
715 }
716}
717
718// template<typename Symmetry, typename Scalar>
719// template<SPIN_INDEX sigma, SUB_LATTICE G, typename Dummy>
720// typename std::enable_if<Dummy::IS_CHARGE_SU2() and !Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
721// c (size_t locx, size_t locy, double factor) const
722// {
723// return make_local(locx,locy, F[locx].c(sigma,G,locy), factor, PROP::FERMIONIC);
724// }
725
726// template<typename Symmetry, typename Scalar>
727// template<SUB_LATTICE G, typename Dummy>
728// typename std::enable_if<Dummy::IS_CHARGE_SU2() and Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
729// c (size_t locx, size_t locy, double factor) const
730// {
731// return make_local(locx,locy, F[locx].c(G,locy), factor, PROP::FERMIONIC);
732// }
733
734template<typename Symmetry, typename Scalar>
735template<typename Dummy>
736typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
737cdag (size_t locx, size_t locy, double factor) const
738{
739 if constexpr(Dummy::IS_CHARGE_SU2())
740 {
741 //auto Gxy = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx+locy)));
742 assert(locy==0);
743 auto Gxy = G[locx];
744 return make_local(locx,locy, F[locx].cdag(Gxy,locy), factor, PROP::FERMIONIC);
745 }
746 else
747 {
748 return make_local(locx,locy, F[locx].cdag(locy), factor, PROP::FERMIONIC);
749 }
750}
751
752template<typename Symmetry, typename Scalar>
753template<SPIN_INDEX sigma, typename Dummy>
754typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
755cdag (size_t locx, size_t locy, double factor) const
756{
757 if constexpr(Dummy::IS_CHARGE_SU2())
758 {
759 //auto Gxy = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx+locy)));
760 assert(locy==0);
761 auto Gxy = G[locx];
762 return make_local(locx,locy, F[locx].cdag(sigma,Gxy,locy), factor, PROP::FERMIONIC);
763 }
764 else
765 {
766 return make_local(locx,locy, F[locx].cdag(sigma,locy), factor, PROP::FERMIONIC);
767 }
768}
769
770template<typename Symmetry, typename Scalar>
771template<class Dummy>
772typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
773cc (size_t locx, size_t locy) const
774{
775 return make_local(locx,locy, F[locx].cc(locy), 1., PROP::BOSONIC);
776}
777
778template<typename Symmetry, typename Scalar>
779template<class Dummy>
780typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
781cdagcdag (size_t locx, size_t locy) const
782{
783 return make_local(locx,locy, F[locx].cdagcdag(locy), 1., PROP::BOSONIC);
784}
785
786template<typename Symmetry, typename Scalar>
787template<typename Dummy>
788typename std::conditional<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar>, vector<Mpo<Symmetry,Scalar> > >::type HubbardObservables<Symmetry,Scalar>::
789cdagc (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
790{
791 if constexpr (Dummy::IS_SPIN_SU2() and !Dummy::IS_CHARGE_SU2())
792 {
793 return make_corr(locx1, locx2, locy1, locy2, F[locx1].cdag(locy1), F[locx2].c(locy2), Symmetry::qvacuum(), sqrt(2.), PROP::FERMIONIC, PROP::NON_HERMITIAN);
794 }
795 else if constexpr (Dummy::IS_SPIN_SU2() and Dummy::IS_CHARGE_SU2())
796 {
797 assert(locy1==0 and locy2==0);
798 SUB_LATTICE Gx1y1 = G[locx1]; //static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx1+locy1)));
799 SUB_LATTICE Gx2y2 = G[locx2]; //static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx2+locy2)));
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);
801 }
802 else
803 {
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);
807 return out;
808 }
809}
810
811template<typename Symmetry, typename Scalar>
812template<SPIN_INDEX sigma1, SPIN_INDEX sigma2, typename Dummy>
813typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
814cdagc (size_t locx1, size_t locx2, size_t locy1, size_t locy2, double factor) const
815{
816 if constexpr (Dummy::ABELIAN)
817 {
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);
820 }
821 else
822 {
823 assert(locy1==0 and locy2==0);
824 SUB_LATTICE Gx1y1 = G[locx1]; //static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx1+locy1)));
825 SUB_LATTICE Gx2y2 = G[locx2]; //static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx2+locy2)));
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);
827 }
828}
829
830template<typename Symmetry, typename Scalar>
831template<typename Dummy>
832typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
833cdagc (SPIN_INDEX sigma1, SPIN_INDEX sigma2, size_t locx1, size_t locx2, size_t locy1, size_t locy2, double factor) const
834{
835 if constexpr (Dummy::ABELIAN)
836 {
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);
839 }
840 else
841 {
842 assert(locy1==0 and locy2==0);
843 SUB_LATTICE Gx1y1 = G[locx1]; //static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx1+locy1)));
844 SUB_LATTICE Gx2y2 = G[locx2]; //static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx2+locy2)));
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);
846 }
847}
848
849//template<typename Symmetry, typename Scalar>
850//template<typename Dummy>
851//typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
852//cdagc (SPIN_INDEX sigma1, SPIN_INDEX sigma2, size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
853//{
854// if constexpr (Dummy::ABELIAN)
855// {
856// auto Qtot = F[locx1].cdag(sigma1,locy1).Q() + F[locx2].c(sigma2,locy2).Q();
857// return make_corr(locx1, locx2, locy1, locy2, F[locx1].cdag(sigma1,locy1), F[locx2].c(sigma2,locy2), Qtot, 1., PROP::FERMIONIC, PROP::NON_HERMITIAN);
858// }
859// else
860// {
861// assert(locy1==0 and locy2==0);
862// auto Gx1y1 = G[locx1]; //static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx1+locy1)));
863// auto Gx2y2 = G[locx2]; //static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx2+locy2)));
864// return make_corr(locx1, locx2, locy1, locy2, F[locx1].cdag(sigma1,Gx1y1,locy1), F[locx2].c(sigma2,Gx2y2,locy2), Symmetry::qvacuum(), 1., PROP::FERMIONIC, PROP::NON_HERMITIAN);
865// }
866//}
867
868// n(j)*cdag(i)*c(j)
869// = cdag(i)*n(j)*c(j) for i!=0
870// = n(i)^2 for i==j
871template<typename Symmetry, typename Scalar>
872template<typename Dummy>
873typename std::conditional<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar>, vector<Mpo<Symmetry,Scalar> > >::type HubbardObservables<Symmetry,Scalar>::
874cdag_nc (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
875{
876 if constexpr (Dummy::IS_SPIN_SU2() and !Dummy::IS_CHARGE_SU2())
877 {
878 if (locx1 == locx2)
879 {
880 assert(locy1 == locy2);
881 return make_local (locx1, locy1, F[locx1].n(locy1)*F[locx1].n(locy1), 1., PROP::BOSONIC, PROP::HERMITIAN);
882 }
883 else
884 {
885 return make_corr(locx1, locx2, locy1, locy2, F[locx1].cdag(locy1), F[locx2].n(locy2)*F[locx2].c(locy2), Symmetry::qvacuum(), sqrt(2.), PROP::FERMIONIC, PROP::NON_HERMITIAN);
886 }
887 }
888 else if constexpr (Dummy::IS_SPIN_SU2() and Dummy::IS_CHARGE_SU2())
889 {
890 throw;
891 }
892 else
893 {
894 throw;
895 }
896}
897
898// cdag(i)*c(j)*n(i)
899// = cdag(i)*n(i)*c(j) for i!=0
900// = n(i)^2 for i==j
901template<typename Symmetry, typename Scalar>
902template<typename Dummy>
903typename std::conditional<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar>, vector<Mpo<Symmetry,Scalar> > >::type HubbardObservables<Symmetry,Scalar>::
904cdagn_c (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
905{
906 if constexpr (Dummy::IS_SPIN_SU2() and !Dummy::IS_CHARGE_SU2())
907 {
908 if (locx1 == locx2)
909 {
910 assert(locy1 == locy2);
911 return make_local (locx1, locy1, F[locx1].n(locy1)*F[locx1].n(locy1), 1., PROP::BOSONIC, PROP::HERMITIAN);
912 }
913 else
914 {
915 return make_corr(locx1, locx2, locy1, locy2, F[locx1].cdag(locy1)*F[locx1].n(locy1), F[locx2].c(locy2), Symmetry::qvacuum(), sqrt(2.), PROP::FERMIONIC, PROP::NON_HERMITIAN);
916 }
917 }
918 else if constexpr (Dummy::IS_SPIN_SU2() and Dummy::IS_CHARGE_SU2())
919 {
920 throw;
921 }
922 else
923 {
924 throw;
925 }
926}
927
928/*template<typename Symmetry, typename Scalar>
929template<SPIN_INDEX sigma1, SPIN_INDEX sigma2, SPIN_INDEX sigma3, SPIN_INDEX sigma4, typename Dummy>
930typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
931cdagcdagcc (size_t locx1, size_t locx2, size_t locx3, size_t locx4, double factor, size_t locy1, size_t locy2, size_t locy3, size_t locy4) const
932{
933 if constexpr (Dummy::ABELIAN)
934 {
935 auto Qtot = F[locx1].cdag(sigma1,locy1).Q() + F[locx2].c(sigma2,locy2).Q();
936
937 assert(locx1<F.size() and locy1<F[locx1].dim());
938 assert(locx2<F.size() and locy2<F[locx2].dim());
939 assert(locx3<F.size() and locy3<F[locx2].dim());
940 assert(locx4<F.size() and locy4<F[locx2].dim());
941
942 auto Op1 = F[locx1].cdag(sigma1,locy1);
943 auto Op2 = F[locx2].cdag(sigma2,locy2);
944 auto Op3 = F[locx3].c(sigma3,locy3);
945 auto Op4 = F[locx4].c(sigma4,locy4);
946
947 stringstream ss;
948 ss << Op1.label() << "(" << locx1 << "," << locy1 << ")"
949 << Op2.label() << "(" << locx2 << "," << locy2 << ")"
950 << Op3.label() << "(" << locx3 << "," << locy3 << ")"
951 << Op4.label() << "(" << locx4 << "," << locy4 << ")";
952
953 auto Q1 = F[locx1].cdag(sigma1,locy1).Q();
954 auto Q2 = F[locx2].cdag(sigma2,locy2).Q();
955 auto Q3 = F[locx3].cdag(sigma3,locy3).Q();
956 auto Q4 = F[locx4].cdag(sigma4,locy4).Q();
957
958 auto Qtot = Q1+Q2+Q3+Q4;
959
960 Mpo<Symmetry,Scalar> Mout(F.size(), Qtot, ss.str(), PROP::NON_HERMITIAN);
961 for (size_t l=0; l<F.size(); ++l) {Mout.setLocBasis(F[l].get_basis().qloc(),l);}
962
963 if (locx1 == locx2 and locx3==locx4 and locx1==locx3)
964 {
965 auto prod12 = OperatorType::prod(Op1,Op2,Q1+Q2);
966 auto prod34 = OperatorType::prod(Op3,Op4,Q3+Q4);
967 Mout.setLocal(locx1, factor * OperatorType::prod(prod12,prod34,Qtot).template plain<double>().template cast<Scalar>());
968 }
969 else if (locx1 == locx2 and locx3 != locx4 and locx1==locx3)
970 {
971 auto prod12 = OperatorType::prod(Op1,Op2,Q1+Q2);
972 auto prod34 = OperatorType::prod(Op3,Op4,Q3+Q4);
973 Mout.setLocal(locx1, factor * OperatorType::prod(prod12,prod34,Qtot).template plain<double>().template cast<Scalar>());
974 }
975 else if (locx1<locx2)
976 {
977 Mout.setLocal({locx1, locx2}, {(factor * (Op1 * F[locx1].sign())).template plain<double>().template cast<Scalar>(),
978 Op2.template plain<double>().template cast<Scalar>()},
979 F[0].sign().template plain<double>().template cast<Scalar>());
980 }
981 else if (locx1>locx2)
982 {
983 Mout.setLocal({locx2, locx1}, {(factor * (Op2 * F[locx2].sign())).template plain<double>().template cast<Scalar>(),
984 -Symmetry::spinorFactor() * Op1.template plain<double>().template cast<Scalar>()},
985 F[0].sign().template plain<double>().template cast<Scalar>());
986 }
987 return Mout;
988
989 return make_corr(locx1, locx2, locy1, locy2, F[locx1].cdag(sigma1,locy1), F[locx2].c(sigma2,locy2), Qtot, 1., PROP::FERMIONIC, PROP::NON_HERMITIAN);
990 }
991}*/
992
993template<typename Symmetry, typename Scalar>
994template<typename Dummy>
995typename std::conditional<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar>, vector<Mpo<Symmetry,Scalar> > >::type HubbardObservables<Symmetry,Scalar>::
996cdagc3 (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
997{
998 if constexpr (Dummy::IS_SPIN_SU2() and !Dummy::IS_CHARGE_SU2())
999 {
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);
1001 }
1002// else if constexpr (Dummy::IS_SPIN_SU2() and Dummy::IS_CHARGE_SU2())
1003// {
1004// auto Gx1y1 = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx1+locy1)));
1005// auto Gx2y2 = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx2+locy2)));
1006// 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);
1007// }
1008// else
1009// {
1010// vector<Mpo<Symmetry,Scalar> > out(2);
1011// out[0] = cdagc<UP>(locx1,locx2,locy1,locy2);
1012// out[1] = cdagc<DN>(locx1,locx2,locy1,locy2);
1013// return out;
1014// }
1015}
1016
1017template<typename Symmetry, typename Scalar>
1018template<SPIN_INDEX sigma1, SPIN_INDEX sigma2, typename Dummy>
1019typename std::enable_if<Dummy::ABELIAN,Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1020cc (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1021{
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);
1024}
1025
1026template<typename Symmetry, typename Scalar>
1027template<typename Dummy>
1028typename std::enable_if<Dummy::ABELIAN,Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1029cc (SPIN_INDEX sigma1, SPIN_INDEX sigma2, size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1030{
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);
1033}
1034
1035template<typename Symmetry, typename Scalar>
1036template<SPIN_INDEX sigma1, SPIN_INDEX sigma2, typename Dummy>
1037typename std::enable_if<Dummy::ABELIAN,Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1038cdagcdag (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1039{
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);
1042}
1043
1044template<typename Symmetry, typename Scalar>
1045template<typename Dummy>
1046typename std::enable_if<Dummy::ABELIAN,Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1047cdagcdag (SPIN_INDEX sigma1, SPIN_INDEX sigma2, size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1048{
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);
1051}
1052
1053template<typename Symmetry, typename Scalar>
1054template<typename Dummy>
1055typename std::conditional<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar>, vector<Mpo<Symmetry,Scalar> > >::type HubbardObservables<Symmetry,Scalar>::
1056cc3 (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1057{
1058 if constexpr (Dummy::IS_SPIN_SU2())
1059 {
1060 //Determine Qtot to the spin triplet quantum number.
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;}}
1064 return make_corr(locx1, locx2, locy1, locy2, F[locx1].c(locy1), F[locx2].c(locy2), Qtot, sqrt(2.), PROP::FERMIONIC, PROP::NON_HERMITIAN);
1065 }
1066 else
1067 {
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); // Should be UP,UP and DN,DN???
1071 out[1] = cc<DN,UP>(locx1,locx2,locy1,locy2);
1072 return out;
1073 }
1074}
1075
1076template<typename Symmetry, typename Scalar>
1077template<typename Dummy>
1078typename std::conditional<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar>, vector<Mpo<Symmetry,Scalar> > >::type HubbardObservables<Symmetry,Scalar>::
1079cdagcdag3 (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1080{
1081 if constexpr (Dummy::IS_SPIN_SU2())
1082 {
1083 // Set Qtot to the spin triplet quantum number.
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;}}
1087 return make_corr(locx1, locx2, locy1, locy2, F[locx1].cdag(locy1), F[locx2].cdag(locy2), Qtot, sqrt(2.), PROP::FERMIONIC, PROP::NON_HERMITIAN);
1088 }
1089 else
1090 {
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); // Should be UP,UP and DN,DN???
1094 out[1] = cdagcdag<DN,UP>(locx1,locx2,locy1,locy2);
1095 return out;
1096 }
1097}
1098
1099template<typename Symmetry, typename Scalar>
1100template<typename Dummy>
1101typename std::conditional<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar>, vector<Mpo<Symmetry,Scalar> > >::type HubbardObservables<Symmetry,Scalar>::
1102cc1 (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1103{
1104 if constexpr (Dummy::IS_SPIN_SU2())
1105 {
1106 //Determine Qtot to the spin triplet quantum number.
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;}}
1110 return make_corr(locx1, locx2, locy1, locy2, F[locx1].c(locy1), F[locx2].c(locy2), Qtot, sqrt(2.), PROP::FERMIONIC, PROP::NON_HERMITIAN);
1111 }
1112// else
1113// {
1114// 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.");
1115// vector<Mpo<Symmetry,Scalar> > out(2);
1116// out[0] = cc<UP,DN>(locx1,locx2,locy1,locy2); // Should be UP,UP and DN,DN???
1117// out[1] = cc<DN,UP>(locx1,locx2,locy1,locy2);
1118// return out;
1119// }
1120}
1121
1122template<typename Symmetry, typename Scalar>
1123template<typename Dummy>
1124typename std::conditional<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar>, vector<Mpo<Symmetry,Scalar> > >::type HubbardObservables<Symmetry,Scalar>::
1125cdagcdag1 (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1126{
1127 if constexpr (Dummy::IS_SPIN_SU2())
1128 {
1129 // Set Qtot to the spin triplet quantum number.
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;}}
1133 return make_corr(locx1, locx2, locy1, locy2, F[locx1].cdag(locy1), F[locx2].cdag(locy2), Qtot, sqrt(2.), PROP::FERMIONIC, PROP::NON_HERMITIAN);
1134 }
1135// else
1136// {
1137// 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.");
1138// vector<Mpo<Symmetry,Scalar> > out(2);
1139// out[0] = cdagcdag<UP,DN>(locx1,locx2,locy1,locy2); // Should be UP,UP and DN,DN???
1140// out[1] = cdagcdag<DN,UP>(locx1,locx2,locy1,locy2);
1141// return out;
1142// }
1143}
1144
1145template<typename Symmetry, typename Scalar>
1146template<typename Dummy>
1147typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1148Stringz (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1149{
1150 assert(locx1<F.size() and locx2<F.size());
1151 stringstream ss;
1152 ss << "Sz" << "(" << locx1 << "," << locy1 << "," << ")"
1153 << "Sz" << "(" << locx2 << "," << locy2 << "," << ")";
1154
1155 auto Sz1 = F[locx1].Sz(locy1);
1156 auto Sz2 = F[locx2].Sz(locy2);
1157
1158 auto Qtot = Symmetry::reduceSilent(Sz1.Q(), Sz2.Q())[0];
1159 Mpo<Symmetry,Scalar> Mout(F.size(), Qtot, ss.str());
1160 for (size_t l=0; l<F.size(); ++l) {Mout.setLocBasis(F[l].get_basis().qloc(),l);}
1161
1162 if (locx1 == locx2)
1163 {
1164 Mout.setLocal(locx1, Sz1*Sz2);
1165 }
1166 else if (locx1<locx2)
1167 {
1168 Mout.setLocal({locx1,locx2}, {Sz1,Sz2}, F[0].nh()-F[0].ns());
1169// Mout.setLocal({locx1,locx2}, {F[0].Id(),F[0].Id()}, F[0].nh()-F[0].ns());
1170 }
1171 else if (locx1>locx2)
1172 {
1173 throw;
1174// Mout.setLocal({locx2, locx1}, {c*F[locx2].sign(), -1.*cdag}, F[0].sign());
1175 }
1176
1177 return Mout;
1178}
1179
1180template<typename Symmetry, typename Scalar>
1181template<typename Dummy>
1182typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1183StringzDimer (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1184{
1185 assert(locx1<F.size() and locx2<F.size());
1186 stringstream ss;
1187 ss << "Sz" << "(" << locx1 << "," << locy1 << "," << ")"
1188 << "Sz" << "(" << locx2 << "," << locy2 << "," << ")";
1189
1190 auto Sz1 = F[locx1].Sz(locy1);
1191 auto Sz2 = F[locx2].Sz(locy2);
1192
1193 auto Qtot = Symmetry::reduceSilent(Sz1.Q(), Sz2.Q())[0];
1194 Mpo<Symmetry,Scalar> Mout(F.size(), Qtot, ss.str());
1195 for (size_t l=0; l<F.size(); ++l) {Mout.setLocBasis(F[l].get_basis().qloc(),l);}
1196
1197 if (locx1 == locx2)
1198 {
1199 throw;
1200// Mout.setLocal(locx1, Sz1*Sz2);
1201 }
1202 else if (locx1<locx2)
1203 {
1204 Mout.setLocal({locx1,locx2}, {-pow(-4,(locx2-(locx1-1)-2)/2)*Sz1,Sz2}, F[0].Sz());
1205 }
1206 else if (locx1>locx2)
1207 {
1208 throw;
1209 }
1210
1211 return Mout;
1212}
1213
1214//-------------
1215
1216template<typename Symmetry, typename Scalar>
1217template<class Dummy>
1218typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1219d (size_t locx, size_t locy) const
1220{
1221 return make_local(locx,locy, F[locx].d(locy), 1., PROP::BOSONIC, PROP::HERMITIAN);
1222}
1223
1224template<typename Symmetry, typename Scalar>
1225template<class Dummy>
1226typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1227dtot() const
1228{
1229 for (size_t l=0; l<F.size(); ++l) {assert(F[l].orbitals()==1);}
1230
1231 OperatorType Op = F[0].d();
1232
1233 Mpo<Symmetry,Scalar> Mout(F.size(), Op.Q, "double_occ_total", PROP::HERMITIAN);
1234 for (size_t l=0; l<F.size(); ++l) {Mout.setLocBasis(F[l].get_basis().qloc(),l);}
1235
1236 Mout.setLocalSum(Op.template plain<double>());
1237 return Mout;
1238}
1239
1240template<typename Symmetry, typename Scalar>
1241template<SPIN_INDEX sigma, typename Dummy>
1242typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1243n (size_t locx, size_t locy) const
1244{
1245 return make_local(locx,locy, F[locx].n(sigma,locy), 1., PROP::BOSONIC, PROP::HERMITIAN);
1246}
1247
1248template<typename Symmetry, typename Scalar>
1249template<typename Dummy>
1250typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1251n (size_t locx, size_t locy) const
1252{
1253 return make_local(locx,locy, F[locx].n(locy), 1., PROP::BOSONIC, PROP::HERMITIAN);
1254}
1255
1256template<typename Symmetry, typename Scalar>
1257template<typename Dummy>
1258typename std::enable_if<Dummy::IS_CHARGE_SU2(), Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1259T (size_t locx, size_t locy, double factor) const
1260{
1261 return make_local(locx,locy, F[locx].T(locy), factor, PROP::BOSONIC, PROP::NON_HERMITIAN);
1262}
1263
1264template<typename Symmetry, typename Scalar>
1265template<typename Dummy>
1266typename std::enable_if<Dummy::IS_CHARGE_SU2(), Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1267Tdag (size_t locx, size_t locy, double factor) const
1268{
1269 return make_local(locx,locy, F[locx].Tdag(locy), factor, PROP::BOSONIC, PROP::NON_HERMITIAN);
1270}
1271
1272template<typename Symmetry, typename Scalar>
1273template<typename Dummy>
1274typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1275Tz (size_t locx, size_t locy) const
1276{
1277 return make_local(locx,locy, F[locx].Tz(locy), 1., PROP::BOSONIC, PROP::HERMITIAN);
1278}
1279
1280template<typename Symmetry, typename Scalar>
1281template<typename Dummy>
1282typename std::enable_if<Dummy::NO_CHARGE_SYM(), Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1283Tx (size_t locx, size_t locy) const
1284{
1285 //auto G = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx+locy)));
1286 assert(locy==0);
1287 return make_local(locx,locy, F[locx].Tx(locy,G[locx]), 1., PROP::BOSONIC, PROP::HERMITIAN);
1288}
1289
1290template<typename Symmetry, typename Scalar>
1291template<typename Dummy>
1292typename std::enable_if<Dummy::NO_CHARGE_SYM(), Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1293iTy (size_t locx, size_t locy) const
1294{
1295 //auto G = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx+locy)));
1296 assert(locy==0);
1297 return make_local(locx,locy, F[locx].iTy(locy,G[locx]), 1. , PROP::BOSONIC, PROP::HERMITIAN); //0.5*pow(-1,locx+locy)*(F[locx].cdagcdag(locy)-F[locx].cc(locy))
1298}
1299
1300template<typename Symmetry, typename Scalar>
1301template<typename Dummy>
1302typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1303Tm (size_t locx, size_t locy) const
1304{
1305 //auto G = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx+locy)));
1306 assert(locy==0);
1307 return make_local(locx,locy, F[locx].Tm(locy,G[locx]), 1., PROP::BOSONIC, PROP::NON_HERMITIAN);
1308}
1309
1310template<typename Symmetry, typename Scalar>
1311template<typename Dummy>
1312typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1313Tp (size_t locx, size_t locy) const
1314{
1315 //auto G = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx+locy)));
1316 assert(locy==0);
1317 return make_local(locx,locy, F[locx].Tp(locy,G[locx]), 1., PROP::BOSONIC, PROP::NON_HERMITIAN);
1318}
1319
1320template<typename Symmetry, typename Scalar>
1321template<typename Dummy>
1322typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1323TpTm (size_t locx1, size_t locx2, size_t locy1, size_t locy2, double fac) const
1324{
1325 //auto G1 = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx1+locy1)));
1326 //auto G2 = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx2+locy2)));
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);
1329}
1330
1331template<typename Symmetry, typename Scalar>
1332template<typename Dummy>
1333typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1334TmTp (size_t locx1, size_t locx2, size_t locy1, size_t locy2, double fac) const
1335{
1336 //auto G1 = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx1+locy1)));
1337 //auto G2 = static_cast<SUB_LATTICE>(static_cast<int>(pow(-1,locx2+locy2)));
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);
1340}
1341
1342template<typename Symmetry, typename Scalar>
1343template<typename Dummy>
1344typename std::enable_if<!Dummy::IS_CHARGE_SU2(), Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1345TzTz (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1346{
1347 return make_corr(locx1,locx2,locy1,locy2, F[locx1].Tz(locy1), F[locx2].Tz(locy2), Symmetry::qvacuum(), 1., PROP::NON_FERMIONIC, PROP::HERMITIAN);
1348}
1349
1350template<typename Symmetry, typename Scalar>
1351template<typename Dummy>
1352typename std::conditional<Dummy::IS_CHARGE_SU2(), Mpo<Symmetry,Scalar>, vector<Mpo<Symmetry,Scalar> > >::type HubbardObservables<Symmetry,Scalar>::
1353TdagT (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1354{
1355 if constexpr (Symmetry::IS_CHARGE_SU2())
1356 {
1357 return make_corr(locx1, locx2, locy1, locy2, F[locx1].Tdag(locy1), F[locx2].T(locy2), Symmetry::qvacuum(), sqrt(3.), PROP::BOSONIC, PROP::HERMITIAN);
1358 // 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);
1359 }
1360 else
1361 {
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);
1366 return out;
1367 }
1368}
1369
1370template<typename Symmetry, typename Scalar>
1372ns (size_t locx, size_t locy) const
1373{
1374 return make_local(locx,locy, F[locx].ns(locy), 1., PROP::BOSONIC, PROP::HERMITIAN);
1375}
1376
1377template<typename Symmetry, typename Scalar>
1379nh (size_t locx, size_t locy) const
1380{
1381 return make_local(locx,locy, F[locx].nh(locy), 1., PROP::BOSONIC, PROP::HERMITIAN);
1382}
1383
1384template<typename Symmetry, typename Scalar>
1386nssq (size_t locx, size_t locy) const
1387{
1388 return make_local(locx,locy, F[locx].ns(locy) * F[locx].ns(locy), 1., PROP::BOSONIC, PROP::HERMITIAN);
1389}
1390
1391template<typename Symmetry, typename Scalar>
1393nhsq (size_t locx, size_t locy) const
1394{
1395 return make_local(locx,locy, F[locx].nh(locy) * F[locx].nh(locy), 1., PROP::BOSONIC, PROP::HERMITIAN);
1396}
1397
1398template<typename Symmetry, typename Scalar>
1399template<SPIN_INDEX sigma1, SPIN_INDEX sigma2, typename Dummy>
1400typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1401nn (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1402{
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);
1404}
1405
1406template<typename Symmetry, typename Scalar>
1408nn (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1409{
1410 return make_corr (locx1, locx2, locy1, locy2, F[locx1].n(locy1), F[locx2].n(locy2), Symmetry::qvacuum(), 1., PROP::BOSONIC, PROP::HERMITIAN);
1411}
1412
1413template<typename Symmetry, typename Scalar>
1414template<typename Dummy>
1415typename std::enable_if<!Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1416hh (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1417{
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(),
1421 Symmetry::qvacuum(), 1., PROP::NON_FERMIONIC, PROP::HERMITIAN);
1422}
1423
1424template<typename Symmetry, typename Scalar>
1425template<typename Dummy>
1426typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1427Scomp (SPINOP_LABEL Sa, size_t locx, size_t locy, double factor) const
1428{
1429 bool HERMITIAN = (Sa==SX or Sa==SZ)? true:false;
1430 return make_local(locx,locy, F[locx].Scomp(Sa,locy), factor, PROP::BOSONIC, HERMITIAN);
1431}
1432
1433template<typename Symmetry, typename Scalar>
1434template<typename Dummy>
1435typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry,complex<double> > >::type HubbardObservables<Symmetry,Scalar>::
1436exp_ipiSz (size_t locx, size_t locy, double factor) const
1437{
1438 bool HERMITIAN = false;
1439 //return make_local(locx,locy, F[locx].exp_ipiSz(locy), factor, PROP::BOSONIC, HERMITIAN);
1440
1441 assert(locx<F.size() and locy<F[locx].dim());
1442 stringstream ss;
1443 ss << F[locx].exp_ipiSz(locy).label() << "(" << locx << "," << locy;
1444 if (factor != 1.) ss << ",factor=" << factor;
1445 ss << ")";
1446
1447 Mpo<Symmetry,Scalar > Mout(F.size(), F[locx].exp_ipiSz(locy).Q(), ss.str(), HERMITIAN);
1448 for (size_t l=0; l<F.size(); ++l) Mout.setLocBasis(F[l].get_basis().qloc(),l);
1449
1450 Mout.setLocal(locx, (factor * F[locx].exp_ipiSz(locy)).template plain<complex<double> >().template cast<complex<double> >());
1451
1452 return Mout;
1453}
1454
1455template<typename Symmetry, typename Scalar>
1456template<typename Dummy>
1457typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1458Scomptot (SPINOP_LABEL Sa, size_t locy, double factor, int dLphys) const
1459{
1460 vector<OperatorType> Ops(F.size());
1461 vector<Scalar> factors(F.size());
1462 for (int l=0; l<F.size(); ++l)
1463 {
1464 Ops[l] = F[l].Scomp(Sa,locy);
1465 factors[l] = 0.;
1466 }
1467 for (int l=0; l<F.size(); l+=dLphys)
1468 {
1469 factors[l] = factor;
1470 }
1471 return make_localSum(Ops, factors, (Sa==SZ)?PROP::HERMITIAN:PROP::NON_HERMITIAN);
1472}
1473
1474template<typename Symmetry, typename Scalar>
1475template<typename Dummy>
1476typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry,complex<double> > >::type HubbardObservables<Symmetry,Scalar>::
1477Rcomp (SPINOP_LABEL Sa, size_t locx, size_t locy) const
1478{
1479 stringstream ss;
1480 if (Sa==iSY)
1481 {
1482 ss << "exp[2Ï€" << Sa << "(" << locx << "," << locy << ")]";
1483 }
1484 else
1485 {
1486 ss << "exp[2Ï€i" << Sa << "(" << locx << "," << locy << ")]";
1487 }
1488
1489 auto Op = F[locx].Rcomp(Sa,locy).template plain<complex<double> >();
1490
1491 Mpo<Symmetry,complex<double>> Mout(F.size(), Op.Q, ss.str(), false);
1492 for (size_t l=0; l<F.size(); ++l) {Mout.setLocBasis(F[l].get_basis().qloc(),l);}
1493
1494 Mout.setLocal(locx, Op);
1495
1496 return Mout;
1497}
1498
1499template<typename Symmetry, typename Scalar>
1500template<typename Dummy>
1501typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1502ScompScomp (SPINOP_LABEL Sa1, SPINOP_LABEL Sa2, size_t locx1, size_t locx2, size_t locy1, size_t locy2, double fac) const
1503{
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);
1505}
1506
1507template<typename Symmetry, typename Scalar>
1508template<typename Dummy>
1509typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1510S (size_t locx, size_t locy, double factor) const
1511{
1512 return make_local(locx,locy, F[locx].S(locy), factor, PROP::BOSONIC, PROP::NON_HERMITIAN);
1513}
1514
1515template<typename Symmetry, typename Scalar>
1516template<typename Dummy>
1517typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1518Sdag (size_t locx, size_t locy, double factor) const
1519{
1520 return make_local(locx,locy, F[locx].Sdag(locy), factor, PROP::BOSONIC, PROP::NON_HERMITIAN);
1521}
1522
1523template<typename Symmetry, typename Scalar>
1524template<typename Dummy>
1525typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1526Stot (size_t locy, double factor, int dLphys) const
1527{
1528 vector<OperatorType> Ops(F.size());
1529 vector<double> factors(F.size());
1530 for (int l=0; l<F.size(); ++l)
1531 {
1532 Ops[l] = F[l].S(locy);
1533 factors[l] = 0.;
1534 }
1535 for (int l=0; l<F.size(); l+=dLphys)
1536 {
1537 factors[l] = factor;
1538 }
1539 return make_localSum(Ops, factors, PROP::NON_HERMITIAN);
1540}
1541
1542template<typename Symmetry, typename Scalar>
1543template<typename Dummy>
1544typename std::enable_if<Dummy::IS_SPIN_SU2(), Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1545Sdagtot (size_t locy, double factor, int dLphys) const
1546{
1547 vector<OperatorType> Ops(F.size());
1548 vector<double> factors(F.size());
1549 for (int l=0; l<F.size(); ++l)
1550 {
1551 Ops[l] = F[l].Sdag(locy);
1552 factors[l] = 0.;
1553 }
1554 for (int l=0; l<F.size(); l+=dLphys)
1555 {
1556 factors[l] = factor;
1557 }
1558 return make_localSum(Ops, factors, PROP::NON_HERMITIAN);
1559}
1560
1561template<typename Symmetry, typename Scalar>
1562template<typename Dummy>
1563typename std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1564Sz (size_t locx, size_t locy) const
1565{
1566 return Scomp(SZ,locx,locy);
1567}
1568
1569template<typename Symmetry, typename Scalar>
1570template<typename Dummy>
1571typename std::conditional<Dummy::IS_SPIN_SU2(), Mpo<Symmetry,Scalar>, vector<Mpo<Symmetry,Scalar> > >::type HubbardObservables<Symmetry,Scalar>::
1572SdagS (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1573{
1574 if constexpr (Symmetry::IS_SPIN_SU2())
1575 {
1576 return make_corr(locx1, locx2, locy1, locy2, F[locx1].Sdag(locy1), F[locx2].S(locy2), Symmetry::qvacuum(), sqrt(3.), PROP::BOSONIC, PROP::HERMITIAN);
1577 // 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);
1578 }
1579 else
1580 {
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);
1585 return out;
1586 }
1587}
1588
1589template<typename Symmetry, typename Scalar>
1590template<typename Dummy>
1591typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,complex<double> > >::type HubbardObservables<Symmetry,Scalar>::
1592S_ky (vector<complex<double> > phases) const
1593{
1594 vector<OperatorType> Ops(F.size());
1595 for (size_t l=0; l<F.size(); ++l)
1596 {
1597 Ops[l] = F[l].S(0);
1598 }
1599 return make_FourierYSum("S", Ops, 1., false, phases);
1600}
1601
1602template<typename Symmetry, typename Scalar>
1603template<typename Dummy>
1604typename std::enable_if<Dummy::IS_SPIN_SU2(),Mpo<Symmetry,complex<double> > >::type HubbardObservables<Symmetry,Scalar>::
1605Sdag_ky (vector<complex<double> > phases, double factor) const
1606{
1607 vector<OperatorType> Ops(F.size());
1608 for (size_t l=0; l<F.size(); ++l)
1609 {
1610 Ops[l] = F[l].Sdag(0);
1611 }
1612 return make_FourierYSum("S†", Ops, 1., false, phases);
1613}
1614
1615template<typename Symmetry, typename Scalar>
1616template<typename Dummy>
1617typename std::enable_if<Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,complex<double> > >::type HubbardObservables<Symmetry,Scalar>::
1618T_ky (vector<complex<double> > phases) const
1619{
1620 vector<OperatorType> Ops(F.size());
1621 for (size_t l=0; l<F.size(); ++l)
1622 {
1623 Ops[l] = F[l].T(0);
1624 }
1625 return make_FourierYSum("T", Ops, 1., false, phases);
1626}
1627
1628template<typename Symmetry, typename Scalar>
1629template<typename Dummy>
1630typename std::enable_if<Dummy::IS_CHARGE_SU2(),Mpo<Symmetry,complex<double> > >::type HubbardObservables<Symmetry,Scalar>::
1631Tdag_ky (vector<complex<double> > phases, double factor) const
1632{
1633 vector<OperatorType> Ops(F.size());
1634 for (size_t l=0; l<F.size(); ++l)
1635 {
1636 Ops[l] = F[l].Tdag(0);
1637 }
1638 return make_FourierYSum("T†", Ops, 1., false, phases);
1639}
1640
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
1645{
1646 vector<OperatorType> Ops(F.size());
1647 for (size_t l=0; l<F.size(); ++l)
1648 {
1649 Ops[l] = F[l].c(0);
1650 }
1651 return make_FourierYSum("c", Ops, 1., false, phases);
1652}
1653
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
1658{
1659 vector<OperatorType> Ops(F.size());
1660 for (size_t l=0; l<F.size(); ++l)
1661 {
1662 Ops[l] = F[l].cdag(0);
1663 }
1664 return make_FourierYSum("c†", Ops, 1., false, phases);
1665}
1666
1667template<typename Symmetry, typename Scalar>
1669{
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");}
1673 return out;
1674}
1675
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
1680{
1681 Mpo<Symmetry,Scalar> res = Id(); //(1,1)
1682 auto ntot = sum(n(locx1,locy1),
1683 n(locx2,locy2)); //(1,2)+(2,1)
1684 auto hopping = sum(cdagc(locx1,locx2,locy1,locy2),
1685 cdagc(locx2,locx1,locy2,locy1)); //(1,3)+(3,1)
1686
1687 auto spin_exchange = SdagS(locx1,locx2,locy1,locy2); spin_exchange.scale(-2.); //(3,3)+(2,2)
1688 auto dtot = sum(d(locx1,locy1),d(locx2,locy2)); //(2,2)
1689 auto density_density = nn(locx1,locx2,locy1,locy2); density_density.scale(0.5); //(2,2)
1690
1691 auto correlated_hopping1 = sum(cdagn_c(locx1,locx2,locy1,locy2),
1692 cdag_nc(locx2,locx1,locy2,locy1)); //(2,3)+(3,2)
1693 auto correlated_hopping2 = sum(cdag_nc(locx1,locx2,locy1,locy2),
1694 cdagn_c(locx2,locx1,locy2,locy1)); //(3,2)+(3,2)
1695
1696 auto pair_hopping = sum(prod(cdagcdag(locx1,locy1),cc(locx2,locy2)),
1697 prod(cdagcdag(locx2,locy2),cc(locx1,locy1))); //(3,3)
1698
1699 res = sum(res,hopping);
1700 res = sum(res,spin_exchange);
1701 res = sum(res,density_density);
1702 res = sum(res,pair_hopping);
1703 res = sum(res,dtot);
1704 res = diff(res,ntot);
1705 res = diff(res,correlated_hopping1);
1706 res = diff(res,correlated_hopping2);
1707
1708 return res;
1709}
1710
1711template<typename Symmetry, typename Scalar>
1712template<typename Dummy>
1713typename std::enable_if<!Dummy::IS_SPIN_SU2(),Mpo<Symmetry,Scalar> >::type HubbardObservables<Symmetry,Scalar>::
1714P (size_t locx1, size_t locx2, size_t locy1, size_t locy2) const
1715{
1716 Mpo<Symmetry,Scalar> res_up = Id();
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()) // for CHARGE_SU2, the adjoint should already be contained in cdagc
1721 {
1722 res_up = sum(res_up,cdagc<UP,UP>(locx2,locx1,locy2,locy1));
1723 }
1724
1725 Mpo<Symmetry,Scalar> res_dn = Id();
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())
1730 {
1731 res_dn = sum(res_dn,cdagc<DN,DN>(locx2,locx1,locy2,locy1));
1732 }
1733
1734 return prod(res_up,res_dn);
1735}
1736#endif
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)
SPIN_INDEX
Definition: DmrgTypedefs.h:36
@ DN
Definition: DmrgTypedefs.h:38
@ UP
Definition: DmrgTypedefs.h:37
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
SUB_LATTICE
Definition: DmrgTypedefs.h:130
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
vector< SUB_LATTICE > G
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 > &params, 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
std::size_t N_phys
Definition: MpoTerms.h:400
void finalize(const bool COMPRESS=true, const std::size_t power=1, const double tolerance=::mynumeric_limits< double >::epsilon())
Definition: MpoTerms.h:1281
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)
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)
Definition: Mpo.h:75
static SiteOperatorQ< Symmetry, MatrixType_ > prod(const SiteOperatorQ< Symmetry, MatrixType_ > &O1, const SiteOperatorQ< Symmetry, MatrixType_ > &O2, const qType &target)
std::string & label()
const bool COMPRESS
Definition: DmrgTypedefs.h:499
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