Rectangular lattice SVD computation script for the new paper.
Former-commit-id: 771b278b2eee810892934f379ceefc8554e24946
This commit is contained in:
parent
7ef8e764c7
commit
ea0b6fb402
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/env python
|
||||
# coding: utf-8
|
||||
from qpms import Particle, CTMatrix, BaseSpec, FinitePointGroup, ScatteringSystem, TMatrixInterpolator, eV, hbar, c
|
||||
from qpms.symmetries import point_group_info
|
||||
import numpy as np
|
||||
import os
|
||||
import sys
|
||||
nm = 1e-9
|
||||
|
||||
sym = FinitePointGroup(point_group_info['D2h'])
|
||||
bspec = BaseSpec(lMax = 2)
|
||||
tmfile = '/m/phys/project/qd/Marek/tmatrix-experiments/Cylinder/AaroBEC/cylinder_50nm_lMax4_cleaned.TMatrix'
|
||||
#outputdatadir = '/home/necadam1/wrkdir/AaroBECfinite_new'
|
||||
outputdatadir = '/u/46/necadam1/unix/project/AaroBECfinite_new'
|
||||
os.makedirs(outputdatadir, exist_ok = True)
|
||||
interp = TMatrixInterpolator(tmfile, bspec, symmetrise = sym, atol = 1e-8)
|
||||
# There is only one t-matrix in the system for each frequency. We initialize the matrix with the lowest frequency data.
|
||||
# Later, we can replace it using the tmatrix[...] = interp(freq) and s.update_tmatrices NOT YET; TODO
|
||||
|
||||
omega = float(sys.argv[3]) * eV/hbar
|
||||
sv_threshold = float(sys.argv[4])
|
||||
|
||||
# Now place the particles and set background index.
|
||||
px = 571*nm; py = 621*nm
|
||||
n = 1.51
|
||||
Nx = int(sys.argv[1])
|
||||
Ny = int(sys.argv[2])
|
||||
|
||||
orig_x = (np.arange(Nx/2) + (0 if (Nx % 2) else .5)) * px
|
||||
orig_y = (np.arange(Ny/2) + (0 if (Ny % 2) else .5)) * py
|
||||
|
||||
orig_xy = np.stack(np.meshgrid(orig_x, orig_y), axis = -1)
|
||||
|
||||
tmatrix = interp(omega)
|
||||
particles = [Particle(orig_xy[i], tmatrix) for i in np.ndindex(orig_xy.shape[:-1])]
|
||||
|
||||
|
||||
ss = ScatteringSystem(particles, sym)
|
||||
|
||||
|
||||
k = n * omega / c
|
||||
|
||||
|
||||
for iri in range(ss.nirreps):
|
||||
mm_iri = ss.modeproblem_matrix_packed(k, iri)
|
||||
U, S, Vh = np.linalg.svd(mm_iri)
|
||||
print(iri, ss.irrep_names[iri], S[-1])
|
||||
starti = np.searchsorted(S, sv_threshold, side='right')
|
||||
np.savez(os.path.join(outputdatadir, 'Nx%d_Ny%d_%geV_ir%d.npz'%(Nx, Ny, omega/eV*hbar, iri)),
|
||||
S=S[starti:], omega=omega, Vh = Vh[starti:], iri=iri, )
|
||||
|
||||
|
|
@ -846,8 +846,10 @@ complex double *qpms_orbit_irrep_basis(size_t *basis_size,
|
|||
|
||||
size_t bs;
|
||||
for(bs = 0; bs < n*N; ++bs) {
|
||||
#if 0
|
||||
qpms_pr_debug_at_flf(__FILE__, __LINE__, __func__,
|
||||
"%d. irrep, %zd. SV: %.16lf", (int) iri, bs, s[bs]);
|
||||
#endif
|
||||
if(s[bs] > 1 + SVD_ATOL) qpms_pr_error_at_flf(__FILE__, __LINE__, __func__,
|
||||
"%zd. SV too large: %.16lf", bs, s[bs]);
|
||||
if(s[bs] > SVD_ATOL && fabs(1-s[bs]) > SVD_ATOL)
|
||||
|
|
Loading…
Reference in New Issue