VMPS++
Loading...
Searching...
No Matches
DoubleHeisenbergSU2.h
Go to the documentation of this file.
1#ifndef DOUBLEHEISENBERGMODELSU2
2#define DOUBLEHEISENBERGMODELSU2
3
4#include "symmetry/S1xS2.h"
5#include "symmetry/SU2.h"
6#include "bases/SpinBase.h"
7#include "bases/FermionBase.h"
9#include "Mpo.h"
10#include "ParamReturner.h"
11#include "Geometry2D.h" // from TOOLS
12
13namespace VMPS
14{
15
16class DoubleHeisenbergSU2 : public Mpo<Sym::S1xS2<Sym::SU2<Sym::SpinSU2>,Sym::SU2<Sym::AltSpinSU2> > ,double>,
17 public DoubleHeisenbergObservables<Sym::S1xS2<Sym::SU2<Sym::SpinSU2>,Sym::SU2<Sym::AltSpinSU2> > >,
18 public ParamReturner
19{
20public:
23
24private:
25
26 typedef Eigen::Index Index;
28 typedef Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic> MatrixType;
29
31
32public:
33
35 DoubleHeisenbergSU2 (const size_t &L, const vector<Param> &params, const BC &boundary=BC::OPEN, const DMRG::VERBOSITY::OPTION &VERB=DMRG::VERBOSITY::OPTION::ON_EXIT);
36
46 template<typename Symmetry_>
47 static void set_operators (const std::vector<SpinBase<Symmetry_,0ul>> &B0, const std::vector<SpinBase<Symmetry_,1ul>> &B1,
48 const ParamHandler &P,
49 PushType<SiteOperator<Symmetry_,double>,double>& pushlist, std::vector<std::vector<std::string>>& labellist,
50 const BC boundary=BC::OPEN);
51
52 static qarray<2> singlet (int N=0) {return qarray<2>{1,1};};
53 static constexpr MODEL_FAMILY FAMILY = HEISENBERG;
54
55 static const map<string,any> defaults;
56 static const map<string,any> sweep_defaults;
57};
58
59const map<string,any> DoubleHeisenbergSU2::defaults =
60{
61 {"D",2ul}, {"maxPower",2ul}, {"CYLINDER",false}, {"Ly",1ul}
62};
63
64const map<string,any> DoubleHeisenbergSU2::sweep_defaults =
65{
66 {"max_alpha",100.}, {"min_alpha",1e-11}, {"lim_alpha",11ul}, {"eps_svd",1e-7},
67 {"Dincr_abs", 2ul}, {"Dincr_per", 2ul}, {"Dincr_rel", 1.1},
68 {"min_Nsv",1ul}, {"max_Nrich",-1},
69 {"max_halfsweeps",30ul}, {"min_halfsweeps",6ul},
70 {"Dinit",3ul}, {"Qinit",20ul}, {"Dlimit",500ul},
71 {"tol_eigval",1e-6}, {"tol_state",1e-5},
72 {"savePeriod",0ul}, {"CALC_S_ON_EXIT", true}, {"CONVTEST", DMRG::CONVTEST::VAR_2SITE}
73};
74
76DoubleHeisenbergSU2 (const size_t &L, const vector<Param> &params, const BC &boundary, const DMRG::VERBOSITY::OPTION &VERB)
77:Mpo<Symmetry> (L, Symmetry::qvacuum(), "", PROP::HERMITIAN, PROP::NON_UNITARY, boundary, VERB),
79 ParamReturner(DoubleHeisenbergSU2::sweep_defaults)
80{
81 ParamHandler P(params,defaults);
82 size_t Lcell = P.size();
83
84 for (size_t l=0; l<N_sites; ++l)
85 {
86 N_phys += P.get<size_t>("Ly",l%Lcell);
87 setLocBasis((B0[l].get_basis().combine(B1[l].get_basis())).qloc(),l);
88 }
89
90 this->set_name("DoubleHeisenberg");
91
93 std::vector<std::vector<std::string>> labellist;
94 set_operators(B0, B1, P, pushlist, labellist, boundary);
95
96 this->construct_from_pushlist(pushlist, labellist, Lcell);
97 this->finalize(PROP::COMPRESS, P.get<size_t>("maxPower"));
98
99 this->precalc_TwoSiteData();
100}
101
102template<typename Symmetry_>
104set_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)
105{
106 std::size_t Lcell = P.size();
107 std::size_t N_sites = B0.size();
108 if(labellist.size() != N_sites) {labellist.resize(N_sites);}
109
110 for (std::size_t loc=0; loc<N_sites; ++loc)
111 {
112 stringstream ss;
113 ss << "Ly=" << P.get<size_t>("Ly",loc%Lcell);
114 labellist[loc].push_back(ss.str());
115
116 auto push_full = [&N_sites, &loc, &B0, &B1, &P, &pushlist, &labellist, &boundary]
117 (string xxxFull, string label,
118 const vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > &first,
119 const vector<vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > > &last,
120 vector<double> factor) -> void
121 {
122 ArrayXXd Full = P.get<Eigen::ArrayXXd>(xxxFull);
123 vector<vector<std::pair<size_t,double> > > R = Geometry2D::rangeFormat(Full);
124
125 if (static_cast<bool>(boundary)) {assert(R.size() == N_sites and "Use an (N_sites)x(N_sites) hopping matrix for open BC!");}
126 else {assert(R.size() >= 2*N_sites and "Use at least a (2*N_sites)x(N_sites) hopping matrix for infinite BC!");}
127
128 for (size_t j=0; j<first.size(); j++)
129 for (size_t h=0; h<R[loc].size(); ++h)
130 {
131 size_t range = R[loc][h].first;
132 double value = R[loc][h].second;
133
134 if (range != 0)
135 {
136 vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > ops(range+1);
137 ops[0] = first[j];
138 for (size_t i=1; i<range; ++i)
139 {
140 ops[i] = OperatorType::outerprod(B0[(loc+i)%N_sites].Id(), B1[(loc+i)%N_sites].Id());
141 }
142 ops[range] = last[j][(loc+range)%N_sites];
143 pushlist.push_back(std::make_tuple(loc, ops, factor[j] * value));
144 }
145 }
146
147 stringstream ss;
148 ss << label << "(" << Geometry2D::hoppingInfo(Full) << ")";
149 labellist[loc].push_back(ss.str());
150 };
151
152 if (P.HAS("Kfull"))
153 {
154 vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > first {OperatorType::outerprod(B0[loc].Sdag(0), B1[loc].Sdag(0))};
155 vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > S_ranges(N_sites); for (size_t i=0; i<N_sites; i++)
156 {S_ranges[i] = OperatorType::outerprod(B0[i].S(0), B1[i].S(0));}
157 vector<vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > > last {S_ranges};
158 push_full("Kfull", "Kᵢⱼ", first, last, {3.});
159 }
160
161 if (P.HAS("J1full"))
162 {
163 vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > first {kroneckerProduct(B0[loc].Sdag(0), B1[loc].Id())};
164 vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > S_ranges(N_sites); for (size_t i=0; i<N_sites; i++)
165 {S_ranges[i] = kroneckerProduct(B0[i].S(0), B1[i].Id());}
166 vector<vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > > last {S_ranges};
167 push_full("J1full", "J1ᵢⱼ", first, last, {std::sqrt(3.)});
168 }
169
170 if (P.HAS("J2full"))
171 {
172 vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > first {kroneckerProduct(B0[loc].Id(), B1[loc].Sdag(0))};
173 vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > S_ranges(N_sites); for (size_t i=0; i<N_sites; i++)
174 {S_ranges[i] = kroneckerProduct(B0[i].Id(), B1[i].S(0));}
175 vector<vector<SiteOperatorQ<Symmetry_,Eigen::MatrixXd> > > last {S_ranges};
176 push_full("J2full", "J2ᵢⱼ", first, last, {std::sqrt(3.)});
177 }
178 }
179}
180
181} //end namespace VMPS
182#endif
MODEL_FAMILY
Definition: DmrgTypedefs.h:96
@ HEISENBERG
Definition: DmrgTypedefs.h:96
BC
Definition: DmrgTypedefs.h:161
SiteOperator< Symmetry, Scalar_ > kroneckerProduct(const SiteOperator< Symmetry, Scalar_ > &O1, const SiteOperator< Symmetry, Scalar_ > &O2)
Definition: SiteOperator.h:164
vector< SpinBase< Sym::S1xS2< Sym::SU2< Sym::SpinSU2 >, Sym::SU2< Sym::AltSpinSU2 > >, 0ul > > B0
std::enable_if< Dummy::IS_SPIN_SU2(), Mpo< Sym::S1xS2< Sym::SU2< Sym::SpinSU2 >, Sym::SU2< Sym::AltSpinSU2 > > > >::type S(size_t locx, size_t locy=0, double factor=1.) const
vector< SpinBase< Sym::S1xS2< Sym::SU2< Sym::SpinSU2 >, Sym::SU2< Sym::AltSpinSU2 > >, 1ul > > B1
std::enable_if< Dummy::IS_SPIN_SU2(), Mpo< Sym::S1xS2< Sym::SU2< Sym::SpinSU2 >, Sym::SU2< Sym::AltSpinSU2 > > > >::type Sdag(size_t locx, size_t locy=0, double factor=std::sqrt(3.)) 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
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)
static SiteOperatorQ< Symmetry, MatrixType_ > outerprod(const SiteOperatorQ< Symmetry, MatrixType_ > &O1, const SiteOperatorQ< Symmetry, MatrixType_ > &O2, const qType &target)
Definition: SU2.h:36
static void 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=BC::OPEN)
static qarray< 2 > singlet(int N=0)
SiteOperatorQ< Symmetry, MatrixType > OperatorType
Sym::S1xS2< Sym::SU2< Sym::SpinSU2 >, Sym::SU2< Sym::AltSpinSU2 > > Symmetry
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixType
static constexpr MODEL_FAMILY FAMILY
static const map< string, any > defaults
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