def K2inv(E,kvec,l,m,a0,r0,P0,a2): k = LA.norm(kvec) omk = defns.omega(k) E2star = defns.E2k(E,k) qk = defns.qst(E,k) h = sums.hh(E,k) if h==0: print('Error: invalid kvec in K2inv') if l==m==0: out = 1/(32*pi*omk*E2star) * ( -1/a0 + r0*qk**2/2 + P0*r0**3*qk**4 + abs(qk)*(1-h)) elif l==2 and -2<=m<=2: # out = 1/(32*pi*omk*E2star*qk**4) * ( -1/a2**5 + abs(qk)**5*(1-h) ) out = 1/(32*pi*omk*E2star) * ( -1/a2**5 + abs(qk)**5*(1-h) ) # TB, no q else: return 0 if out.imag > 1e-15: print('Error in K2inv: imaginary part in output') else: out = out.real return out
def G(e, L, nnp, nnk, l1, m1, l2, m2): p = sums.norm(nnp) * 2. * math.pi / L k = sums.norm(nnk) * 2. * math.pi / L # pk = sums.norm(np.add(nnk,nnp)) * 2. *math.pi/L pk = sums.norm(np.add(nnk, nnp)) * 2. * math.pi / L omp = npsqrt(1 + square(p)) omk = npsqrt(1 + square(k)) #ompk = np.sqrt(1+pk**2) bkp2 = (e - omp - omk)**2 - (2 * math.pi / L)**2 * sums.norm(np.add(nnk, nnp))**2 # print('test') # nnps and nnks are the full vectors p* and k* nnps = boost(np.multiply(nnp, 2 * math.pi / L), np.multiply(nnk, 2 * math.pi / L), e) nnks = boost(np.multiply(nnk, 2 * math.pi / L), np.multiply(nnp, 2 * math.pi / L), e) #ps = sums.norm(nnps) #ks = sums.norm(nnks) qps2 = square(e - omp) / 4 - square(p) / 4 - 1 qks2 = square(e - omk) / 4 - square(k) / 4 - 1 # TB: Choose spherical harmonic basis Ytype = 'r' # 'r' for real, 'c' for complex Ylmlm = 1 momfactor1 = 1 momfactor2 = 1 if (l1 == 2): #momfactor1 = (ks)**l1/qps2 momfactor1 = qps2**(-l1 / 2) # TB: ks**l1 included in my y2(nnks) #Ylmlm = y2(nnks,m1,Ytype) Ylmlm = y2real(nnks, m1) if (l2 == 2): #momfactor2 = (ps)**l2/qks2 momfactor2 = qks2**(-l2 / 2) # TB: ps**l2 included in my y2(nnps) #Ylmlm = Ylmlm * y2(nnps,m2,Ytype) Ylmlm = Ylmlm * y2real(nnps, m2) #out = sums.hh(e,p)*sums.hh(e,k)/(L**3 * 4*omp*omk*(bkp2-1)) *Ylmlm * momfactor1 * momfactor2 out = sums.hh(e, p) * sums.hh(e, k) / (L**3 * 4 * omp * omk * (bkp2 - 1)) * Ylmlm # TB, no q # if (Ytype=='r' or Ytype=='real') and abs(out.imag)>1e-15: # sys.exit('Error in G: imaginary part in real basis output') return out.real
def rho1mH(e, L, nk): k = nk * 2 * math.pi / L hhk = sums.hh(e, k) # print(1-sums.E2a2(e,k)) if hhk < 1: return np.sqrt(1 - sums.E2a2(e, k)) * (1 - hhk) else: return 0.
def Fmat00(E, L, alpha, IPV=0): shells = shell_list(E, L) F_list = [] for nnk in shells: nk = sums.norm(nnk) k = nk * 2 * math.pi / L hhk = sums.hh(E, k) omk = sqrt(1. + k**2) F_list += [(sums.F2KSS(E, L, nnk, 0, 0, 0, 0, alpha) + hhk * IPV / (32 * math.pi * 2 * omk))] * len(shell_nnk_list(nnk)) # print(F_list) return np.diag(F_list)