Faster versions of hexpoint calculations (work in progress)
Former-commit-id: 44a7ed6419a966e2d71c258953d1d01dc0ed87ab
This commit is contained in:
parent
2149a9ca71
commit
0643ff4b3e
|
@ -28,8 +28,8 @@ omega = omega_eV * eV / hbar
|
||||||
|
|
||||||
k_0 = omega * math.sqrt(epsilon_b) / c
|
k_0 = omega * math.sqrt(epsilon_b) / c
|
||||||
|
|
||||||
output_prefix = './diracpoints-newdata/%d/' % maxlayer
|
output_prefix = '/tmp/diracpoints-newdata2/%d/' % maxlayer
|
||||||
|
|
||||||
os.makedirs(output_prefix, exist_ok=True)
|
os.makedirs(output_prefix, exist_ok=True)
|
||||||
qpms.hexlattice_precalc_AB_save(file=output_prefix+str(omega_eV), lMax=lMax, k_hexside=k_0*hexside,
|
qpms.hexlattice_precalc_AB_save3(file=output_prefix+str(omega_eV), lMax=lMax, k_hexside=k_0*hexside,
|
||||||
maxlayer=maxlayer, savepointinfo=True)
|
maxlayer=maxlayer, savepointinfo=True)
|
||||||
|
|
|
@ -169,9 +169,141 @@ def generate_trianglepoints_hexcomplement(maxlayer, v3d = True, circular = True,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
from qpms_c import get_mn_y
|
from qpms_c import get_mn_y, trans_calculator
|
||||||
from .qpms_p import Ã, B̃, cart2sph
|
from .qpms_p import Ã, B̃, cart2sph
|
||||||
|
|
||||||
|
def hexlattice_precalc_AB_save2(file, lMax, k_hexside, maxlayer, circular=True, savepointinfo = False, J_scat=3):
|
||||||
|
params = {
|
||||||
|
'lMax' : lMax,
|
||||||
|
'k_hexside' : k_hexside,
|
||||||
|
'maxlayer' : maxlayer,
|
||||||
|
'circular' : circular,
|
||||||
|
'savepointinfo' : savepointinfo,
|
||||||
|
'J_scat' : J_scat
|
||||||
|
}
|
||||||
|
tpdict = generate_trianglepoints(maxlayer, v3d=True, circular=circular, sixthindices=True, mirrorindices=True)
|
||||||
|
tphcdict = generate_trianglepoints_hexcomplement(maxlayer, v3d=True, circular=circular, thirdindices=True, mirrorindices=True)
|
||||||
|
my, ny = get_mn_y(lMax)
|
||||||
|
nelem = len(my)
|
||||||
|
a_self_nm = np.empty((tpdict['nmi'].shape[0],nelem,nelem), dtype=complex)
|
||||||
|
b_self_nm = np.empty((tpdict['nmi'].shape[0],nelem,nelem), dtype=complex)
|
||||||
|
a_self_m0 = np.empty((tpdict['mi'].shape[1],nelem,nelem), dtype=complex)
|
||||||
|
b_self_m0 = np.empty((tpdict['mi'].shape[1],nelem,nelem), dtype=complex)
|
||||||
|
a_d2u_nm = np.empty((tphcdict['nmi'].shape[0],nelem,nelem), dtype=complex)
|
||||||
|
b_d2u_nm = np.empty((tphcdict['nmi'].shape[0],nelem,nelem), dtype=complex)
|
||||||
|
a_d2u_m0 = np.empty((tphcdict['mi'].shape[1],nelem,nelem), dtype=complex)
|
||||||
|
b_d2u_m0 = np.empty((tphcdict['mi'].shape[1],nelem,nelem), dtype=complex)
|
||||||
|
|
||||||
|
k_0 = k_hexside*_s3 # not really a wave vector here because of the normalisation!
|
||||||
|
tc = trans_calculator(lMax)
|
||||||
|
|
||||||
|
y = np.arange(nelem)
|
||||||
|
|
||||||
|
points = tpdict['points'][tpdict['nmi']]
|
||||||
|
d_i2j = cart2sph(points)
|
||||||
|
a_self_nm, b_self_nm = tc.get_AB(my[nx,:,nx],ny[nx,:,nx],my[nx,nx,:],ny[nx,nx,:],k_0*d_i2j[:,nx,nx,0],d_i2j[:,nx,nx,1],d_i2j[:,nx,nx,2],False,J_scat)
|
||||||
|
|
||||||
|
points = tpdict['points'][tpdict['mi'][0]]
|
||||||
|
d_i2j = cart2sph(points)
|
||||||
|
a_self_m0, b_self_m0 = tc.get_AB(my[nx,:,nx],ny[nx,:,nx],my[nx,nx,:],ny[nx,nx,:],k_0*d_i2j[:,nx,nx,0],d_i2j[:,nx,nx,1],d_i2j[:,nx,nx,2],False,J_scat)
|
||||||
|
|
||||||
|
points = tphcdict['points'][tphcdict['nmi']]
|
||||||
|
d_i2j = cart2sph(points)
|
||||||
|
a_d2u_nm, b_d2u_nm = tc.get_AB(my[nx,:,nx],ny[nx,:,nx],my[nx,nx,:],ny[nx,nx,:],k_0*d_i2j[:,nx,nx,0],d_i2j[:,nx,nx,1],d_i2j[:,nx,nx,2],False,J_scat)
|
||||||
|
|
||||||
|
points = tphcdict['points'][tphcdict['mi'][0]]
|
||||||
|
d_i2j = cart2sph(points)
|
||||||
|
a_d2u_m0, b_d2u_m0 = tc.get_AB(my[nx,:,nx],ny[nx,:,nx],my[nx,nx,:],ny[nx,nx,:],k_0*d_i2j[:,nx,nx,0],d_i2j[:,nx,nx,1],d_i2j[:,nx,nx,2],False,J_scat)
|
||||||
|
|
||||||
|
tosave = {
|
||||||
|
'a_self_nm' : a_self_nm,
|
||||||
|
'a_self_m0' : a_self_m0,
|
||||||
|
'b_self_nm' : b_self_nm,
|
||||||
|
'b_self_m0' : b_self_m0,
|
||||||
|
'a_d2u_nm' : a_d2u_nm,
|
||||||
|
'a_d2u_m0' : a_d2u_m0,
|
||||||
|
'b_d2u_nm' : b_d2u_nm,
|
||||||
|
'b_d2u_m0' : b_d2u_m0,
|
||||||
|
'precalc_params' : params
|
||||||
|
}
|
||||||
|
if savepointinfo:
|
||||||
|
tosave['tp_points'] = tpdict['points'],
|
||||||
|
tosave['tp_si'] = tpdict['si'],
|
||||||
|
tosave['tp_mi'] = tpdict['mi'],
|
||||||
|
tosave['tp_nmi'] = tpdict['nmi']
|
||||||
|
tosave['tphc_points'] = tphcdict['points'],
|
||||||
|
tosave['tphc_ti'] = tphcdict['ti'],
|
||||||
|
tosave['tphc_mi'] = tphcdict['mi'],
|
||||||
|
tosave['tphc_nmi'] = tphcdict['nmi']
|
||||||
|
np.savez(file, **tosave)
|
||||||
|
|
||||||
|
def hexlattice_precalc_AB_save3(file, lMax, k_hexside, maxlayer, circular=True, savepointinfo = False, J_scat=3):
|
||||||
|
params = {
|
||||||
|
'lMax' : lMax,
|
||||||
|
'k_hexside' : k_hexside,
|
||||||
|
'maxlayer' : maxlayer,
|
||||||
|
'circular' : circular,
|
||||||
|
'savepointinfo' : savepointinfo,
|
||||||
|
'J_scat' : J_scat
|
||||||
|
}
|
||||||
|
tpdict = generate_trianglepoints(maxlayer, v3d=True, circular=circular, sixthindices=True, mirrorindices=True)
|
||||||
|
tphcdict = generate_trianglepoints_hexcomplement(maxlayer, v3d=True, circular=circular, thirdindices=True, mirrorindices=True)
|
||||||
|
my, ny = get_mn_y(lMax)
|
||||||
|
nelem = len(my)
|
||||||
|
a_self_nm = np.empty((tpdict['nmi'].shape[0],nelem,nelem), dtype=complex)
|
||||||
|
b_self_nm = np.empty((tpdict['nmi'].shape[0],nelem,nelem), dtype=complex)
|
||||||
|
a_self_m0 = np.empty((tpdict['mi'].shape[1],nelem,nelem), dtype=complex)
|
||||||
|
b_self_m0 = np.empty((tpdict['mi'].shape[1],nelem,nelem), dtype=complex)
|
||||||
|
a_d2u_nm = np.empty((tphcdict['nmi'].shape[0],nelem,nelem), dtype=complex)
|
||||||
|
b_d2u_nm = np.empty((tphcdict['nmi'].shape[0],nelem,nelem), dtype=complex)
|
||||||
|
a_d2u_m0 = np.empty((tphcdict['mi'].shape[1],nelem,nelem), dtype=complex)
|
||||||
|
b_d2u_m0 = np.empty((tphcdict['mi'].shape[1],nelem,nelem), dtype=complex)
|
||||||
|
|
||||||
|
k_0 = k_hexside*_s3 # not really a wave vector here because of the normalisation!
|
||||||
|
tc = trans_calculator(lMax)
|
||||||
|
|
||||||
|
y = np.arange(nelem)
|
||||||
|
|
||||||
|
points = tpdict['points'][tpdict['nmi']]
|
||||||
|
d_i2j = cart2sph(points)
|
||||||
|
a_self_nm, b_self_nm = tc.get_AB_arrays(k_0*d_i2j[:,0],d_i2j[:,1],d_i2j[:,2],np.array([False]),J_scat)
|
||||||
|
|
||||||
|
points = tpdict['points'][tpdict['mi'][0]]
|
||||||
|
d_i2j = cart2sph(points)
|
||||||
|
a_self_m0, b_self_m0 = tc.get_AB_arrays(k_0*d_i2j[:,0],d_i2j[:,1],d_i2j[:,2],np.array([False]),J_scat)
|
||||||
|
|
||||||
|
points = tphcdict['points'][tphcdict['nmi']]
|
||||||
|
d_i2j = cart2sph(points)
|
||||||
|
a_d2u_nm, b_d2u_nm = tc.get_AB_arrays(k_0*d_i2j[:,0],d_i2j[:,1],d_i2j[:,2],np.array([False]),J_scat)
|
||||||
|
|
||||||
|
points = tphcdict['points'][tphcdict['mi'][0]]
|
||||||
|
d_i2j = cart2sph(points)
|
||||||
|
a_d2u_m0, b_d2u_m0 = tc.get_AB_arrays(k_0*d_i2j[:,0],d_i2j[:,1],d_i2j[:,2],np.array([False]),J_scat)
|
||||||
|
|
||||||
|
tosave = {
|
||||||
|
'a_self_nm' : a_self_nm,
|
||||||
|
'a_self_m0' : a_self_m0,
|
||||||
|
'b_self_nm' : b_self_nm,
|
||||||
|
'b_self_m0' : b_self_m0,
|
||||||
|
'a_d2u_nm' : a_d2u_nm,
|
||||||
|
'a_d2u_m0' : a_d2u_m0,
|
||||||
|
'b_d2u_nm' : b_d2u_nm,
|
||||||
|
'b_d2u_m0' : b_d2u_m0,
|
||||||
|
'precalc_params' : params
|
||||||
|
}
|
||||||
|
if savepointinfo:
|
||||||
|
tosave['tp_points'] = tpdict['points'],
|
||||||
|
tosave['tp_si'] = tpdict['si'],
|
||||||
|
tosave['tp_mi'] = tpdict['mi'],
|
||||||
|
tosave['tp_nmi'] = tpdict['nmi']
|
||||||
|
tosave['tphc_points'] = tphcdict['points'],
|
||||||
|
tosave['tphc_ti'] = tphcdict['ti'],
|
||||||
|
tosave['tphc_mi'] = tphcdict['mi'],
|
||||||
|
tosave['tphc_nmi'] = tphcdict['nmi']
|
||||||
|
np.savez(file, **tosave)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def hexlattice_precalc_AB_save(file, lMax, k_hexside, maxlayer, circular=True, savepointinfo = False, J_scat=3):
|
def hexlattice_precalc_AB_save(file, lMax, k_hexside, maxlayer, circular=True, savepointinfo = False, J_scat=3):
|
||||||
params = {
|
params = {
|
||||||
'lMax' : lMax,
|
'lMax' : lMax,
|
||||||
|
|
Loading…
Reference in New Issue