VMPS++
Loading...
Searching...
No Matches
HeisenbergU1xU1.h
Go to the documentation of this file.
1#ifndef DOUBLEHEISENBERGMODELU1
2#define DOUBLEHEISENBERGMODELU1
3
4#include "symmetry/S1xS2.h"
5#include "symmetry/U1.h"
6#include "bases/SpinBase.h"
7#include "bases/FermionBase.h"
10#include "Mpo.h"
11#include "ParamReturner.h"
12#include "Geometry2D.h" // from TOOLS
13
14namespace VMPS
15{
16
17class HeisenbergU1xU1 : public Mpo<Sym::S1xS2<Sym::U1<Sym::SpinU1>,Sym::U1<Sym::SpinU1> > ,double>,
18 public HeisenbergObservables<Sym::S1xS2<Sym::U1<Sym::SpinU1>,Sym::U1<Sym::SpinU1> > >,
19 public ParamReturner
20{
21public:
24
25private:
26
27 typedef Eigen::Index Index;
29 typedef Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic> MatrixType;
30
32
33public:
34
36
37 HeisenbergU1xU1(Mpo<Symmetry> &Mpo_input, const vector<Param> &params)
38 :Mpo<Symmetry>(Mpo_input),
41 {
42 ParamHandler P(params,HeisenbergU1xU1::defaults);
43 size_t Lcell = P.size();
44 N_phys = 0;
45 for (size_t l=0; l<N_sites; ++l) N_phys += P.get<size_t>("Ly",l%Lcell);
46 this->precalc_TwoSiteData();
47 this->HERMITIAN = true;
48 this->HAMILTONIAN = true;
49 };
50
51 HeisenbergU1xU1 (const size_t &L, const vector<Param> &params, const BC &boundary=BC::OPEN, const DMRG::VERBOSITY::OPTION &VERB=DMRG::VERBOSITY::OPTION::ON_EXIT);
52
62// template<typename Symmetry_>
63// static void set_operators (const std::vector<SpinBase<Symmetry_,0ul>> &B0, const std::vector<SpinBase<Symmetry_,1ul>> &B1,
64// const ParamHandler &P,
65// PushType<SiteOperator<Symmetry_,double>,double>& pushlist, std::vector<std::vector<std::string>>& labellist,
66// const BC boundary=BC::OPEN);
67
68 static qarray<2> singlet (int N=0) {return qarray<2>{0,0};};
69 static constexpr MODEL_FAMILY FAMILY = HEISENBERG;
70
71 static const map<string,any> defaults;
72 static const map<string,any> sweep_defaults;
73};
74
75const std::map<string,std::any> HeisenbergU1xU1::defaults =
76{
77 {"J",0.}, {"Jprime",0.}, {"Jrung",0.},
78 {"Jxy",0.}, {"Jxyprime",0.}, {"Jxyrung",0.},
79 {"Jz",0.}, {"Jzprime",0.}, {"Jzrung",0.},
80 {"R",0.},
81 {"Dy",0.}, {"Dyprime",0.}, {"Dyrung",0.},
82 {"Bz",0.}, {"Kz",0.},
83 {"mu",0.}, {"nu",0.}, // couple to Sz_i-1/2 and Sz_i+1/2
84 {"D",2ul}, {"maxPower",2ul}, {"CYLINDER",false}, {"Ly",1ul}, {"mfactor",1}
85};
86
87const map<string,any> HeisenbergU1xU1::sweep_defaults =
88{
89 {"max_alpha",100.}, {"min_alpha",1e-11}, {"lim_alpha",11ul}, {"eps_svd",1e-7},
90 {"Dincr_abs", 2ul}, {"Dincr_per", 2ul}, {"Dincr_rel", 1.1},
91 {"min_Nsv",1ul}, {"max_Nrich",-1},
92 {"max_halfsweeps",30ul}, {"min_halfsweeps",6ul},
93 {"Dinit",3ul}, {"Qinit",20ul}, {"Dlimit",500ul},
94 {"tol_eigval",1e-6}, {"tol_state",1e-5},
95 {"savePeriod",0ul}, {"CALC_S_ON_EXIT", true}, {"CONVTEST", DMRG::CONVTEST::VAR_2SITE}
96};
97
99HeisenbergU1xU1 (const size_t &L, const vector<Param> &params, const BC &boundary, const DMRG::VERBOSITY::OPTION &VERB)
100:Mpo<Symmetry> (L, Symmetry::qvacuum(), "", PROP::HERMITIAN, PROP::NON_UNITARY, boundary, VERB),
101 HeisenbergObservables(L,params,HeisenbergU1xU1::defaults),
102 ParamReturner(HeisenbergU1xU1::sweep_defaults)
103{
104 ParamHandler P(params,defaults);
105 size_t Lcell = P.size();
106
107// for (size_t l=0; l<N_sites; ++l)
108// {
109// N_phys += P.get<size_t>("Ly",l%Lcell);
110// setLocBasis((B0[l].get_basis().combine(B1[l].get_basis())).qloc(),l);
111// }
112 for (size_t l=0; l<N_sites; ++l)
113 {
114 N_phys += P.get<size_t>("Ly",l%Lcell);
115 setLocBasis(B[l].get_basis().qloc(),l);
116 }
117
118 this->set_name("HeisenbergSystemU1xBathU1");
119
121 std::vector<std::vector<std::string>> labellist;
122 //set_operators(B0, B1, P, pushlist, labellist, boundary);
123 HeisenbergU1::set_operators(B, P, pushlist, labellist, boundary);
124
125 this->construct_from_pushlist(pushlist, labellist, Lcell);
126 this->finalize(PROP::COMPRESS, P.get<size_t>("maxPower"));
127
128 this->precalc_TwoSiteData();
129}
130
131//template<typename Symmetry_>
132//void HeisenbergU1xU1::
133//set_operators (const std::vector<SpinBase<Symmetry_,0ul>> &B0, const std::vector<SpinBase<Symmetry_,1ul>> &B1, const ParamHandler &P, PushType<SiteOperator<Symmetry_,double>,double>& pushlist, std::vector<std::vector<std::string>>& labellist, const BC boundary)
134//{
135// std::size_t Lcell = P.size();
136// std::size_t N_sites = B0.size();
137// if(labellist.size() != N_sites) {labellist.resize(N_sites);}
138//
139// for (std::size_t loc=0; loc<N_sites; ++loc)
140// {
141// stringstream ss;
142// ss << "Ly=" << P.get<size_t>("Ly",loc%Lcell);
143// labellist[loc].push_back(ss.str());
144//
145// auto push_full = [&N_sites, &loc, &B0, &B1, &P, &pushlist, &labellist, &boundary]
146// (string xxxFull, string label,
147// const vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > &first,
148// const vector<vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > > &last,
149// vector<double> factor) -> void
150// {
151// ArrayXXd Full = P.get<Eigen::ArrayXXd>(xxxFull);
152// vector<vector<std::pair<size_t,double> > > R = Geometry2D::rangeFormat(Full);
153//
154// if (static_cast<bool>(boundary)) {assert(R.size() == N_sites and "Use an (N_sites)x(N_sites) hopping matrix for open BC!");}
155// else {assert(R.size() >= 2*N_sites and "Use at least a (2*N_sites)x(N_sites) hopping matrix for infinite BC!");}
156//
157// for (size_t j=0; j<first.size(); j++)
158// for (size_t h=0; h<R[loc].size(); ++h)
159// {
160// size_t range = R[loc][h].first;
161// double value = R[loc][h].second;
162//
163// if (range != 0)
164// {
165// vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > ops(range+1);
166// ops[0] = first[j];
167// for (size_t i=1; i<range; ++i)
168// {
169// ops[i] = OperatorType::outerprod(B0[(loc+i)%N_sites].Id(), B1[(loc+i)%N_sites].Id());
170// }
171// ops[range] = last[j][(loc+range)%N_sites];
172// pushlist.push_back(std::make_tuple(loc, ops, factor[j] * value));
173// }
174// }
175//
176// stringstream ss;
177// ss << label << "(" << Geometry2D::hoppingInfo(Full) << ")";
178// labellist[loc].push_back(ss.str());
179// };
180//
181// if (P.HAS("Kfull"))
182// {
183// vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > first
184// {
185// OperatorType::outerprod(B0[loc].Sp(0), B1[loc].Sm(0)),
186// OperatorType::outerprod(B0[loc].Sm(0), B1[loc].Sp(0)),
188// };
189//
190// vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > S1_ranges(N_sites);
191// vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > S2_ranges(N_sites);
193// for (size_t i=0; i<N_sites; i++)
194// {
195// S1_ranges[i] = OperatorType::outerprod(B0[i].Sm(0), B1[i].Sp(0));
196// S2_ranges[i] = OperatorType::outerprod(B0[i].Sp(0), B1[i].Sm(0));
198// }
199// vector<vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > > last {S1_ranges, S2_ranges};
200// push_full("Kfull", "Kᵢⱼ", first, last, {0.5,0.5});
201// }
202//
218//
219// if (P.HAS("J1full"))
220// {
221// vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > first
222// {
223// OperatorType::outerprod(B0[loc].Sp(0), B1[loc].Id()),
224// OperatorType::outerprod(B0[loc].Sm(0), B1[loc].Id()),
225// OperatorType::outerprod(B0[loc].Sz(0), B1[loc].Id())
226// };
227//
228// vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > Sp_ranges(N_sites);
229// vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > Sm_ranges(N_sites);
230// vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > Sz_ranges(N_sites);
231// for (size_t i=0; i<N_sites; i++)
232// {
233// Sp_ranges[i] = OperatorType::outerprod(B0[i].Sp(0), B1[i].Id());
234// Sm_ranges[i] = OperatorType::outerprod(B0[i].Sm(0), B1[i].Id());
235// Sz_ranges[i] = OperatorType::outerprod(B0[i].Sz(0), B1[i].Id());
236// }
237//
238// vector<vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > > last {Sm_ranges, Sp_ranges, Sz_ranges};
239//
240// push_full("J1full", "J1ᵢⱼ", first, last, {0.5,0.5,1.0});
241// }
242//
243// if (P.HAS("J2full"))
244// {
245// vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > first
246// {
247// OperatorType::outerprod(B0[loc].Id(), B1[loc].Sp(0)),
248// OperatorType::outerprod(B0[loc].Id(), B1[loc].Sm(0)),
249// OperatorType::outerprod(B0[loc].Id(), B1[loc].Sz(0))
250// };
251//
252// vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > Sp_ranges(N_sites);
253// vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > Sm_ranges(N_sites);
254// vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > Sz_ranges(N_sites);
255// for (size_t i=0; i<N_sites; i++)
256// {
257// Sp_ranges[i] = OperatorType::outerprod(B0[i].Id(), B1[i].Sp(0));
258// Sm_ranges[i] = OperatorType::outerprod(B0[i].Id(), B1[i].Sm(0));
259// Sz_ranges[i] = OperatorType::outerprod(B0[i].Id(), B1[i].Sz(0));
260// }
261//
262// vector<vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > > last {Sm_ranges, Sp_ranges, Sz_ranges};
263//
264// push_full("J2full", "J2ᵢⱼ", first, last, {0.5,0.5,1.0});
265// }
266// }
267//}
268
269} //end namespace VMPS
270#endif
MODEL_FAMILY
Definition: DmrgTypedefs.h:96
@ HEISENBERG
Definition: DmrgTypedefs.h:96
BC
Definition: DmrgTypedefs.h:161
vector< SpinBase< Sym::S1xS2< Sym::U1< Sym::SpinU1 >, Sym::U1< Sym::SpinU1 > > > > B
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
Definition: Mpo.h:40
void precalc_TwoSiteData(bool FORCE=false)
bool HAMILTONIAN
Definition: Mpo.h:160
bool HERMITIAN
Definition: Mpo.h:159
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.
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
static const map< string, any > defaults
static qarray< 2 > singlet(int N=0)
static constexpr MODEL_FAMILY FAMILY
Symmetry::qType qType
SiteOperatorQ< Symmetry, MatrixType > OperatorType
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixType
Sym::S1xS2< Sym::U1< Sym::SpinU1 >, Sym::U1< Sym::SpinU1 > > Symmetry
HeisenbergU1xU1(Mpo< Symmetry > &Mpo_input, const vector< Param > &params)
static const map< string, any > sweep_defaults
#define MAKE_TYPEDEFS(MODEL)
Definition: macros.h:4
const bool COMPRESS
Definition: DmrgTypedefs.h:499
Definition: qarray.h:26