Analysis script also for finiterectlat constant driving results

This commit is contained in:
Marek Nečada 2022-01-03 20:58:01 +02:00
parent 0315481977
commit 63f7f216b0
1 changed files with 26 additions and 13 deletions

View File

@ -42,11 +42,16 @@ def _meta_matspec2emg(matspec):
return EpsMuGenerator(lorentz_drude[matspec]) return EpsMuGenerator(lorentz_drude[matspec])
class FiniteRectLatModesAnalysis: class FiniteRectLatAnalysis:
'''Recreates the scattering system structure from finiterectlat_modes.py''' '''Recreates the scattering system structure from finiterectlat-modes.py or
finiterectlat-constant-driving.py'''
def __init__(self, data): def __init__(self, data):
meta = data['meta'][()] meta = data['meta'][()]
thegroup = 'D2h' if meta['D2'] else 'D4h' scatter = 'symmetry_adapted' in meta.keys()# finiterectlat-constant-driving ; TODO unify
if scatter:
thegroup = meta['symmetry_adapted']
else: # finiterectlat-modes
thegroup = 'D2h' if meta['D2'] else 'D4h'
Nx, Ny = meta['size'] Nx, Ny = meta['size']
px, py = meta['period'] px, py = meta['period']
orig_x = (np.arange(Nx/2) + (0 if (Nx % 2) else .5)) * px orig_x = (np.arange(Nx/2) + (0 if (Nx % 2) else .5)) * px
@ -62,8 +67,9 @@ class FiniteRectLatModesAnalysis:
tmgen = TMatrixGenerator.cylinder(bg, fg, meta['radius'], meta['height'], lMax_extend=meta['lMax_extend']) tmgen = TMatrixGenerator.cylinder(bg, fg, meta['radius'], meta['height'], lMax_extend=meta['lMax_extend'])
particles = [Particle(orig_xy[i], tmgen, bspec) for i in np.ndindex(orig_xy.shape[:-1])] particles = [Particle(orig_xy[i], tmgen, bspec) for i in np.ndindex(orig_xy.shape[:-1])]
sym = FinitePointGroup(point_group_info[thegroup]) sym = FinitePointGroup(point_group_info[thegroup])
self.ss, self.ssw = ScatteringSystem.create(particles, bg, meta['centre'] * eh, sym=sym) omega = data['omega'][()] if scatter else meta['centre'] * eh
ss1, ssw1 = ScatteringSystem.create([Particle([0,0,0], tmgen, bspec)], bg, meta['centre']*eh, sym=sym) self.ss, self.ssw = ScatteringSystem.create(particles, bg, omega, sym=sym)
ss1, ssw1 = ScatteringSystem.create([Particle([0,0,0], tmgen, bspec)], bg, omega, sym=sym)
self.ss1, self.ssw1 = ss1, ssw1 self.ss1, self.ssw1 = ss1, ssw1
# per-particle projectors/transformation to symmetry-adapted bases # per-particle projectors/transformation to symmetry-adapted bases
@ -97,19 +103,26 @@ class FiniteRectLatModesAnalysis:
self.meta = meta self.meta = meta
self.npzfile = data self.npzfile = data
self.eigval = data['eigval'] self.fvcs1 = fvcs1
self.neig = len(self.eigval) self.iris1 = np.array(iris1)
self.eigvec = data['eigvec']
self.residuals = data['residuals']
self.ranktest_SV = data['ranktest_SV']
self.iri = data['iri'][()]
self.bspec = bspec self.bspec = bspec
self.nelem = nelem self.nelem = nelem
self.Nx, self.Ny, self.px, self.py = Nx, Ny, px, py self.Nx, self.Ny, self.px, self.py = Nx, Ny, px, py
self.posmap = posmap self.posmap = posmap
self.fullvec_poffsets = nelem * np.arange(Nx*Ny) self.fullvec_poffsets = nelem * np.arange(Nx*Ny)
self.fvcs1 = fvcs1 if scatter:
self.iris1 = np.array(iris1) self.typ = 'scatter'
self.fvcs1_fromdata = data['fvcs1']
self.iris1_fromdata = data['iris1']
self.positions_fromdata = data['positions']
else: # modes
self.typ = 'modes'
self.eigval = data['eigval']
self.neig = len(self.eigval)
self.eigvec = data['eigvec']
self.residuals = data['residuals']
self.ranktest_SV = data['ranktest_SV']
self.iri = data['iri'][()]
def fullvec2grid(self, fullvec, swapxy=False): def fullvec2grid(self, fullvec, swapxy=False):