VMPS++
Loading...
Searching...
No Matches
SpinlessFermionSite.h
Go to the documentation of this file.
1#ifndef SPINLESSFERMIONSITE_H_
2#define SPINLESSFERMIONSITE_H_
3
5#include "symmetry/U0.h"
6#include "symmetry/U1.h"
7
8template <typename Symmetry_>
10{
11 typedef double Scalar;
12 typedef Symmetry_ Symmetry;
14
15public:
16
18
19 OperatorType Id_1s() const {return Id_1s_;}
20 OperatorType F_1s() const {return F_1s_;}
21
22 OperatorType c_1s() const { return c_1s_;}
23 OperatorType cdag_1s() const { return cdag_1s_;}
24 OperatorType n_1s() const {return n_1s_;}
25 OperatorType nph_1s() const {return nph_1s_;}
26
28
29protected:
30
31 void fill_basis();
32 void fill_SiteOps();
33
34 typename Symmetry_::qType getQ (int Delta) const;
35
37
38 OperatorType Id_1s_; //identity
39 OperatorType F_1s_; //Fermionic sign
40
41 OperatorType c_1s_; //annihilation
43 OperatorType n_1s_; //particle number
44 OperatorType nph_1s_; //particle number-1/2 (particle-hole symmetric)
45};
46
47template<typename Symmetry_>
50{
51 fill_basis();
52 fill_SiteOps();
53}
54
55template <typename Symmetry_>
58{
59 // create operators for one site
60 Id_1s_ = OperatorType(Symmetry::qvacuum(),basis_1s_);
61 F_1s_ = OperatorType(Symmetry::qvacuum(),basis_1s_);
62
63 c_1s_ = OperatorType(getQ(-1),basis_1s_);
64 cdag_1s_ = OperatorType(getQ(+1),basis_1s_);
65 n_1s_ = OperatorType(Symmetry::qvacuum(),basis_1s_);
66 nph_1s_ = OperatorType(Symmetry::qvacuum(),basis_1s_);
67
68 Id_1s_("empty","empty") = 1.;
69 Id_1s_("occup","occup") = 1.;
70
71 F_1s_("empty","empty") = 1.;
72 F_1s_("occup","occup") = -1.;
73
74 c_1s_("empty","occup") = 1.;
75 cdag_1s_("occup","empty") = 1.;
76
77// cout << "c_1s_=" << MatrixXd(c_1s_.template plain<double>().data) << endl;
78// cout << "cdag_1s_=" << MatrixXd(cdag_1s_.template plain<double>().data) << endl;
79
80 n_1s_("occup","occup") = 1.;
81
82 nph_1s_("occup","occup") = +0.5;
83 nph_1s_("empty","empty") = -0.5;
84
85 return;
86}
87
88template<typename Symmetry_>
91{
92 if constexpr (std::is_same<Symmetry, Sym::U0>::value) //U0
93 {
94 typename Symmetry::qType Q = {};
95 Eigen::Index inner_dim;
96 std::vector<std::string> ident;
97
98 ident.push_back("empty");
99 ident.push_back("occup");
100 inner_dim = 2;
101 basis_1s_.push_back(Q,inner_dim,ident);
102 ident.clear();
103 }
104 else if constexpr (std::is_same<Symmetry, Sym::U1<Sym::ChargeU1> >::value) //charge U1
105 {
106 typename Symmetry::qType Q;
107 Eigen::Index inner_dim;
108 std::vector<std::string> ident;
109
110 Q = {0};
111 ident.push_back("empty");
112 inner_dim = 1;
113 basis_1s_.push_back(Q,inner_dim,ident);
114 ident.clear();
115
116 Q = {1};
117 inner_dim = 1;
118 ident.push_back("occup");
119 basis_1s_.push_back(Q,inner_dim,ident);
120 ident.clear();
121 }
122}
123
124template<typename Symmetry_>
125typename Symmetry_::qType SpinlessFermionSite<Symmetry_>::
126getQ (int Delta) const
127{
128 if constexpr (Symmetry::IS_TRIVIAL) {return {};}
129 else if constexpr (Symmetry::Nq == 1)
130 {
131 if constexpr (Symmetry::kind()[0] == Sym::KIND::N) //return particle number as good quantum number.
132 {
133 typename Symmetry::qType out;
134 out = {Delta};
135 return out;
136 }
137 else if constexpr (Symmetry::kind()[0] == Sym::KIND::Z2) //return parity as good quantum number.
138 {
139 typename Symmetry::qType out;
140 out = {posmod<2>(Delta)};
141 return out;
142 }
143 else {assert(false and "Ill-defined KIND of the used Symmetry.");}
144 }
145 static_assert("You've inserted a symmetry which can not be handled by SpinlessFermionSite.");
146}
147
148#endif //FERMIONSITE_H_
Definition: Qbasis.h:39
SiteOperatorQ< Symmetry, Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > > OperatorType
OperatorType nph_1s() const
Qbasis< Symmetry > basis_1s() const
OperatorType Id_1s() const
OperatorType cdag_1s() const
Symmetry_::qType getQ(int Delta) const
Qbasis< Symmetry > basis_1s_
OperatorType c_1s() const
OperatorType n_1s() const
OperatorType F_1s() const