forked from chjost/clebsch_gordan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_basis
executable file
·82 lines (70 loc) · 1.95 KB
/
example_basis
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
#!/usr/bin/python
import numpy as np
import group
def main():
np.set_printoptions(suppress=True)
prefs = [[0.,0.,0.], [0.,0.,1.], [1.,1.,0.], [1.,1.,1.]]
#prefs = np.asarray(prefs)
p2max = 4
groups = []
# initialize groups
S = 1./np.sqrt(2.)
#U3 = np.asarray([[S,0,S],[0,1,0],[S,0,-S]])
#U2 = np.asarray([[S,S],[1.j*S,-1.j*S]])
# U3 = np.identity(3)
# U2 = np.identity(2)
# cartesian basis
U3 = np.asarray([[0,0,-1.],[1.j,0,0],[0,1,0]])
U2 = np.asarray([[S,S],[1.j*S,-1.j*S]])
for p2 in range(p2max):
try:
_g = group.TOh.read(p2=p2)
if not np.allclose(_g.U3, U3) or not np.allclose(_g.U2, U2):
raise IOError("redo computation")
except IOError:
_g = group.TOh(pref=prefs[p2], irreps=True, U3=U3, U2=U2)
_g.save()
groups.append(_g)
#print("p^2 = %d" % p2)
#print(_g.irrepsname)
# calc coefficients
print(" CMF ".center(40, "="))
basis = group.TOhBasis(groups[0],jmax=3)
print("display")
basis.print_table()
print("pandas")
print basis.to_pandas(1)
print("latex")
basis.to_latex()
# calc coefficients
print(" MF 1 ".center(40, "="))
basis = group.TOhBasis(groups[1],jmax=3)
print("display")
basis.print_table()
#print("pandas")
#basis.to_pandas(1)
#print("latex")
#basis.to_latex()
# calc coefficients
print(" MF 2 ".center(40, "="))
basis = group.TOhBasis(groups[2],jmax=3)
print("display")
basis.print_table()
#print("pandas")
#basis.to_pandas(1)
#print("latex")
#basis.to_latex()
# calc coefficients
print(" MF 3 ".center(40, "="))
basis = group.TOhBasis(groups[3],jmax=3)
print("display")
basis.print_table()
#print("pandas")
#basis.to_pandas(1)
#print("latex")
#basis.to_latex()
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
pass