Xped
Loading...
Searching...
No Matches
FermionSU2xX.hpp
Go to the documentation of this file.
1#ifndef XPED_FERMIONSSU2xU1_H_
2#define XPED_FERMIONSSU2xU1_H_
3
9
10namespace Xped {
11template <typename Symmetry>
12class Fermion;
13
14template <typename Symmetry_>
15class Fermion<Sym::Combined<Sym::SU2<Sym::SpinSU2>, Symmetry_>>
16{
17 typedef double Scalar;
20 using qType = typename Symmetry::qType;
21
22public:
24 Fermion(bool REMOVE_DOUBLE, bool REMOVE_EMPTY, bool REMOVE_SINGLE, bool = true, bool CONSIDER_CHARGE = true);
25
26 OperatorType Id_1s() const { return Id_1s_; }
27 OperatorType F_1s() const { return F_1s_; }
28
29 OperatorType c_1s() const { return c_1s_; }
30 OperatorType cdag_1s() const { return cdag_1s_; }
31
32 OperatorType n_1s() const { return n_1s_; }
33 OperatorType ns_1s() const { return n_1s() - 2. * d_1s(); }
34 OperatorType nh_1s() const { return 2. * d_1s() - n_1s() + Id_1s(); }
35 OperatorType d_1s() const { return d_1s_; }
36
37 OperatorType S_1s() const { return S_1s_; }
38
39 OperatorType Tz_1s() const { return 0.5 * (n_1s() - Id_1s()); }
40 OperatorType cc_1s() const { return p_1s_; }
41 OperatorType cdagcdag_1s() const { return pdag_1s_; }
42
44
45protected:
46 void fill_basis(bool REMOVE_DOUBLE, bool REMOVE_EMPTY, bool REMOVE_SINGLE);
48
49 std::unordered_map<std::string, std::pair<qType, std::size_t>> labels;
50 std::size_t ch_index = 0;
52
53 OperatorType Id_1s_; // identity
54 OperatorType F_1s_; // Fermionic sign
55 OperatorType c_1s_; // annihilation
57 OperatorType n_1s_; // particle number
58 OperatorType d_1s_; // double occupancy
59 OperatorType S_1s_; // orbital spin
60 OperatorType p_1s_; // pairing
61 OperatorType pdag_1s_; // pairing adjoint
62};
63
64template <typename Symmetry_>
65Fermion<Sym::Combined<Sym::SU2<Sym::SpinSU2>, Symmetry_>>::Fermion(bool REMOVE_DOUBLE,
66 bool REMOVE_EMPTY,
67 bool REMOVE_SINGLE,
68 bool,
69 bool CONSIDER_CHARGE)
70{
71 if(CONSIDER_CHARGE) {
72 for(std::size_t q = 0; q < Symmetry::Nq; ++q) {
73 if(Symmetry::IS_FERMIONIC[q] or Symmetry::IS_BOSONIC[q]) {
74 ch_index = q;
75 HAS_CHARGE = true;
76 break;
77 }
78 }
79 } else {
80 HAS_CHARGE = false;
81 }
82
83 fill_basis(REMOVE_DOUBLE, REMOVE_EMPTY, REMOVE_SINGLE);
84
85 qType Q_c = Symmetry::qvacuum();
86 Q_c[0] = 2;
87 if constexpr(Symmetry::Nq > 1) { Q_c[1] = Symmetry::IS_MODULAR[1] ? util::constFct::posmod(-1, Symmetry::MOD_N[1]) : -1; }
88 qType Q_S = Symmetry::qvacuum();
89 Q_S[0] = 3;
90 Id_1s_ = OperatorType(Symmetry::qvacuum(), basis_1s_, labels);
91 Id_1s_.setIdentity();
92 F_1s_ = OperatorType(Symmetry::qvacuum(), basis_1s_, labels);
93 F_1s_.setIdentity();
94 c_1s_ = OperatorType(Q_c, basis_1s_, labels);
95 c_1s_.setZero();
96 d_1s_ = OperatorType(Symmetry::qvacuum(), basis_1s_, labels);
97 d_1s_.setZero();
98 S_1s_ = OperatorType(Q_S, basis_1s_, labels);
99 S_1s_.setZero();
100
101 // create operators one orbitals
102
103 if(not REMOVE_SINGLE) { F_1s_("single", "single") = -1.; }
104
105 if(not REMOVE_EMPTY and not REMOVE_SINGLE) { c_1s_("empty", "single") = std::sqrt(2.); }
106 if(not REMOVE_DOUBLE and not REMOVE_SINGLE) { c_1s_("single", "double") = 1.; }
107 cdag_1s_ = c_1s_.adjoint();
108 n_1s_ = std::sqrt(2.) * OperatorType::prod(cdag_1s_, c_1s_, Symmetry::qvacuum());
109 if(not REMOVE_DOUBLE) { d_1s_("double", "double") = 1.; }
110 if(not REMOVE_SINGLE) { S_1s_("single", "single") = std::sqrt(0.75); }
111 qType Q_p = Symmetry::qvacuum();
112 if constexpr(Symmetry::Nq > 1) { Q_p[1] = Symmetry::IS_MODULAR[1] ? util::constFct::posmod(-2, Symmetry::MOD_N[1]) : -2; }
113 p_1s_ = -std::sqrt(0.5) * OperatorType::prod(c_1s_, c_1s_, Q_p); // The sign convention corresponds to c_DN c_UP
114 pdag_1s_ = p_1s_.adjoint(); // The sign convention corresponds to (c_DN c_UP)†=c_UP† c_DN†
115}
116
117template <typename Symmetry_>
118void Fermion<Sym::Combined<Sym::SU2<Sym::SpinSU2>, Symmetry_>>::fill_basis(bool REMOVE_DOUBLE, bool REMOVE_EMPTY, bool REMOVE_SINGLE)
119{
120 if(not HAS_CHARGE) {
121 qType Q = Symmetry::qvacuum();
122 std::size_t dim = 0;
123 if(not REMOVE_EMPTY) { labels.insert(std::make_pair("empty", std::make_pair(Q, dim++))); }
124 if(not REMOVE_DOUBLE) { labels.insert(std::make_pair("double", std::make_pair(Q, dim++))); }
125 this->basis_1s_.push_back(Q, dim);
126 if(not REMOVE_SINGLE) {
127 Q[0] = 2;
128 this->basis_1s_.push_back(Q, 1);
129 labels.insert(std::make_pair("single", std::make_pair(Q, 0)));
130 }
131 } else {
132 qType Q = Symmetry::qvacuum();
133 if(not REMOVE_EMPTY) {
134 this->basis_1s_.push_back(Q, 1);
135 labels.insert(std::make_pair("empty", std::make_pair(Q, 0)));
136 }
137 if(not REMOVE_DOUBLE) {
138 std::size_t dim = (Symmetry::MOD_N[ch_index] == 2) ? 1 : 0;
139 Q[ch_index] = Symmetry::IS_MODULAR[ch_index] ? util::constFct::posmod(2, Symmetry::MOD_N[ch_index]) : 2;
140 this->basis_1s_.push_back(Q, 1);
141 labels.insert(std::make_pair("double", std::make_pair(Q, dim)));
142 }
143 if(not REMOVE_SINGLE) {
144 Q[ch_index] = 1;
145 Q[0] = 2;
146 this->basis_1s_.push_back(Q, 1);
147 labels.insert(std::make_pair("single", std::make_pair(Q, 0)));
148 }
149 }
150}
151
152} // namespace Xped
153#endif // XPED_FERMIONSU2xU1_H_
OperatorType nh_1s() const
Definition: FermionSU2xX.hpp:34
OperatorType ns_1s() const
Definition: FermionSU2xX.hpp:33
std::unordered_map< std::string, std::pair< qType, std::size_t > > labels
Definition: FermionSU2xX.hpp:49
OperatorType cc_1s() const
Definition: FermionSU2xX.hpp:40
OperatorType n_1s() const
Definition: FermionSU2xX.hpp:32
Qbasis< Symmetry, 1 > basis_1s() const
Definition: FermionSU2xX.hpp:43
OperatorType cdag_1s() const
Definition: FermionSU2xX.hpp:30
OperatorType S_1s() const
Definition: FermionSU2xX.hpp:37
OperatorType cdagcdag_1s() const
Definition: FermionSU2xX.hpp:41
OperatorType F_1s() const
Definition: FermionSU2xX.hpp:27
OperatorType Id_1s() const
Definition: FermionSU2xX.hpp:26
Qbasis< Symmetry, 1 > basis_1s_
Definition: FermionSU2xX.hpp:47
OperatorType d_1s() const
Definition: FermionSU2xX.hpp:35
OperatorType c_1s() const
Definition: FermionSU2xX.hpp:29
OperatorType Tz_1s() const
Definition: FermionSU2xX.hpp:39
Definition: Fermion.hpp:21
std::size_t ch_index
Definition: Fermion.hpp:76
OperatorType d_1s_
Definition: Fermion.hpp:93
OperatorType n_1s_
Definition: Fermion.hpp:90
OperatorType Id_1s() const
Definition: Fermion.hpp:31
Fermion()
Definition: Fermion.hpp:28
OperatorType Id_1s_
Definition: Fermion.hpp:81
OperatorType d_1s() const
Definition: Fermion.hpp:53
OperatorType n_1s() const
Definition: Fermion.hpp:45
Qbasis< Symmetry, 1 > basis_1s_
Definition: Fermion.hpp:72
void fill_basis(bool REMOVE_DOUBLE, bool REMOVE_EMPTY, bool REMOVE_SINGLE)
Definition: Fermion.hpp:208
OperatorType F_1s_
Definition: Fermion.hpp:82
Definition: Qbasis.hpp:39
constexpr int posmod(int x)
Definition: Constfct.hpp:46
Definition: bench.cpp:62
Definition: SiteOperator.hpp:10
Definition: CombSym.hpp:12