1 Using QPMS library for finding modes of 2D-periodic systems
2 ===========================================================
4 Calculating modes of infinite 2D arrays is now done
5 in several steps (assuming the T-matrices have already
6 been obtained using `scuff-tmatrix` or can be obtained
7 from Lorenz-Mie solution (spherical particles)):
9 1. Sampling the *k*, *ω* space.
10 2. Pre-calculating the
11 Ewald-summed translation operators.
12 3. For each *k*, *ω* pair, build the LHS operator
13 for the scattering problem (TODO reference), optionally decomposed
14 into suitable irreducible representation subspaces.
15 4. Evaluating the singular values and finding their minima.
17 The steps above may (and will) change as more user-friendly interface
21 Preparation: compile the `ew_gen_kin` utility
22 ---------------------------------------------
24 This will change, but at this point, the lattice-summed
25 translation operators are computed using the `ew_gen_kin`
26 utility located in the `qpms/apps` directory. It has to be built
31 c99 -o ew_gen_kin -Wall -I ../.. -I ../../amos/ -O2 -ggdb -DQPMS_VECTORS_NICE_TRANSFORMATIONS -DLATTICESUMS32 2dlattice_ewald.c ../translations.c ../ewald.c ../ewaldsf.c ../gaunt.c ../lattices2d.c ../latticegens.c ../bessel.c -lgsl -lm -lblas ../../amos/libamos.a -lgfortran ../error.c
34 Step 1: Sampling the *k*, *ω* space
35 --------------------------------------
37 `ew_gen_kin` expects a list of (*k_x*, *k_y*)
38 pairs on standard input (separated by whitespaces),
39 the rest is specified via command line arguments.
41 So if we want to examine the line between the Г point and the point
42 \f$ k = (0, 10^5\,\mathrm{m}^{-1}) \f$, we can generate an input
45 for ky in $(seq 0 1e3 1e5); do
50 It also make sense to pre-generate the list of *ω* values,
53 seq 6.900 0.002 7.3 | sed -e 's/,/./g' > omegalist
57 Step 2: Pre-calculating the translation operators
58 -------------------------------------------------
60 `ew_gen_kin` currently uses command-line arguments in
61 an atrocious way with a hard-coded order:
63 ew_gen_kin outfile b1.x b1.y b2.x b2.y lMax scuffomega refindex npart part0.x part0.y [part1.x part1.y [...]]
65 where `outfile` specifies the path to the output, `b1` and `b2` are the
66 direct lattice vectors, `lMax` is the multipole degree cutoff,
67 `scuffomega` is the frequency in the units used by `scuff-tmatrix`
68 (TODO specify), `refindex` is the refractive index of the background
69 medium, `npart` number of particles in the unit cell, and `partN` are
70 the positions of these particles inside the unit cell.
72 Assuming we have the `ew_gen_kin` binary in our `${PATH}`, we can
75 for omega in $(cat omegalist); do
76 ew_gen_kin $omega 621e-9 0 0 571e-9 3 w_$omega 1.52 1 0 0 < klist
79 This pre-calculates the translation operators for a simple (one particle per unit cell)
80 621 nm × 571 nm rectangular lattice inside a medium with refractive index 1.52,
81 up to the octupole (`lMax` = 3) order, yielding one file per frequency.
82 This can take some time and
83 it makes sense to run a parallelised `for`-loop instead; this is a stupid but working
86 N=4 # number of parallel processes
87 for omega in $(cat omegalist); do
88 ((i=i%N)); ((i++==0)) && wait
89 ew_gen_kin $omega 621e-9 0 0 571e-9 3 w_$omega 1.52 1 0 0 < klist
90 echo $omega # optional, to follow progress
94 When this is done, we convert all the text output files into
95 numpy's binary format in order to speed up loading in the following steps.
96 This is done using the processWfiles_sortnames.py script located in the
97 `misc` directory. Its usage pattern is
99 processWfiles_sortnames.py npart dest src1 [src2 ...]
101 where `npart` is the number of particles in the unit cell, `dest`
102 is the destination path for the converted data (this will be
103 a directory), and the remaining arguments are paths to the
104 files generated by `ew_gen_kin`. In the case above, one could use
106 processWfiles_sortnames.py 1 all w_*
108 which would create a directory named `all` containing several
115 TODO. For the time being, see e.g. the `SaraRect/dispersions.ipynb` jupyter notebook
116 from the `qpms_ipynotebooks` repository
117 for the remaining steps.