Analysis script also for finiterectlat constant driving results

This commit is contained in:
Marek Nečada 2022-01-03 20:58:01 +02:00 committed by Marek Nečada
parent 2c12d28c70
commit 030a96d56f
1 changed files with 26 additions and 13 deletions

View File

@ -42,10 +42,15 @@ 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'][()]
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' thegroup = 'D2h' if meta['D2'] else 'D4h'
Nx, Ny = meta['size'] Nx, Ny = meta['size']
px, py = meta['period'] px, py = meta['period']
@ -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.fvcs1 = fvcs1
self.iris1 = np.array(iris1)
self.bspec = bspec
self.nelem = nelem
self.Nx, self.Ny, self.px, self.py = Nx, Ny, px, py
self.posmap = posmap
self.fullvec_poffsets = nelem * np.arange(Nx*Ny)
if scatter:
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.eigval = data['eigval']
self.neig = len(self.eigval) self.neig = len(self.eigval)
self.eigvec = data['eigvec'] self.eigvec = data['eigvec']
self.residuals = data['residuals'] self.residuals = data['residuals']
self.ranktest_SV = data['ranktest_SV'] self.ranktest_SV = data['ranktest_SV']
self.iri = data['iri'][()] self.iri = data['iri'][()]
self.bspec = bspec
self.nelem = nelem
self.Nx, self.Ny, self.px, self.py = Nx, Ny, px, py
self.posmap = posmap
self.fullvec_poffsets = nelem * np.arange(Nx*Ny)
self.fvcs1 = fvcs1
self.iris1 = np.array(iris1)
def fullvec2grid(self, fullvec, swapxy=False): def fullvec2grid(self, fullvec, swapxy=False):