VMPS++
Loading...
Searching...
No Matches
HubbardComplex.h
Go to the documentation of this file.
1#ifndef VANILLA_GRANDHUBBARDMODEL_COMPLEX
2#define VANILLA_GRANDHUBBARDMODEL_COMPLEX
3
4#include "symmetry/U0.h"
5#include "bases/FermionBase.h"
7#include "ParamReturner.h"
8#include "Geometry2D.h" // from TOOLS
9
10namespace VMPS
11{
12class HubbardComplex : public Mpo<Sym::U0,complex<double> >, public HubbardObservables<Sym::U0,complex<double> >, public ParamReturner
13{
14public:
17
19
20 HubbardComplex(Mpo<Symmetry,complex<double> > &Mpo_input, const vector<Param> &params)
21 :Mpo<Symmetry,complex<double> >(Mpo_input),
24 {
25 ParamHandler P(params,HubbardComplex::defaults);
26 size_t Lcell = P.size();
27 N_phys = 0;
28 for (size_t l=0; l<N_sites; ++l) N_phys += P.get<size_t>("Ly",l%Lcell);
29 this->precalc_TwoSiteData();
30 this->HERMITIAN = true;
31 this->HAMILTONIAN = true;
32 };
33
34 HubbardComplex (const size_t &L, const vector<Param> &params, const BC &boundary=BC::OPEN, const DMRG::VERBOSITY::OPTION &VERB=DMRG::VERBOSITY::OPTION::ON_EXIT);
35
36 static qarray<0> singlet (int N) {return qarray<0>{};};
37 static constexpr MODEL_FAMILY FAMILY = HUBBARD;
38 static constexpr int spinfac = 2;
39
40 template<typename Symmetry_>
41 static void set_operators (const std::vector<FermionBase<Symmetry_> > &F, const ParamHandler &P,
42 PushType<SiteOperator<Symmetry_,complex<double> >,complex<double> >& pushlist,
43 std::vector<std::vector<std::string>>& labellist,
44 const BC boundary=BC::OPEN);
45
46 static const std::map<string,std::any> defaults;
47};
48
49const std::map<string,std::any> HubbardComplex::defaults =
50{
51 {"t",1.}, {"tPrime",0.}, {"tRung",1.},
52 {"mu",0.}, {"t0",0.}, {"Fp", 0.},
53 {"U",0.}, {"Uph",0.},
54 {"V",0.}, {"Vrung",0.},
55 {"Vxy",0.}, {"Vz",0.},
56 {"Bz",0.}, {"Bx",0.},
57 {"J",0.}, {"Jrung",0.},
58 {"J3site",0.},
59 {"Delta",0.}, {"DeltaUP",0.}, {"DeltaDN",0.},
60 {"X",0.}, {"Xperp",0.},
61 {"REMOVE_DOUBLE",false}, {"REMOVE_EMPTY",false}, {"REMOVE_UP",false}, {"REMOVE_DN",false}, {"mfactor",1}, {"k",0},
62 {"maxPower",2ul}, {"CYLINDER",false}, {"Ly",1ul}
63};
64
66HubbardComplex (const size_t &L, const vector<Param> &params, const BC &boundary, const DMRG::VERBOSITY::OPTION &VERB)
67:Mpo<Symmetry,complex<double> > (L, Symmetry::qvacuum(), "", PROP::HERMITIAN, PROP::NON_UNITARY, boundary, VERB),
68 HubbardObservables(L,params,HubbardComplex::defaults),
70{
71 ParamHandler P(params,HubbardComplex::defaults);
72
73 size_t Lcell = P.size();
74
75 for (size_t l=0; l<N_sites; ++l)
76 {
77 N_phys += P.get<size_t>("Ly",l%Lcell);
78 setLocBasis(F[l].get_basis().qloc(),l);
79 }
80
81 this->set_name("Hubbard");
82
83 PushType<SiteOperator<Symmetry,complex<double> >,complex<double> > pushlist;
84 std::vector<std::vector<std::string>> labellist;
85 HubbardComplex::set_operators(F, P, pushlist, labellist, boundary);
86
87 this->construct_from_pushlist(pushlist, labellist, Lcell);
88 this->finalize(PROP::COMPRESS, P.get<size_t>("maxPower"));
89
90 this->precalc_TwoSiteData();
91}
92
93template<typename Symmetry_>
95set_operators (const std::vector<FermionBase<Symmetry_> > &F, const ParamHandler &P, PushType<SiteOperator<Symmetry_,complex<double> >,complex<double> >& pushlist, std::vector<std::vector<std::string>>& labellist, const BC boundary)
96{
97 std::size_t Lcell = P.size();
98 std::size_t N_sites = F.size();
99 if(labellist.size() != N_sites) {labellist.resize(N_sites);}
100
101 for (std::size_t loc=0; loc<N_sites; ++loc)
102 {
103 size_t lp1 = (loc+1)%N_sites;
104 size_t lp2 = (loc+2)%N_sites;
105
106 std::size_t orbitals = F[loc].orbitals();
107 std::size_t next_orbitals = F[lp1].orbitals();
108 std::size_t nextn_orbitals = F[lp2].orbitals();
109
110 stringstream ss;
111 ss << "Ly=" << P.get<size_t>("Ly",loc%Lcell);
112 labellist[loc].push_back(ss.str());
113
114 auto push_full = [&N_sites, &loc, &F, &P, &pushlist, &labellist, &boundary] (string xxxFull, string label,
115 const vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXcd> > &first,
116 const vector<vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXcd> > > &last,
117 vector<double> factor, bool FERMIONIC) -> void
118 {
119 ArrayXXcd Full = P.get<Eigen::ArrayXXcd>(xxxFull);
120 vector<vector<std::pair<size_t,double> > > R = Geometry2D::rangeFormat(Full);
121
122 if (static_cast<bool>(boundary)) {assert(R.size() == N_sites and "Use an (N_sites)x(N_sites) hopping matrix for open BC!");}
123 else {assert(R.size() >= 2*N_sites and "Use at least a (2*N_sites)x(N_sites) hopping matrix for infinite BC!");}
124
125 for (size_t j=0; j<first.size(); j++)
126 for (size_t h=0; h<R[loc].size(); ++h)
127 {
128 size_t range = R[loc][h].first;
129 double value = R[loc][h].second;
130
131 if (range != 0)
132 {
133 vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXcd> > ops(range+1);
134 ops[0] = first[j];
135 for (size_t i=1; i<range; ++i)
136 {
137 if (FERMIONIC) {ops[i] = F[(loc+i)%N_sites].sign().template cast<complex<double> >();}
138 else {ops[i] = F[(loc+i)%N_sites].Id().template cast<complex<double> >();}
139 }
140 ops[range] = last[j][(loc+range)%N_sites];
141 pushlist.push_back(std::make_tuple(loc, ops, factor[j] * value));
142 }
143 }
144
145 stringstream ss;
146 ss << label << "(" << Geometry2D::hoppingInfo(Full) << ")";
147 labellist[loc].push_back(ss.str());
148 };
149
150 if (P.HAS("tFull"))
151 {
152 SiteOperatorQ<Symmetry_,Eigen::MatrixXcd> cUP_sign_local = (F[loc].c(UP,0) * F[loc].sign()).template cast<complex<double> >();
153 SiteOperatorQ<Symmetry_,Eigen::MatrixXcd> cDN_sign_local = (F[loc].c(DN,0) * F[loc].sign()).template cast<complex<double> >();
154 SiteOperatorQ<Symmetry_,Eigen::MatrixXcd> cdagUP_sign_local = (F[loc].cdag(UP,0) * F[loc].sign()).template cast<complex<double> >();
155 SiteOperatorQ<Symmetry_,Eigen::MatrixXcd> cdagDN_sign_local = (F[loc].cdag(DN,0) * F[loc].sign()).template cast<complex<double> >();
156
157 vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXcd> > cUP_ranges(N_sites); for (size_t i=0; i<N_sites; ++i) {cUP_ranges[i] = F[i].c(UP,0).template cast<complex<double> >();}
158 vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXcd> > cdagUP_ranges(N_sites); for (size_t i=0; i<N_sites; ++i) {cdagUP_ranges[i] = F[i].cdag(UP,0).template cast<complex<double> >();}
159 vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXcd> > cDN_ranges(N_sites); for (size_t i=0; i<N_sites; ++i) {cDN_ranges[i] = F[i].c(DN,0).template cast<complex<double> >();}
160 vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXcd> > cdagDN_ranges(N_sites); for (size_t i=0; i<N_sites; ++i) {cdagDN_ranges[i] = F[i].cdag(DN,0).template cast<complex<double> >();}
161
162 vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXcd> > frst {cdagUP_sign_local, cUP_sign_local, cdagDN_sign_local, cDN_sign_local};
163 vector<vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXcd> > > last {cUP_ranges, cdagUP_ranges, cDN_ranges, cdagDN_ranges};
164 push_full("tFull", "tᵢⱼ", frst, last, {-1., +1., -1., +1.}, PROP::FERMIONIC);
165 }
166
167 // local terms: U, t0, μ, Bz, t⟂, V⟂, J⟂, X⟂
168
169 param1d U = P.fill_array1d<double>("U", "Uorb", orbitals, loc%Lcell);
170 param1d Uph = P.fill_array1d<double>("Uph", "Uorb", orbitals, loc%Lcell);
171 param1d t0 = P.fill_array1d<double>("t0", "t0orb", orbitals, loc%Lcell);
172 param1d mu = P.fill_array1d<double>("mu", "muorb", orbitals, loc%Lcell);
173 param1d Bz = P.fill_array1d<double>("Bz", "Bzorb", orbitals, loc%Lcell);
174 param2d tperp = P.fill_array2d<double>("tRung", "t", "tPerp", orbitals, loc%Lcell, P.get<bool>("CYLINDER"));
175 param2d Vperp = P.fill_array2d<double>("Vrung", "V", "Vperp", orbitals, loc%Lcell, P.get<bool>("CYLINDER"));
176 param2d Vxyperp = P.fill_array2d<double>("Vxyrung", "Vxy", "Vxyperp", orbitals, loc%Lcell, P.get<bool>("CYLINDER"));
177 param2d Vzperp = P.fill_array2d<double>("Vzrung", "Vz", "Vzperp", orbitals, loc%Lcell, P.get<bool>("CYLINDER"));
178 param2d Jperp = P.fill_array2d<double>("Jrung", "J", "Jperp", orbitals, loc%Lcell, P.get<bool>("CYLINDER"));
179
180 labellist[loc].push_back(U.label);
181 labellist[loc].push_back(Uph.label);
182 labellist[loc].push_back(t0.label);
183 labellist[loc].push_back(mu.label);
184 labellist[loc].push_back(Bz.label);
185 labellist[loc].push_back(tperp.label);
186 labellist[loc].push_back(Vperp.label);
187 labellist[loc].push_back(Jperp.label);
188 ArrayXd C_array = F[loc].ZeroField();
189
190 //ArrayXd Vxy_array = F[loc].ZeroHopping();
191 //ArrayXd Vz_array = F[loc].ZeroHopping();
192
194 (
195 F[loc].template HubbardHamiltonian<double>(U.a, Uph.a, t0.a-mu.a, Bz.a, tperp.a, Vperp.a, Vzperp.a, Vxyperp.a, Jperp.a, Jperp.a, C_array)
196 ).cast<complex<double> >());
197 pushlist.push_back(std::make_tuple(loc, Hloc, 1.+0.i));
198 }
199}
200
201}
202
203#endif
@ DN
Definition: DmrgTypedefs.h:38
@ UP
Definition: DmrgTypedefs.h:37
MODEL_FAMILY
Definition: DmrgTypedefs.h:96
@ HUBBARD
Definition: DmrgTypedefs.h:96
BC
Definition: DmrgTypedefs.h:161
std::enable_if< Dummy::IS_SPIN_SU2() and!Dummy::IS_CHARGE_SU2(), Mpo< Sym::U0, complex< double > > >::type P(size_t locx1, size_t locx2, size_t locy1=0, size_t locy2=0) const
Mpo< Sym::U0, complex< double > > Id() 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
std::size_t N_sites
Definition: MpoTerms.h:395
void setLocBasis(const std::vector< std::vector< qType > > &q)
Definition: MpoTerms.h:715
DMRG::VERBOSITY::OPTION VERB
Definition: MpoTerms.h:102
MpoTerms< Symmetry, OtherScalar > cast()
Definition: MpoTerms.h:3076
void set_name(const std::string &label_in)
Definition: MpoTerms.h:471
std::string label
Definition: MpoTerms.h:615
Definition: Mpo.h:40
static std::vector< T > get_N_site_interaction(T const &Op0, Operator const &... Ops)
Definition: Mpo.h:117
void precalc_TwoSiteData(bool FORCE=false)
void construct_from_pushlist(const PushType< OperatorType, CouplScalar > &pushlist, const std::vector< std::vector< std::string > > &labellist, size_t Lcell)
Definition: U0.h:28
HubbardComplex(Mpo< Symmetry, complex< double > > &Mpo_input, const vector< Param > &params)
static constexpr MODEL_FAMILY FAMILY
static void set_operators(const std::vector< FermionBase< Symmetry_ > > &F, const ParamHandler &P, PushType< SiteOperator< Symmetry_, complex< double > >, complex< double > > &pushlist, std::vector< std::vector< std::string > > &labellist, const BC boundary=BC::OPEN)
static const std::map< string, std::any > defaults
static constexpr int spinfac
static qarray< 0 > singlet(int N)
#define MAKE_TYPEDEFS(MODEL)
Definition: macros.h:4
const bool COMPRESS
Definition: DmrgTypedefs.h:499
const bool FERMIONIC
Definition: DmrgTypedefs.h:496
Definition: qarray.h:26