Xped
Loading...
Searching...
No Matches
SpinSU2.hpp
Go to the documentation of this file.
1#ifndef XPED_SPINSU2_HPP_
2#define XPED_SPINSU2_HPP_
3
5
7
8namespace Xped {
9
10template <typename Symmetry, size_t order>
11class Spin;
12
13template <>
14class Spin<Sym::SU2<Sym::SpinSU2>, 0ul>
15{
16 using Scalar = double;
19
20public:
21 Spin(){};
22 Spin(std::size_t D_input);
23
24 OperatorType Id_1s() const { return Id_1s_; }
25
26 OperatorType S_1s() const { return S_1s_; }
27
28 OperatorType Q_1s() const { return Q_1s_; }
29
31
32protected:
33 std::size_t D;
34
36
37 OperatorType Id_1s_; // identity
40 OperatorType Q_1s_; // quadrupole moment
41};
42
43Spin<Sym::SU2<Sym::SpinSU2>, 0ul>::Spin(std::size_t D_input)
44 : D(D_input)
45{
46 // create basis for one Spin Site
47 typename Symmetry::qType Q = {static_cast<int>(D)};
48 basis_1s_.push_back(Q, 1);
49
52 S_1s_ = OperatorType({3}, basis_1s_);
53 S_1s_.data.setZero();
54
55 Scalar locS = 0.5 * static_cast<double>(D - 1);
56 auto tmp = S_1s_(Q, Q);
57 PlainInterface::setVal(tmp, 0, 0, std::sqrt(locS * (locS + 1.)));
58 S_1s_(Q, Q) = tmp;
59 Sdag_1s_ = S_1s_.adjoint();
60 Q_1s_ = std::sqrt(2.) * OperatorType::prod(S_1s_, S_1s_, {5});
61}
62
63} // namespace Xped
64
65#endif
Definition: Qbasis.hpp:39
void push_back(const qType &q, const size_t &inner_dim)
Definition: Qbasis.cpp:32
Qbasis< Symmetry, 1 > basis_1s_
Definition: SpinSU2.hpp:35
std::size_t D
Definition: SpinSU2.hpp:33
OperatorType Id_1s_
Definition: SpinSU2.hpp:37
OperatorType Q_1s_
Definition: SpinSU2.hpp:40
OperatorType S_1s() const
Definition: SpinSU2.hpp:26
OperatorType Id_1s() const
Definition: SpinSU2.hpp:24
Qbasis< Symmetry, 1 > basis_1s() const
Definition: SpinSU2.hpp:30
OperatorType S_1s_
Definition: SpinSU2.hpp:38
OperatorType Sdag_1s_
Definition: SpinSU2.hpp:39
OperatorType Q_1s() const
Definition: SpinSU2.hpp:28
Definition: Spin.hpp:16
OperatorType Id_1s_
Definition: Spin.hpp:62
Qbasis< Symmetry, 1 > basis_1s_
Definition: Spin.hpp:59
std::size_t D
Definition: Spin.hpp:51
Spin()
Definition: Spin.hpp:23
Definition: bench.cpp:62
static void setVal(MType< Scalar > &M, const MIndextype row, const MIndextype col, const Scalar &val)
Tensor< Scalar, 1, 2, Symmetry, false > data
Definition: SiteOperator.hpp:86
static SiteOperator< Scalar, Symmetry > prod(XPED_CONST SiteOperator< Scalar, Symmetry > &O1, XPED_CONST SiteOperator< Scalar, Symmetry > &O2, const qType &target)
Definition: SiteOperator.cpp:36
void setIdentity()
Definition: SiteOperator.hpp:63
Definition: SU2.hpp:43
Definition: qarray.hpp:30