Xped
Loading...
Searching...
No Matches
SUN.hpp
Go to the documentation of this file.
1#ifndef XPED_SUN_HPP_
2#define XPED_SUN_HPP_
3
5#include <array>
6#include <cstddef>
7#include <vector>
9
10#include "ClebschGordan.hpp"
11
15#include "Xped/Util/Mpi.hpp"
16
17namespace Xped::Sym {
18
19template <std::size_t N, typename Kind, typename Scalar_>
20struct SUN;
21
22template <std::size_t N, typename Kind_, typename Scalar__>
23struct SymTraits<SUN<N, Kind_, Scalar__>>
24{
25 constexpr static int Nq = 1;
26 typedef clebsch::weight qType;
27 typedef Scalar__ Scalar;
28};
29
40template <std::size_t N_, typename Kind, typename Scalar_ = double>
41struct SUN : public SymBase<SUN<N_, Kind, Scalar_>>
42{
43 static constexpr std::size_t N = N_;
44 typedef Scalar_ Scalar;
46
47 static constexpr std::size_t Nq = 1;
48
49 static constexpr std::array<bool, Nq> HAS_MULTIPLICITIES = {true};
50 static constexpr std::array<bool, Nq> NON_ABELIAN = {true};
51 static constexpr std::array<bool, Nq> ABELIAN = {false};
52 static constexpr std::array<bool, Nq> IS_TRIVIAL = {false};
53 static constexpr std::array<bool, Nq> IS_MODULAR = {false};
54 static constexpr std::array<bool, Nq> IS_FERMIONIC = {(Kind::name == KIND::FT)};
55 static constexpr std::array<bool, Nq> IS_BOSONIC = {(Kind::name == KIND::T)};
56 static constexpr std::array<bool, Nq> IS_SPIN = {(Kind::name == KIND::S)};
57 static constexpr std::array<int, Nq> MOD_N = {1};
58
59 static constexpr bool ANY_HAS_MULTIPLICITIES = HAS_MULTIPLICITIES[0];
60 static constexpr bool ANY_NON_ABELIAN = NON_ABELIAN[0];
61 static constexpr bool ANY_ABELIAN = ABELIAN[0];
62 static constexpr bool ANY_IS_TRIVIAL = IS_TRIVIAL[0];
63 static constexpr bool ANY_IS_MODULAR = IS_MODULAR[0];
64 static constexpr bool ANY_IS_FERMIONIC = IS_FERMIONIC[0];
65 static constexpr bool ANY_IS_BOSONIC = IS_BOSONIC[0];
66 static constexpr bool ANY_IS_SPIN = IS_SPIN[0];
67
68 static constexpr bool ALL_HAS_MULTIPLICITIES = HAS_MULTIPLICITIES[0];
69 static constexpr bool ALL_NON_ABELIAN = NON_ABELIAN[0];
70 static constexpr bool ALL_ABELIAN = ABELIAN[0];
71 static constexpr bool ALL_IS_TRIVIAL = IS_TRIVIAL[0];
72 static constexpr bool ALL_IS_MODULAR = IS_MODULAR[0];
73 static constexpr bool ALL_IS_FERMIONIC = IS_FERMIONIC[0];
74 static constexpr bool ALL_IS_BOSONIC = IS_BOSONIC[0];
75 static constexpr bool ALL_IS_SPIN = IS_SPIN[0];
76
77 static constexpr bool IS_CHARGE_SU2() { return false; }
78 static constexpr bool IS_SPIN_SU2() { return false; }
79
80 static constexpr bool IS_SPIN_U1() { return false; }
81
82 static constexpr bool NO_SPIN_SYM()
83 {
84 if constexpr(not IS_SPIN[0]) { return true; }
85 return false;
86 }
87 static constexpr bool NO_CHARGE_SYM()
88 {
89 if constexpr(not IS_FERMIONIC[0] and not IS_BOSONIC[0]) { return true; }
90 return false;
91 }
92
93 typedef clebsch::weight qType;
94
95 SUN() = default;
96
97 inline static std::string name()
98 {
99 std::string prefix = IS_FERMIONIC ? "Æ‘" : "";
100 if(N == 2) { return prefix + "SUâ‚‚"; }
101 if(N == 3) { return prefix + "SU₃"; }
102 if(N == 4) { return prefix + "SUâ‚„"; }
103 if(N == 5) { return prefix + "SUâ‚…"; }
104 if(N == 6) { return prefix + "SU₆"; }
105 return prefix + "SU(" + std::to_string(N) + ")";
106 }
107 inline static constexpr std::array<KIND, Nq> kind() { return {Kind::name}; }
108
109 inline static constexpr qType qvacuum()
110 {
111 clebsch::weight vac(N);
112 for(auto& w : vac) { w = 0; }
113 return vac;
114 }
115 // inline static constexpr std::array<qType, 1> lowest_qs() { return std::array<qType, 1>{{qarray<1>(std::array<int, 1>{{2}})}}; }
116
117 inline static qType conj(const qType& q)
118 {
119 clebsch::weight con(N);
120 for(std::size_t i = 0; i < N; ++i) {
121 con(i) = q(0) - q(N - 1 - i);
122 return con;
123 }
124 }
125 inline static int degeneracy(const qType& q) { return q.dimension(); }
126
127 static qType random_q();
128
132 static std::vector<qType> basis_combine(const qType& ql, const qType& qr);
133
134 std::size_t multiplicity(const qType& q1, const qType& q2, const qType& q3)
135 {
136 clebsch::decomposition comp(q1, q2);
137 return comp.multiplicity(q3);
138 }
140
143 static Scalar coeff_dot(const qType& q1);
144
145 static Scalar coeff_FS(const qType& q1);
146
147 template <typename PlainLib>
148 static typename PlainLib::template TType<Scalar_, 2> one_j_tensor(const qType& q1, mpi::XpedWorld& world = mpi::getUniverse());
149
150 static Scalar coeff_rightOrtho(const qType& q1, const qType& q2) { return static_cast<Scalar>(q1[0]) / static_cast<Scalar>(q2[0]); }
151
152 static Scalar coeff_3j(const qType& q1, const qType& q2, const qType& q3, int q1_z, int q2_z, int q3_z);
153
154 static Scalar coeff_turn(const qType& ql, const qType& qr, const qType& qf)
155 {
156 return triangle(ql, qr, qf) ? coeff_swap(ql, qr, qf) * std::sqrt(static_cast<Scalar>(qf[0]) / static_cast<Scalar>(ql[0])) : Scalar(0.);
157 }
158
159 template <typename PlainLib>
160 static typename PlainLib::template TType<Scalar_, 3>
161 CGC(const qType& q1, const qType& q2, const qType& q3, const std::size_t, mpi::XpedWorld& world = mpi::getUniverse());
162
163 static Scalar coeff_6j(const qType& q1, const qType& q2, const qType& q3, const qType& q4, const qType& q5, const qType& q6);
164
165 static Scalar coeff_9j(const qType& q1,
166 const qType& q2,
167 const qType& q3,
168 const qType& q4,
169 const qType& q5,
170 const qType& q6,
171 const qType& q7,
172 const qType& q8,
173 const qType& q9);
174
175 static Scalar coeff_recouple(const qType& q1, const qType& q2, const qType& q3, const qType& Q, const qType& Q12, const qType& Q23)
176 {
177 return std::sqrt(Q12[0] * Q23[0]) * phase<Scalar>((q1[0] + q2[0] + q3[0] + Q[0]) / 2.) * coeff_6j(q1, q2, Q12, q3, Q, Q23);
178 }
179
180 static Scalar coeff_swap(const qType& ql, const qType& qr, const qType& qf)
181 {
182 return triangle(ql, qr, qf) ? phase<Scalar>((ql[0] + qr[0] - qf[0] - 1) / 2) : Scalar(0.);
183 }
185
186 static bool triangle(const qType& q1, const qType& q2, const qType& q3);
187};
188
189} // namespace Xped::Sym
190
191#ifndef XPED_COMPILED_LIB
192# include "Symmetry/SU2.cpp"
193#endif
194
195#endif
Definition: CombSym.hpp:8
@ T
Definition: functions.hpp:35
@ FT
Definition: functions.hpp:36
@ N
Definition: functions.hpp:37
@ S
Definition: functions.hpp:33
XpedWorld & getUniverse()
Definition: Mpi.hpp:49
CTF::Tensor< Scalar > TType
Definition: PlainInterface_Cyclops_impl.cpp:13
Definition: SUN.hpp:42
static std::string name()
Definition: SUN.hpp:97
static constexpr bool NO_SPIN_SYM()
Definition: SUN.hpp:82
static constexpr bool ANY_IS_TRIVIAL
Definition: SUN.hpp:62
static constexpr std::array< bool, Nq > HAS_MULTIPLICITIES
Definition: SUN.hpp:49
std::size_t multiplicity(const qType &q1, const qType &q2, const qType &q3)
Definition: SUN.hpp:134
static constexpr bool ALL_IS_SPIN
Definition: SUN.hpp:75
static constexpr std::size_t Nq
Definition: SUN.hpp:47
static Scalar coeff_swap(const qType &ql, const qType &qr, const qType &qf)
Definition: SUN.hpp:180
static constexpr bool ANY_NON_ABELIAN
Definition: SUN.hpp:60
static constexpr bool ANY_IS_FERMIONIC
Definition: SUN.hpp:64
static constexpr bool IS_CHARGE_SU2()
Definition: SUN.hpp:77
static constexpr bool ANY_IS_SPIN
Definition: SUN.hpp:66
static constexpr bool NO_CHARGE_SYM()
Definition: SUN.hpp:87
static constexpr bool ALL_NON_ABELIAN
Definition: SUN.hpp:69
static constexpr std::array< bool, Nq > IS_BOSONIC
Definition: SUN.hpp:55
static constexpr std::array< KIND, Nq > kind()
Definition: SUN.hpp:107
static constexpr std::array< bool, Nq > NON_ABELIAN
Definition: SUN.hpp:50
static constexpr bool ANY_IS_BOSONIC
Definition: SUN.hpp:65
static Scalar coeff_FS(const qType &q1)
static constexpr bool IS_SPIN_U1()
Definition: SUN.hpp:80
static PlainLib::template TType< Scalar_, 3 > CGC(const qType &q1, const qType &q2, const qType &q3, const std::size_t, mpi::XpedWorld &world=mpi::getUniverse())
Definition: SUN.cpp:47
static constexpr bool ANY_HAS_MULTIPLICITIES
Definition: SUN.hpp:59
static constexpr bool IS_SPIN_SU2()
Definition: SUN.hpp:78
static constexpr std::array< bool, Nq > IS_MODULAR
Definition: SUN.hpp:53
static Scalar coeff_6j(const qType &q1, const qType &q2, const qType &q3, const qType &q4, const qType &q5, const qType &q6)
static constexpr std::array< bool, Nq > ABELIAN
Definition: SUN.hpp:51
static std::vector< qType > basis_combine(const qType &ql, const qType &qr)
Definition: SUN.cpp:19
static Scalar coeff_9j(const qType &q1, const qType &q2, const qType &q3, const qType &q4, const qType &q5, const qType &q6, const qType &q7, const qType &q8, const qType &q9)
static qType random_q()
Definition: SUN.cpp:10
static Scalar coeff_dot(const qType &q1)
Definition: SUN.cpp:28
static constexpr std::array< int, Nq > MOD_N
Definition: SUN.hpp:57
static constexpr std::size_t N
Definition: SUN.hpp:43
static constexpr bool ALL_HAS_MULTIPLICITIES
Definition: SUN.hpp:68
static qType conj(const qType &q)
Definition: SUN.hpp:117
static constexpr bool ALL_IS_BOSONIC
Definition: SUN.hpp:74
static Scalar coeff_rightOrtho(const qType &q1, const qType &q2)
Definition: SUN.hpp:150
static constexpr bool ALL_ABELIAN
Definition: SUN.hpp:70
static constexpr bool ANY_IS_MODULAR
Definition: SUN.hpp:63
SUN()=default
static constexpr bool ANY_ABELIAN
Definition: SUN.hpp:61
Scalar_ Scalar
Definition: SUN.hpp:44
static constexpr bool ALL_IS_FERMIONIC
Definition: SUN.hpp:73
static constexpr std::array< bool, Nq > IS_FERMIONIC
Definition: SUN.hpp:54
static constexpr std::array< bool, Nq > IS_SPIN
Definition: SUN.hpp:56
static constexpr qType qvacuum()
Definition: SUN.hpp:109
static bool triangle(const qType &q1, const qType &q2, const qType &q3)
Definition: SUN.cpp:128
static Scalar coeff_3j(const qType &q1, const qType &q2, const qType &q3, int q1_z, int q2_z, int q3_z)
static constexpr std::array< bool, Nq > IS_TRIVIAL
Definition: SUN.hpp:52
static Scalar coeff_recouple(const qType &q1, const qType &q2, const qType &q3, const qType &Q, const qType &Q12, const qType &Q23)
Definition: SUN.hpp:175
static Scalar coeff_turn(const qType &ql, const qType &qr, const qType &qf)
Definition: SUN.hpp:154
clebsch::weight qType
Definition: SUN.hpp:93
SymBase< SUN< N, Kind, Scalar > > Base
Definition: SUN.hpp:45
static PlainLib::template TType< Scalar_, 2 > one_j_tensor(const qType &q1, mpi::XpedWorld &world=mpi::getUniverse())
Definition: SUN.cpp:35
static int degeneracy(const qType &q)
Definition: SUN.hpp:125
static constexpr bool ALL_IS_TRIVIAL
Definition: SUN.hpp:71
static constexpr bool ALL_IS_MODULAR
Definition: SUN.hpp:72
Definition: SymBase.hpp:14
clebsch::weight qType
Definition: SUN.hpp:26
Definition: SymBase.hpp:10
Definition: Mpi.hpp:34