1#ifndef KONDONECKLACE_H_
2#define KONDONECKLACE_H_
14#include "Geometry2D.h"
28 typedef Eigen::Matrix<
double,Eigen::Dynamic,Eigen::Dynamic>
MatrixType;
59 static const std::map<string,std::any>
defaults;
74 {
"Jlocxy",1.}, {
"Jlocz",1.}, {
"Jparaxy",1.}, {
"Jparaz",1.}, {
"Jperpxy",0.}, {
"Jperpz",0.}, {
"Jprimexy",1.}, {
"Jprimez",1.},
75 {
"Dimp",2ul}, {
"Dsub",2ul}, {
"Ly",1ul},
76 {
"maxPower",2ul}, {
"CYLINDER",
false}
81 {
"max_alpha",100.}, {
"min_alpha",1e-11}, {
"lim_alpha",12ul}, {
"eps_svd",1e-7},
82 {
"Dincr_abs", 4ul}, {
"Dincr_per", 2ul}, {
"Dincr_rel", 1.1},
83 {
"min_Nsv",1ul}, {
"max_Nrich",-1},
84 {
"max_halfsweeps",100ul}, {
"min_halfsweeps",24ul},
85 {
"Dinit",5ul}, {
"Qinit",6ul}, {
"Dlimit",250ul},
86 {
"tol_eigval",1e-9}, {
"tol_state",1e-8},
97 std::size_t Lcell = P.size();
100 for (
size_t loc=0; loc<
N_sites; ++loc)
102 N_phys += P.get<
size_t>(
"Ly",loc%Lcell);
107 std::vector<std::vector<std::string>> labellist(
N_sites);
119 std::size_t Lcell = P.size();
121 for(std::size_t loc=0; loc<
N_sites; ++loc)
123 std::size_t orbitals =
Bsub[loc].orbitals();
124 std::size_t next_orbitals =
Bsub[(loc+1)%
N_sites].orbitals();
125 std::size_t nextn_orbitals =
Bsub[(loc+2)%
N_sites].orbitals();
129 std::stringstream ss1, ss2, ss3;
132 ss3 <<
"Ly=" << P.get<
size_t>(
"Ly",loc%Lcell);
133 labellist[loc].push_back(ss1.str());
134 labellist[loc].push_back(ss2.str());
135 labellist[loc].push_back(ss3.str());
139 param1d Jlocxy = P.fill_array1d<
double>(
"Jlocxy",
"Jlocxy_array", orbitals, loc%Lcell);
140 param1d Jlocz = P.fill_array1d<
double>(
"Jlocz",
"Jlocz_array", orbitals, loc%Lcell);
143 labellist[loc].push_back(Jlocxy.label);
144 labellist[loc].push_back(Jlocz.label);
145 for(
int alpha=0; alpha<orbitals; ++alpha)
147 std::vector<OperatorType> ops(1);
151 pushlist.push_back(std::make_tuple(loc, ops, 1.));
155 auto push_full = [&
N_sites, &loc, &
Bimp, &
Bsub, &P, &pushlist, &labellist, &boundary] (
string xxxFull,
string label,
156 const vector<SiteOperatorQ<Symmetry,Eigen::MatrixXd> > &first,
157 const vector<vector<SiteOperatorQ<Symmetry,Eigen::MatrixXd> > > &last,
158 vector<double> factor) ->
void
160 ArrayXXd Full = P.get<Eigen::ArrayXXd>(xxxFull);
161 vector<vector<std::pair<size_t,double> > > R = Geometry2D::rangeFormat(Full);
163 if (
static_cast<bool>(boundary)) {assert(R.size() ==
N_sites and
"Use an (N_sites)x(N_sites) hopping matrix for open BC!");}
164 else {assert(R.size() >= 2*
N_sites and
"Use at least a (2*N_sites)x(N_sites) hopping matrix for infinite BC!");}
166 for (
size_t j=0; j<first.size(); j++)
167 for (
size_t h=0; h<R[loc].size(); ++h)
169 size_t range = R[loc][h].first;
170 double value = R[loc][h].second;
174 vector<SiteOperatorQ<Symmetry,Eigen::MatrixXd> > ops(range+1);
176 for (
size_t i=1; i<range; ++i)
180 ops[range] = last[j][(loc+range)%
N_sites];
181 pushlist.push_back(std::make_tuple(loc, ops, factor[j] * value));
186 ss <<
label <<
"(" << Geometry2D::hoppingInfo(Full) <<
")";
187 labellist[loc].push_back(ss.str());
191 if (P.HAS(
"Jxyfull"))
197 vector<vector<SiteOperatorQ<Symmetry,Eigen::MatrixXd> > > last {Sm_ranges,Sp_ranges};
198 push_full(
"Jxyfull",
"Jxyᵢⱼ", first, last, {0.5,0.5});
204 vector<vector<SiteOperatorQ<Symmetry,Eigen::MatrixXd> > > last {Sz_ranges};
205 push_full(
"Jzfull",
"Jzᵢⱼ", first, last, {1.});
207 if (P.HAS(
"Ixyfull"))
213 vector<vector<SiteOperatorQ<Symmetry,Eigen::MatrixXd> > > last {Sm_ranges,Sp_ranges};
214 push_full(
"Ixyfull",
"Ixyᵢⱼ", first, last, {0.5,0.5});
220 vector<vector<SiteOperatorQ<Symmetry,Eigen::MatrixXd> > > last {Sz_ranges};
221 push_full(
"Izfull",
"Izᵢⱼ", first, last, {1.});
223 if (P.HAS(
"Jzfull") or P.HAS(
"Jxyfull") or P.HAS(
"Izfull") or P.HAS(
"Ixyfull")) {
continue;}
boost::rational< int > frac
std::string print_frac_nice(frac r)
#define EIGEN_DEFAULT_SPARSE_INDEX_TYPE
SiteOperator< Symmetry, Scalar_ > kroneckerProduct(const SiteOperator< Symmetry, Scalar_ > &O1, const SiteOperator< Symmetry, Scalar_ > &O2)
std::enable_if<!Dummy::IS_SPIN_SU2(), Mpo< Sym::U0 > >::type Scomp(SPINOP_LABEL Sa, size_t locx, size_t locy=0, double factor=1.) const
vector< SpinBase< Sym::U0 > > Bsub
vector< SpinBase< Sym::U0 > > Bimp
void finalize(const bool COMPRESS=true, const std::size_t power=1, const double tolerance=::mynumeric_limits< double >::epsilon())
void set_verbosity(const DMRG::VERBOSITY::OPTION VERB_in)
void setLocBasis(const std::vector< std::vector< qType > > &q)
DMRG::VERBOSITY::OPTION VERB
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)
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixType
static const std::map< string, std::any > defaults
static const std::map< string, std::any > sweep_defaults
static constexpr MODEL_FAMILY FAMILY
Eigen::SparseMatrix< double, Eigen::ColMajor, EIGEN_DEFAULT_SPARSE_INDEX_TYPE > SparseMatrixType
bool validate(qType qnum)
static void set_operators(const std::vector< SpinBase< Symmetry > > &Bsub, const std::vector< SpinBase< Symmetry > > &Bimp, const ParamHandler &P, PushType< SiteOperator< Symmetry, double >, double > &pushlist, std::vector< std::vector< std::string > > &labellist, const BC boundary)
#define MAKE_TYPEDEFS(MODEL)