-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcgwr.hpp
97 lines (73 loc) · 2.23 KB
/
cgwr.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef CGWR_HPP
#define CGWR_HPP
#include <iostream>
#include <cmath>
#include <algorithm>
//#include <boost/rational.hpp>
//#include <boost/math/special_functions/factorials.hpp>
//#include <boost/math/special_functions/powm1.hpp>
/*********************************************************************
- CG:
< j1 j2 m1 m2 | J M >
- Wigner 3j or 6j:
(j1,j2,j3) or {j1,j2,j3}
(l1,l2,l3) {m1,m2,m3}
- Wigner 9j:
{j1 j2 j3}
{j4 j5 j6}
{j7 j8 j9}
-Racah:
W(j1 j2 l2 l1 | j3 l3)
CG translated as array=[j1,j2,m1,m2,J,M] with _CGWR::C_CG token
or
Wigner 3j translated as array=[j1,j2,j3,m1,m2,m3] with _CGWR::C_W3j token
or
Wigner 6j translated as array=[j1,j2,j3,l1,l2,l3] with _CGWR::C_W6j token
or
and so on with usual notations
*********************************************************************/
class _CGWR { // Clebsch-Gordan Wigner Racah
public:
// Token
/***********/
static const unsigned int C_CG;
static const unsigned int C_W3j;
static const unsigned int C_W6j;
static const unsigned int C_W9j;
static const unsigned int C_RACAH;
/***********/
// Init the class with the coeff and the token
/***********/
_CGWR(double long [], unsigned int);
/***********/
_CGWR& operator= ( const _CGWR& other ); //TODO
// Public methods
/***********/
double long CG(void);
double long W3j(void);
double long W6j(void);
double long W9j(void); //TODO
double long Racah(void);
/***********/
private:
double long j1, j2, j3, j;
double long l1, l2, l3, l;
double long m1, m2 , m3, m;
unsigned int selected_Symb;
// mid computations
/***********/
long double fact ( long double n ); // factorial
double long Delta(double long , double long , double long ); // triangle relation
double long delta_k(double long , double long ); // kronecker
// variadic
template<typename _T>
bool is_integer(_T n); // return true if integer
template<typename _T, typename ..._args>
bool is_integer(_T, _args...);
template<typename _T>
bool is_halfinteger(_T); // return true if half integer
template<typename _T, typename ..._args>
bool is_halfinteger(_T, _args...);
/***********/
};
#endif // CGWR_HPP