diff --git a/misc/dispersion2D-SVD.py b/misc/dispersion2D-SVD.py index 8cf2826..b76c4cc 100755 --- a/misc/dispersion2D-SVD.py +++ b/misc/dispersion2D-SVD.py @@ -303,7 +303,7 @@ kxmaplist = np.concatenate((np.array([0]),np.cumsum(np.linalg.norm(np.diff(klist klist = qpms.generate_trianglepoints(kdensity, v3d=True, include_origin=True)*3*math.pi/(3*kdensity*hexside) TMatrices_om = TMatrices_interp(freq) -svdres = hexlattice_zsym_getSVD(TMatrices_om=TMatrices_om, epsilon_b=epsilon_b, hexside=hexside, maxlayer=maxlayer, +svdres = qpms.hexlattice_zsym_getSVD(lMax=lMax, TMatrices_om=TMatrices_om, epsilon_b=epsilon_b, hexside=hexside, maxlayer=maxlayer, omega=freq, klist=klist, gaussianSigma=gaussianSigma, onlyNmin=(0 if svdout else svn)) if svdout: ((svUfullTElist, svSfullTElist, svVfullTElist), (svUfullTMlist, svSfullTMlist, svVfullTMlist)) = svdres diff --git a/qpms/hexpoints.py b/qpms/hexpoints.py index fcb748b..d53f7b7 100644 --- a/qpms/hexpoints.py +++ b/qpms/hexpoints.py @@ -434,23 +434,25 @@ def hexlattice_get_AB(lMax, k_hexside, maxlayer, circular=True, return_points = d['u2d_tr'] = -tphcdict['points'] d['self_tr'] = tpdict['points'] return d - -def hexlattice_zsym_getSVD(TMatrices_om, epsilon_b, hexside, maxlayer, omega, klist, gaussianSigma=False, onlyNmin=0): +from scipy.constants import c + +def hexlattice_zsym_getSVD(lMax, TMatrices_om, epsilon_b, hexside, maxlayer, omega, klist, gaussianSigma=False, onlyNmin=0): + nelem = lMax * (lMax + 2) n2id = np.identity(2*nelem) n2id.shape = (2,nelem,2,nelem) nan = float('nan') k_0 = omega * math.sqrt(epsilon_b) / c - tdic = qpms.hexlattice_get_AB(lMax,k_0*hexside,maxlayer) + tdic = hexlattice_get_AB(lMax,k_0*hexside,maxlayer) a_self = tdic['a_self'][:,:nelem,:nelem] b_self = tdic['b_self'][:,:nelem,:nelem] a_u2d = tdic['a_u2d'][:,:nelem,:nelem] b_u2d = tdic['b_u2d'][:,:nelem,:nelem] a_d2u = tdic['a_d2u'][:,:nelem,:nelem] b_d2u = tdic['b_d2u'][:,:nelem,:nelem] - unitcell_translations = tdic['self_tr']*hexside*s3 - u2d_translations = tdic['u2d_tr']*hexside*s3 - d2u_translations = tdic['d2u_tr']*hexside*s3 + unitcell_translations = tdic['self_tr']*hexside*_s3 + u2d_translations = tdic['u2d_tr']*hexside*_s3 + d2u_translations = tdic['d2u_tr']*hexside*_s3 if gaussianSigma: unitcell_envelope = np.exp(-np.sum(tdic['self_tr']**2,axis=-1)/(2*gaussianSigma**2))