Commit d7d9f429 authored by karius's avatar karius

weights.py and status quo

parent bfad99ee
......@@ -72,7 +72,7 @@ def A2(D,I2):
ret = dict()
for k,v in D.items():
if (k[1],k[2],k[3]) in I2:
ret[k] = re(v)
ret[k] = -im(v)
return ret
def A_w(A1,A2,I1,I2,w):
......@@ -82,6 +82,7 @@ def A_w(A1,A2,I1,I2,w):
if j<len(A1):
v[j] += A1[(i,l,m,n)]
import scipy
# N=1
# A1
# (l,m,n)
......@@ -103,15 +104,50 @@ N = 1
fn = "./cffk-orientation-dc8bb42/data/c48u1.quat"
quats = read_weights(fn)
eulers = [quat_to_euler(q) for q in quats]
eulers = [(0,0,0),(pi/2,pi/2,pi/2)]
eulers = [(0,0,0),(pi,0,0),(0,pi,0),(pi,pi,0)]
D = build_WignerD(N, eulers)
i1 = I1(N)
i2 = I2(N)
a1 = A1(D,i1)
a2 = A2(D,i2)
# for k,v in D.items():
# print(k, v)
print(i1)
print(i2)
print(len(a1),len(a2),len(D))
print("===A1===")
for k,v in a1.items():
print(k, v)
print("===A2===")
for k,v in a2.items():
print(k, v)
print("================")
for k,v in D.items():
print(k, v)
from scipy.sparse import csc_matrix
from scipy.sparse.linalg import lsqr
import numpy as np
A = np.zeros((len(a1)+len(a2),len(eulers)))
for m in range(len(eulers)):
for a,(k,v) in enumerate(a1.items()):
A[a,m] = v.evalf()
for a,(k,v) in enumerate(a2.items()):
A[len(a1)+a,m] = v.evalf()
print(A)
# A[0,0] = 1
# A[0,1] = 1
# A[2,1] = 0.5
# A[3,0] = 1
# A[5,1] = 0.5
# A[7,1] = 1/np.sqrt(2)
# A[8,1] = -1/np.sqrt(2)
# b = np.zeros((A.shape[0],))
# b[0] = 1
# print(A)
# print(b)
# A = csc_matrix(A)
# x, istop, itn, normr = lsqr(A, b)[:4]
# print(x,normr,istop)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment