def K3mat(E, L, K0, K1, K2, A, B, Ytype): nnk_list = list_nnk(E, L) N = len(nnk_list) K3full = [] for p in range(N): pvec = [i * 2 * pi / L for i in nnk_list[p]] K3p = [] for k in range(N): kvec = [i * 2 * pi / L for i in nnk_list[k]] K3pk = np.zeros((6, 6)) for i1 in range(6): [lp, mp] = lm_idx(i1) for i2 in range(6): [l, m] = lm_idx(i2) K3pk[i1][i2] = K3quad(E, pvec, lp, mp, kvec, l, m, K0, K1, K2, A, B, Ytype) K3p.append(K3pk) K3full.append(K3p) return chop(np.block(K3full))
def Gmat(E, L): nnk_list = list_nnk(E, L) N = len(nnk_list) #print(nnk_list) #print(N) Gfull = [] for p in range(N): nnp = list(nnk_list[p]) Gp = [] for k in range(N): nnk = list(nnk_list[k]) Gpk = np.zeros((6, 6)) for i1 in range(6): [l1, m1] = lm_idx(i1) for i2 in range(6): [l2, m2] = lm_idx(i2) Gpk[i1, i2] = G(E, L, nnp, nnk, l1, m1, l2, m2) Gp.append(Gpk) Gfull.append(Gp) return chop(np.block(Gfull))
def Gmat_div(): out = np.zeros((42,42)) nnk_list = [(0,0,0)]+defns.shell_nnk_list([0,0,1]) for i in range(42): nnp = nnk_list[i//6] [l1,m1] = defns.lm_idx(i) for j in range(42): nnk = nnk_list[j//6] [l2,m2] = defns.lm_idx(j) out[i,j] = G_div(nnp,l1,m1,nnk,l2,m2) return out
def Fmat_div(): out = np.zeros((42,42)) nnk_list = [(0,0,0)]+defns.shell_nnk_list([0,0,1]) for n in range(len(nnk_list)): nnk = nnk_list[n] for i1 in range(6): i = 6*n+i1 [l1,m1] = defns.lm_idx(i1) for i2 in range(6): j = 6*n+i2 [l2,m2] = defns.lm_idx(i2) out[i,j] = F_div(nnk,l1,m1,nnk,l2,m2) return out
def K2inv_mat(E,L,a0,r0,P0,a2): nnk_list = defns.list_nnk(E,L) N = len(nnk_list) K2i_full = [] for k in range(N): kvec = [ ki*2*pi/L for ki in nnk_list[k] ] K2i_k_diag = [] for i in range(6): [l,m] = defns.lm_idx(i) K2i_k_diag.append(K2inv(E,kvec,l,m,a0,r0,P0,a2)) K2i_k = np.diag(K2i_k_diag) K2i_full.append(K2i_k) return block_diag(*K2i_full)
from F3 import F2_alt, Gmatrix, sums_alt as sums, K2i_mat from F3 import H_mat, F3_mat import defns, projections as proj, analysis_defns as AD, group_theory_defns as GT E = 3.84 L = 5 alpha = 0.5 nnk = np.array([1, 1, 0]) k = 2 * pi / L * LA.norm(nnk) print(sums.hh(E, k)) S0 = np.zeros((6, 6)) S1 = S0 for i in range(6): for j in range(6): [l1, m1] = defns.lm_idx(i) [l2, m2] = defns.lm_idx(j) t0 = time.time() S0[i, j] = sums.sum_nnk(E, L, nnk, l1, m1, l2, m2, alpha, smart_cutoff=0) t1 = time.time() print('old time:', t1 - t0) S1[i, j] = sums.sum_nnk(E,