14template <
typename Symmetry_,
size_t order=0ul>
25 SpinSite(std::size_t D_input,
int mfactor_input=1);
88template<
typename Symmetry_,
size_t order>
90SpinSite(std::size_t D_input,
int mfactor_input)
91:D(D_input), mfactor(mfactor_input)
100template<
typename Symmetry_,
size_t order>
105 Id_1s_.setIdentity();
126 if constexpr (Symmetry::IS_TRIVIAL)
134 double S = 0.5*(D-1);
137 for (
size_t i=0; i<D-1; ++i)
139 int Q = -
static_cast<int>(Sx2) + 2*
static_cast<int>(i);
142 stringstream ssQ; ssQ << Q;
143 stringstream ssQplus1; ssQplus1 << Qplus1;
145 double m = -S +
static_cast<double>(i);
146 Sbase(ssQplus1.str(),ssQ.str()) = 0.5*sqrt(S*(S+1.)-m*(m+1.));
151 Sz_1s_ = 0.5 * (Sp_1s_*Sm_1s_ - Sm_1s_*Sp_1s_);
153 F_1s_ = 0.5*Id_1s_-Sz_1s_;
162 Qz_1s_ = 1./sqrt(3.) * (3.*Sz_1s_*Sz_1s_-S*(S+1.)*Id_1s_);
163 Qp_1s_ = Sp_1s_*Sp_1s_;
164 Qm_1s_ = Sm_1s_*Sm_1s_;
165 Qpz_1s_ = Sp_1s_*Sz_1s_+Sz_1s_*Sp_1s_;
166 Qmz_1s_ = Sm_1s_*Sz_1s_+Sz_1s_*Sm_1s_;
169 if constexpr (Symmetry::IS_TRIVIAL)
173 for (
int i=D-1; i>=0; --i)
175 int Q1 = -
static_cast<int>(Sx2) + 2*
static_cast<int>(i);
176 int Q2 = +
static_cast<int>(Sx2) - 2*
static_cast<int>(i);
177 stringstream ssQ1; ssQ1 << Q1;
178 stringstream ssQ2; ssQ2 << Q2;
182 exp_i_pi_Sx_1s_(ssQ1.str(),ssQ2.str()) = pow(-1.,D);
186 exp_i_pi_Sy_1s_(ssQ1.str(),ssQ2.str()) = pow(-1.,D+1) * pow(-1,i);
191 for (
int i=D-1; i>=0; --i)
193 double m = -S +
static_cast<double>(i);
194 int Q = -
static_cast<int>(Sx2) + 2*
static_cast<int>(i);
195 stringstream ssQ; ssQ << Q;
197 exp_i_pi_Sz_1s_(ssQ.str(),ssQ.str()) = exp(1.i*M_PI*m);
203template<
typename Symmetry_,
size_t order>
207 if constexpr (Symmetry::NO_SPIN_SYM())
209 typename Symmetry::qType Q=Symmetry::qvacuum();
210 Eigen::Index inner_dim = D;
211 std::vector<std::string> ident;
214 double S = 0.5*(D-1);
217 for (
int i=D-1; i>=0; --i)
219 int Qint = -
static_cast<int>(Sx2) + 2*
static_cast<int>(i);
221 stringstream ss; ss << Qint;
222 ident.push_back(ss.str());
224 basis_1s_.push_back(Q,inner_dim,ident);
226 else if constexpr (Symmetry::IS_SPIN_U1())
228 typename Symmetry::qType Q;
229 Eigen::Index inner_dim;
230 std::vector<std::string> ident;
233 double S = 0.5*(D-1);
237 for (
int i=D-1; i>=0; --i)
239 int Qint = -
static_cast<int>(Sx2) + 2*
static_cast<int>(i);
240 if constexpr (Symmetry::Nq>1)
242 if (Symmetry::kind()[0] == Sym::KIND::M and Symmetry::kind()[1] == Sym::KIND::M)
244 for (
size_t q=0; q<Symmetry::Nq; q++)
246 if (Symmetry::kind()[q] == Sym::KIND::M and q==0)
248 Q[q] = (mfactor==1)? Qint:0;
250 else if (Symmetry::kind()[q] == Sym::KIND::M and q==1)
252 Q[q] = (mfactor==1)? 0:Qint;
261 else if (Symmetry::kind()[0] == Sym::KIND::M and Symmetry::kind()[1] != Sym::KIND::M)
264 Q[1] = Symmetry::S2::qvacuum()[0];
266 else if (Symmetry::kind()[0] != Sym::KIND::M and Symmetry::kind()[1] == Sym::KIND::M)
268 Q[0] = Symmetry::S1::qvacuum()[0];
278 stringstream ss; ss << Qint;
279 ident.push_back(ss.str());
280 basis_1s_.push_back(Q, inner_dim, ident);
286template<
typename Symmetry_,
size_t order>
290 if constexpr (Symmetry::NO_SPIN_SYM()) {
return Symmetry::qvacuum();}
291 else if constexpr (Symmetry::Nq == 1)
293 if constexpr (Symmetry::kind()[0] == Sym::KIND::N or
294 Symmetry::kind()[0] == Sym::KIND::Nparity)
296 return Symmetry::qvacuum();
298 else if constexpr (Symmetry::kind()[0] == Sym::KIND::M)
300 assert(Sa !=
SX and Sa !=
iSY);
302 typename Symmetry::qType out;
303 if (Sa==
SZ or Sa==
QZ) {out = {0};}
304 else if (Sa==
SP or Sa==
QPZ) {out = {+2*mfactor};}
305 else if (Sa==
SM or Sa==
QMZ) {out = {-2*mfactor};}
306 else if (Sa==
QP) {out = {+4*mfactor};}
307 else if (Sa==
QM) {out = {-4*mfactor};}
310 else {assert(
false and
"Ill defined KIND of the used Symmetry.");}
312 else if constexpr (Symmetry::Nq == 2)
314 assert(Sa !=
SX and Sa !=
iSY and Sa !=
QP and Sa !=
QM);
316 typename Symmetry::qType out;
317 if constexpr (Symmetry::kind()[0] == Sym::KIND::N and Symmetry::kind()[1] == Sym::KIND::M)
319 if (Sa==
SZ) {out = {0,0};}
320 else if (Sa==
SP) {out = {0,+2};}
321 else if (Sa==
SM) {out = {0,-2};}
323 else if constexpr (Symmetry::kind()[0] == Sym::KIND::M and Symmetry::kind()[1] == Sym::KIND::N)
325 if (Sa==
SZ) {out = {0,0};}
326 else if (Sa==
SP) {out = {+2*mfactor,0};}
327 else if (Sa==
SM) {out = {-2*mfactor,0};}
329 else if constexpr (Symmetry::kind()[0] == Sym::KIND::M and Symmetry::kind()[1] == Sym::KIND::T)
331 if (Sa==
SZ) {out = {0,1};}
332 else if (Sa==
SP) {out = {+2*mfactor,1};}
333 else if (Sa==
SM) {out = {-2*mfactor,1};}
335 else if constexpr (Symmetry::kind()[0] == Sym::KIND::Nup and Symmetry::kind()[1] == Sym::KIND::Ndn)
337 if (Sa==
SZ) {out = {0,0};}
338 else if (Sa==
SP) {out = {+1,-1};}
339 else if (Sa==
SM) {out = {-1,+1};}
341 else if constexpr (Symmetry::kind()[0] == Sym::KIND::Ndn and Symmetry::kind()[1] == Sym::KIND::Nup)
343 if (Sa==
SZ) {out = {0,0};}
344 else if (Sa==
SP) {out = {-1,+1};}
345 else if (Sa==
SM) {out = {+1,-1};}
347 else if constexpr (Symmetry::kind()[0] == Sym::KIND::M and Symmetry::kind()[1] == Sym::KIND::M)
351 if (Sa==
SZ) {out = {0,0};}
352 else if (Sa==
SP) {out = {+2,0};}
353 else if (Sa==
SM) {out = {-2,0};}
357 if (Sa==
SZ) {out = {0,0};}
358 else if (Sa==
SP) {out = {0,+2};}
359 else if (Sa==
SM) {out = {0,-2};}
365 static_assert(
"You inserted a Symmetry which can not be handled by FermionBase.");
SiteOperatorQ< Symmetry, MatrixType_ > adjoint() const
OperatorType Sm_1s() const
OperatorType Qm_1s() const
OperatorType exp_i_pi_Sx() const
ComplexOperatorType exp_i_pi_Sz_1s_
OperatorType exp_i_pi_Sy_1s_
Qbasis< Symmetry > basis_1s_
OperatorType F_1s() const
OperatorType Qpz_1s() const
SiteOperatorQ< Symmetry, Eigen::Matrix< complex< Scalar >, Eigen::Dynamic, Eigen::Dynamic > > ComplexOperatorType
OperatorType Qp_1s() const
OperatorType Qmz_1s() const
OperatorType exp_i_pi_Sx_1s_
OperatorType Zero_1s() const
OperatorType n_1s() const
Symmetry_::qType getQ(SPINOP_LABEL Sa) const
SpinSite(std::size_t D_input, int mfactor_input=1)
OperatorType Sz_1s() const
ComplexOperatorType exp_i_pi_Sz() const
Qbasis< Symmetry > basis_1s() const
SiteOperatorQ< Symmetry, Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > > OperatorType
OperatorType Qz_1s() const
OperatorType Sp_1s() const
OperatorType Id_1s() const
OperatorType exp_i_pi_Sy() const