9#include <highfive/H5File.hpp>
21template <
typename Symmetry>
35 if constexpr(Symmetry::Nq > 0 and Symmetry::ANY_NON_ABELIAN) {
36 if constexpr(Symmetry::IS_SPIN[0] and Symmetry::NON_ABELIAN[0] and Symmetry::ABELIAN[1]) {
39 }
else if constexpr(Symmetry::ALL_ABELIAN) {
40 used_params = {
"t",
"Jkxy",
"Jkz",
"Ixy",
"Iz",
"tprime",
"Izprime",
"Ixyprime"};
42 if constexpr(Symmetry::Nq > 0 and Symmetry::ANY_NON_ABELIAN) {
43 if constexpr(Symmetry::IS_SPIN[0] and Symmetry::NON_ABELIAN[0] and Symmetry::ABELIAN[1]) {
52 gate = -
params[
"t"].get<
double>() * hop +
params[
"I"].get<double>() * SS;
53 gate2 =
params[
"tprime"].get<
double>() * hop +
params[
"Iprime"].get<double>() * SS;
54 local_gate = gate + 0.25 *
params[
"Jk"].get<
double>() * (SsxId + IdxSs);
56 }
else if constexpr(Symmetry::ALL_ABELIAN) {
75 gate = -
params[
"t"].get<
double>() * hop +
params[
"Iz"].get<double>() * SzSz + 0.5 *
params[
"Ixy"].get<
double>() * (SpSm + SmSp);
76 gate2 =
params[
"tprime"].get<
double>() * hop +
params[
"Izprime"].get<double>() * SzSz +
77 0.5 *
params[
"Ixyprime"].get<
double>() * (SpSm + SmSp);
78 local_gate = gate + 0.25 * (
params[
"Jkz"].get<
double>() * (SzszxId + IdxSzsz) +
79 0.5 *
params[
"Jkxy"].get<
double>() * ((SpsmxId + IdxSpsm) + (SmspxId + IdxSmsp)));
81 assert(
false and
"Symmetry is not supported in Kondo model.");
85 for(
auto& t : this->
data_h) { t = local_gate; }
88 for(
auto& t : this->
data_v) { t = local_gate; }
91 for(
auto& t : this->
data_d1) { t = gate2; }
94 for(
auto& t : this->
data_d2) { t = gate2; }
100 if constexpr(Symmetry::Nq > 0 and Symmetry::ANY_NON_ABELIAN) {
101 if constexpr(Symmetry::IS_SPIN[0] and Symmetry::NON_ABELIAN[0] and Symmetry::ABELIAN[1]) {
102 auto Sdags = std::make_unique<OneSiteObservable<double, Symmetry>>(
pat,
"Sdags");
103 for(
auto& t : Sdags->data) { t = std::sqrt(3.) *
Op::outerprod(
F.
Sdag(),
B.
S(), Symmetry::qvacuum()).
data.template trim<2>(); }
104 obs.push_back(std::move(Sdags));
106 for(
auto& t : cdagc->data_h) {
111 for(
auto& t : cdagc->data_v) {
116 for(
auto& t : cdagc->data_d1) {
121 for(
auto& t : cdagc->data_d2) {
132 obs.push_back(std::move(cdagc));
133 obs.push_back(std::move(SdagS));
135 }
else if constexpr(Symmetry::ALL_ABELIAN) {
136 auto Sz = std::make_unique<Xped::OneSiteObservable<double, Symmetry>>(
pat,
"Sz");
138 auto sz = std::make_unique<Xped::OneSiteObservable<double, Symmetry>>(
pat,
"sz");
140 auto nup = std::make_unique<Xped::OneSiteObservable<double, Symmetry>>(
pat,
"nup");
141 for(
auto& t : nup->data) { t =
Op::outerprod(
F.
n(Xped::SPIN_INDEX::UP),
B.
Id()).
data.template trim<2>(); }
142 auto ndn = std::make_unique<Xped::OneSiteObservable<double, Symmetry>>(
pat,
"ndn");
143 for(
auto& t : ndn->data) { t =
Op::outerprod(
F.
n(Xped::SPIN_INDEX::DN),
B.
Id()).
data.template trim<2>(); }
144 auto n = std::make_unique<Xped::OneSiteObservable<double, Symmetry>>(
pat,
"n");
146 auto d = std::make_unique<Xped::OneSiteObservable<double, Symmetry>>(
pat,
"d");
148 obs.push_back(std::move(nup));
149 obs.push_back(std::move(ndn));
150 obs.push_back(std::move(n));
151 obs.push_back(std::move(d));
152 obs.push_back(std::move(Sz));
153 obs.push_back(std::move(sz));
154 if constexpr(not Symmetry::ANY_IS_SPIN) {
155 auto Sx = std::make_unique<Xped::OneSiteObservable<double, Symmetry>>(
pat,
"Sx");
157 auto sx = std::make_unique<Xped::OneSiteObservable<double, Symmetry>>(
pat,
"sx");
160 obs.push_back(std::move(Sx));
161 obs.push_back(std::move(sx));
171 virtual std::string
format()
const override
178 for(
auto& ob :
obs) {
180 if(
auto* two =
dynamic_cast<TwoSiteObservable<double, Symmetry>*
>(ob.get()); two !=
nullptr) {
avg(env, *two); }
186 for(
auto& ob :
obs) {
188 if(
auto* two =
dynamic_cast<TwoSiteObservable<double, Symmetry>*
>(ob.get()); two !=
nullptr) {
avg(env, *two); }
194 for(
auto& ob :
obs) {
196 if(
auto* two =
dynamic_cast<TwoSiteObservable<double, Symmetry>*
>(ob.get()); two !=
nullptr) {
avg(env, *two); }
200 virtual std::string
getObsString(
const std::string& offset)
const override
203 for(
const auto& ob :
obs) {
204 out.append(ob->getResString(offset));
205 if(&ob != &
obs.back()) { out.push_back(
'\n'); }
210 virtual void obsToFile(HighFive::File& file,
const std::string& root =
"/")
const override
212 for(
const auto& ob :
obs) { ob->toFile(file, root); }
220 std::vector<std::unique_ptr<ObservableBase>>
obs;
Definition: FermionBase.hpp:25
std::enable_if< Dummy::IS_SPIN_SU2(), OperatorType >::type Sdag(std::size_t orbital=0) const
Definition: FermionBase.hpp:608
OperatorType Id(std::size_t orbital=0) const
Definition: FermionBase.hpp:733
std::enable_if<!Dummy::IS_SPIN_SU2(), OperatorType >::type Sz(std::size_t orbital=0) const
Definition: FermionBase.hpp:615
std::enable_if< Dummy::IS_SPIN_SU2() and!Dummy::IS_CHARGE_SU2(), OperatorType >::type cdag(std::size_t orbital=0) const
Definition: FermionBase.hpp:453
std::enable_if< true, OperatorType >::type n(std::size_t orbital=0) const
Definition: FermionBase.hpp:541
std::enable_if< Dummy::IS_SPIN_SU2() and!Dummy::IS_CHARGE_SU2(), OperatorType >::type c(std::size_t orbital=0) const
Definition: FermionBase.hpp:445
std::enable_if<!Dummy::IS_SPIN_SU2(), OperatorType >::type Sp(std::size_t orbital=0) const
Definition: FermionBase.hpp:622
std::enable_if<!Dummy::IS_CHARGE_SU2(), OperatorType >::type d(std::size_t orbital=0) const
Definition: FermionBase.hpp:570
std::enable_if< Dummy::NO_SPIN_SYM(), OperatorType >::type Sx(std::size_t orbital=0) const
Definition: FermionBase.hpp:636
std::enable_if<!Dummy::IS_SPIN_SU2(), OperatorType >::type Sm(std::size_t orbital=0) const
Definition: FermionBase.hpp:629
virtual void computeObs(XPED_CONST CTM< double, Symmetry, 2, false, Opts::CTMCheckpoint{}> &env) override
Definition: Kondo.hpp:176
virtual void computeObs(XPED_CONST CTM< double, Symmetry, 1, false, Opts::CTMCheckpoint{}> &env) override
Definition: Kondo.hpp:192
virtual std::string format() const override
Definition: Kondo.hpp:171
SpinBase< Symmetry > B
Definition: Kondo.hpp:218
virtual std::string file_name() const override
Definition: Kondo.hpp:166
std::map< std::string, Param > params
Definition: Kondo.hpp:215
Pattern pat
Definition: Kondo.hpp:216
Kondo(std::map< std::string, Param > ¶ms_in, const Pattern &pat_in, Opts::Bond bond=Opts::Bond::H|Opts::Bond::V)
Definition: Kondo.hpp:27
std::vector< std::string > used_params
Definition: Kondo.hpp:217
virtual void computeObs(XPED_CONST CTM< std::complex< double >, Symmetry, 2, false, Opts::CTMCheckpoint{}> &env) override
Definition: Kondo.hpp:184
FermionBase< Symmetry > F
Definition: Kondo.hpp:219
std::vector< std::unique_ptr< ObservableBase > > obs
Definition: Kondo.hpp:220
virtual void setDefaultObs() override
Definition: Kondo.hpp:98
virtual void obsToFile(HighFive::File &file, const std::string &root="/") const override
Definition: Kondo.hpp:210
virtual std::string getObsString(const std::string &offset) const override
Definition: Kondo.hpp:200
Definition: SpinBase.hpp:23
std::enable_if< Dummy::IS_SPIN_SU2(), OperatorType >::type S(std::size_t orbital=0) const
Definition: SpinBase.hpp:387
std::enable_if<!Dummy::IS_SPIN_SU2(), OperatorType >::type Sz(std::size_t orbital=0) const
Definition: SpinBase.hpp:450
OperatorType Id(std::size_t orbital=0) const
Definition: SpinBase.hpp:499
std::enable_if< Dummy::NO_SPIN_SYM(), OperatorType >::type Sx(std::size_t orbital=0) const
Definition: SpinBase.hpp:471
std::enable_if<!Dummy::IS_SPIN_SU2(), OperatorType >::type Sp(std::size_t orbital=0) const
Definition: SpinBase.hpp:457
std::enable_if< Dummy::IS_SPIN_SU2(), OperatorType >::type Sdag(std::size_t orbital=0) const
Definition: SpinBase.hpp:394
std::enable_if<!Dummy::IS_SPIN_SU2(), OperatorType >::type Sm(std::size_t orbital=0) const
Definition: SpinBase.hpp:464
Definition: Tensor.hpp:40
Bond
Definition: Bonds.hpp:10
std::string format_params(const std::string &name, const std::map< std::string, Param > ¶ms, const std::vector< std::string > &used_params)
Definition: Helpers.hpp:12
std::string create_filename(const std::string &name, const std::map< std::string, Param > ¶ms, const std::vector< std::string > &used_params)
Definition: Helpers.hpp:26
TMatrix< std::conditional_t< ENABLE_AD, stan::math::var, typename OneSiteObservable< OpScalar, Symmetry, HERMITIAN >::ObsScalar > > avg(XPED_CONST CTM< Scalar, Symmetry, TRank, ENABLE_AD, CPOpts > &env, OneSiteObservable< OpScalar, Symmetry, HERMITIAN > &op)
Definition: LinearAlgebra.cpp:11
Tensor< Scalar, 2, 2, Symmetry, false > tprod(XPED_CONST SiteOperator< Scalar, Symmetry > &O1, XPED_CONST SiteOperator< Scalar, Symmetry > &O2, bool ADD_TWIST=false, bool REVERSE_ORDER=false)
Definition: SiteOperator.hpp:150
Definition: OneSiteObservable.hpp:21
Definition: CTMOpts.hpp:96
Definition: Pattern.hpp:18
std::size_t Ly
Definition: Pattern.hpp:72
std::size_t Lx
Definition: Pattern.hpp:72
Tensor< Scalar, 1, 2, Symmetry, false > data
Definition: SiteOperator.hpp:86
static SiteOperator< Scalar, Symmetry > outerprod(XPED_CONST SiteOperator< Scalar, Symmetry > &O1, XPED_CONST SiteOperator< Scalar, Symmetry > &O2, const qType &target)
Definition: SiteOperator.cpp:51
Definition: TwoSiteObservable.hpp:22
TMatrix< Tensor< double, 2, 2, Symmetry, false > > data_h
Definition: TwoSiteObservable.hpp:287
TMatrix< Tensor< double, 2, 2, Symmetry, false > > data_v
Definition: TwoSiteObservable.hpp:288
TMatrix< Tensor< double, 2, 2, Symmetry, false > > data_d1
Definition: TwoSiteObservable.hpp:289
Opts::Bond bond
Definition: TwoSiteObservable.hpp:295
TMatrix< Tensor< double, 2, 2, Symmetry, false > > data_d2
Definition: TwoSiteObservable.hpp:290