VMPS++
Loading...
Searching...
No Matches
HeisenbergU1XXZ.h
Go to the documentation of this file.
1#ifndef STRAWBERRY_HEISENBERGU1XXZ
2#define STRAWBERRY_HEISENBERGU1XXZ
3
5
6namespace VMPS
7{
8
30{
31public:
34
35 static qarray<1> singlet(int N=0) {return qarray<1>{0};};
36 static constexpr MODEL_FAMILY FAMILY = HEISENBERG;
37
38public:
39
41 HeisenbergU1XXZ (const size_t &L, const BC &boundary=BC::OPEN, const DMRG::VERBOSITY::OPTION& VERB=DMRG::VERBOSITY::OPTION::ON_EXIT);
42 HeisenbergU1XXZ (const size_t &L, const vector<Param> &params={}, const BC &boundary = BC::OPEN, const DMRG::VERBOSITY::OPTION& VERB=DMRG::VERBOSITY::OPTION::ON_EXIT);
43
44 template<typename Symmetry_>
45 static void add_operators (const std::vector<SpinBase<Symmetry_>> &B, const ParamHandler &P,
46 PushType<SiteOperator<Symmetry_,double>,double>& pushlist, std::vector<std::vector<std::string>>& labellist,
47 const BC boundary=BC::OPEN);
48
49 static const std::map<string,std::any> defaults;
50};
51
52const std::map<string,std::any> HeisenbergU1XXZ::defaults =
53{
54 {"Jxy",1.}, {"Jxyprime",0.}, {"Jxyrung",1.},
55 {"Jz",0.}, {"Jzprime",0.}, {"Jzrung",0.},
56
57 {"Dy",0.}, {"Dyprime",0.}, {"Dyrung",0.},
58 {"Bz",0.}, {"Kz",0.},
59 {"D",2ul}, {"maxPower",2ul}, {"CYLINDER",false}, {"Ly",1ul},
60
61 // for consistency during inheritance (should not be set for XXZ!):
62 {"J",0.}, {"Jprime",0.}
63};
64
66HeisenbergU1XXZ (const size_t &L, const BC &boundary, const DMRG::VERBOSITY::OPTION& VERB)
67:HeisenbergU1(L, boundary, VERB)
68{}
69
71HeisenbergU1XXZ (const size_t &L, const vector<Param> &params, const BC &boundary, const DMRG::VERBOSITY::OPTION& VERB)
72:HeisenbergU1(L, boundary, VERB)
73{
74 ParamHandler P(params,HeisenbergU1XXZ::defaults);
75 size_t Lcell = P.size();
76
77 for (size_t l=0; l<N_sites; ++l)
78 {
79 N_phys += P.get<size_t>("Ly",l%Lcell);
80
81 B[l] = SpinBase<Symmetry>(P.get<size_t>("Ly",l%Lcell), P.get<size_t>("D",l%Lcell));
82 setLocBasis(B[l].get_basis().qloc(),l);
83 }
84
85 if (P.HAS_ANY_OF({"Jxy", "Jxypara", "Jxyperp", "Jxyfull"}))
86 {
87 this->set_name("XXZ");
88 }
89 else
90 {
91 this->set_name("Ising");
92 }
93
95 std::vector<std::vector<std::string>> labellist;
96 set_operators(B, P, pushlist, labellist, boundary);
97 add_operators(B, P, pushlist, labellist, boundary);
98
99 this->construct_from_pushlist(pushlist, labellist, Lcell);
100 this->finalize(PROP::COMPRESS, P.get<size_t>("maxPower"));
101
102 this->precalc_TwoSiteData();
103}
104
105template<typename Symmetry_>
107add_operators (const std::vector<SpinBase<Symmetry_>> &B, const ParamHandler &P, PushType<SiteOperator<Symmetry_,double>,double>& pushlist, std::vector<std::vector<std::string>>& labellist, const BC boundary)
108{
109 std::size_t Lcell = P.size();
110 std::size_t N_sites = B.size();
111 if(labellist.size() != N_sites) {labellist.resize(N_sites);}
112
113 for (std::size_t loc=0; loc<N_sites; ++loc)
114 {
115 size_t lp1 = (loc+1)%N_sites;
116 size_t lp2 = (loc+2)%N_sites;
117
118 std::size_t orbitals = B[loc].orbitals();
119 std::size_t next_orbitals = B[lp1].orbitals();
120 std::size_t nextn_orbitals = B[lp2].orbitals();
121
122// stringstream ss1, ss2;
123// ss2 << "Ly=" << P.get<size_t>("Ly",loc%Lcell);
124// Terms.save_label(loc, ss2.str());
125
126 auto push_full = [&N_sites, &loc, &B, &P, &pushlist, &labellist, &boundary] (string xxxFull, string label,
127 const vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > &first,
128 const vector<vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > > &last,
129 vector<double> factor) -> void
130 {
131 ArrayXXd Full = P.get<Eigen::ArrayXXd>(xxxFull);
132 vector<vector<std::pair<size_t,double> > > R = Geometry2D::rangeFormat(Full);
133
134 if (static_cast<bool>(boundary)) {assert(R.size() == N_sites and "Use an (N_sites)x(N_sites) hopping matrix for open BC!");}
135 else {assert(R.size() >= 2*N_sites and "Use at least a (2*N_sites)x(N_sites) hopping matrix for infinite BC!");}
136
137 for (size_t j=0; j<first.size(); j++)
138 for (size_t h=0; h<R[loc].size(); ++h)
139 {
140 size_t range = R[loc][h].first;
141 double value = R[loc][h].second;
142
143 if (range != 0)
144 {
145
146 vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > ops(range+1);
147 ops[0] = first[j];
148 for (size_t i=1; i<range; ++i)
149 {
150 ops[i] = B[(loc+i)%N_sites].Id();
151 }
152 ops[range] = last[j][(loc+range)%N_sites];
153 pushlist.push_back(std::make_tuple(loc, ops, factor[j] * value));
154 }
155 }
156
157 stringstream ss;
158 ss << label << "(" << Geometry2D::hoppingInfo(Full) << ")";
159 labellist[loc].push_back(ss.str());
160 };
161
162 // Local terms: J⟂
163
164 param2d Jxyperp = P.fill_array2d<double>("Jxyrung", "Jxy", "Jxyperp", orbitals, loc%Lcell, P.get<bool>("CYLINDER"));
165 param2d Jzperp = P.fill_array2d<double>("Jzrung", "Jz", "Jzperp", orbitals, loc%Lcell, P.get<bool>("CYLINDER"));
166
167 labellist[loc].push_back(Jxyperp.label);
168 labellist[loc].push_back(Jzperp.label);
169
170 ArrayXd Bz_array = B[loc].ZeroField();
171 ArrayXd Bx_array = B[loc].ZeroField();
172 ArrayXd mu_array = B[loc].ZeroField();
173 ArrayXd Kz_array = B[loc].ZeroField();
174 ArrayXd Kx_array = B[loc].ZeroField();
175 ArrayXXd Dyperp_array = B[loc].ZeroHopping();
176
177 auto Hloc = Mpo<Symmetry,double>::get_N_site_interaction(B[loc].HeisenbergHamiltonian(Jxyperp.a, Jzperp.a, Bz_array, mu_array, Kz_array));
178 pushlist.push_back(std::make_tuple(loc, Hloc, 1.));
179
180 // Case, where a full coupling-matrix is provided: Jᵢⱼ
181 if (P.HAS("Jxyfull"))
182 {
183 vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > first {B[loc].Sp(0), B[loc].Sm(0)};
184 vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > Sp_ranges(N_sites);
185 vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > Sm_ranges(N_sites);
186 for (size_t i=0; i<N_sites; i++) {Sp_ranges[i] = B[i].Sp(0); Sm_ranges[i] = B[i].Sm(0);}
187
188 vector<vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > > last {Sm_ranges, Sp_ranges};
189 push_full("Jxyfull", "Jxyᵢⱼ", first, last, {0.5,0.5});
190 }
191 if (P.HAS("Jzfull"))
192 {
193 vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > first {B[loc].Sz(0)};
194 vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > Sz_ranges(N_sites);
195 for (size_t i=0; i<N_sites; i++) {Sz_ranges[i] = B[i].Sz(0);}
196
197 vector<vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > > last {Sz_ranges};
198 push_full("Jzfull", "Jzᵢⱼ", first, last, {1.0});
199 }
200
201 if (P.HAS("Jxyfull") or P.HAS("Jzfull")) continue;
202
203 // Nearest-neighbour terms: J
204
205 param2d Jxypara = P.fill_array2d<double>("Jxy", "Jxypara", {orbitals, next_orbitals}, loc%Lcell);
206 param2d Jzpara = P.fill_array2d<double>("Jz", "Jzpara", {orbitals, next_orbitals}, loc%Lcell);
207
208 labellist[loc].push_back(Jxypara.label);
209 labellist[loc].push_back(Jzpara.label);
210
211// if (!P.HAS("Jxy"))
212// {
213// labellist[loc].push_back("def.Jxy=1.");
214// }
215
216 if (loc < N_sites-1 or !static_cast<bool>(boundary))
217 {
218 for (std::size_t alfa=0; alfa < orbitals; ++alfa)
219 for (std::size_t beta=0; beta < next_orbitals; ++beta)
220 {
221 pushlist.push_back(std::make_tuple(loc, Mpo<Symmetry,double>::get_N_site_interaction(B[loc].Scomp(SP,alfa), B[lp1].Scomp(SM,beta)), 0.5*Jxypara(alfa,beta)));
222 pushlist.push_back(std::make_tuple(loc, Mpo<Symmetry,double>::get_N_site_interaction(B[loc].Scomp(SM,alfa), B[lp1].Scomp(SP,beta)), 0.5*Jxypara(alfa,beta)));
223 pushlist.push_back(std::make_tuple(loc, Mpo<Symmetry,double>::get_N_site_interaction(B[loc].Scomp(SZ,alfa), B[lp1].Scomp(SZ,beta)), Jzpara(alfa,beta)));
224 }
225 }
226
227 // Next-nearest-neighbour terms: J'
228
229 param2d Jxyprime = P.fill_array2d<double>("Jxyprime", "Jxyprime_array", {orbitals, nextn_orbitals}, loc%Lcell);
230 param2d Jzprime = P.fill_array2d<double>("Jzprime", "Jzprime_array", {orbitals, nextn_orbitals}, loc%Lcell);
231
232 labellist[loc].push_back(Jxyprime.label);
233 labellist[loc].push_back(Jzprime.label);
234
235 if (loc < N_sites-2 or !static_cast<bool>(boundary))
236 {
237 for (std::size_t alfa=0; alfa < orbitals; ++alfa)
238 for (std::size_t beta=0; beta < nextn_orbitals; ++beta)
239 {
240 pushlist.push_back(std::make_tuple(loc, Mpo<Symmetry,double>::get_N_site_interaction(B[loc].Scomp(SP,alfa), B[lp1].Id(), B[lp2].Scomp(SM,beta)), 0.5*Jxyprime(alfa,beta)));
241 pushlist.push_back(std::make_tuple(loc, Mpo<Symmetry,double>::get_N_site_interaction(B[loc].Scomp(SM,alfa), B[lp1].Id(), B[lp2].Scomp(SP,beta)), 0.5*Jxyprime(alfa,beta)));
242 pushlist.push_back(std::make_tuple(loc, Mpo<Symmetry,double>::get_N_site_interaction(B[loc].Scomp(SZ,alfa), B[lp1].Id(), B[lp2].Scomp(SZ,beta)), Jzprime(alfa,beta)));
243 }
244 }
245 }
246}
247
248} //end namespace VMPS
249
250#endif
MODEL_FAMILY
Definition: DmrgTypedefs.h:96
@ HEISENBERG
Definition: DmrgTypedefs.h:96
@ SZ
Definition: DmrgTypedefs.h:60
@ SP
Definition: DmrgTypedefs.h:60
@ SM
Definition: DmrgTypedefs.h:60
BC
Definition: DmrgTypedefs.h:161
@ B
Definition: DmrgTypedefs.h:130
vector< SpinBase< Sym::U1< Sym::SpinU1 > > > B
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Sym::U1< Sym::SpinU1 >, double > >::type Scomp(SPINOP_LABEL Sa, size_t locx, size_t locy=0, double factor=1.) 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
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: U1.h:25
Heisenberg Model with XXZ-coupling.
static qarray< 1 > singlet(int N=0)
Sym::U1< Sym::SpinU1 > Symmetry
static void add_operators(const std::vector< SpinBase< Symmetry_ > > &B, const ParamHandler &P, PushType< SiteOperator< Symmetry_, double >, double > &pushlist, std::vector< std::vector< std::string > > &labellist, const BC boundary=BC::OPEN)
static const std::map< string, std::any > defaults
static constexpr MODEL_FAMILY FAMILY
Heisenberg Model.
Definition: HeisenbergU1.h:41
static void set_operators(const std::vector< SpinBase< Symmetry_ > > &B, const ParamHandler &P, PushType< SiteOperator< Symmetry_, double >, double > &pushlist, std::vector< std::vector< std::string > > &labellist, const BC boundary=BC::OPEN)
Definition: HeisenbergU1.h:180
#define MAKE_TYPEDEFS(MODEL)
Definition: macros.h:4
const bool COMPRESS
Definition: DmrgTypedefs.h:499
Definition: qarray.h:26