qpms/examples/rectangular_constant_tmatrix/modes/00_params.sh

54 lines
1.4 KiB
Bash

#!/bin/bash
# Common parameters for a rectangular array
# N.B. We put those into bc, which does not understant exponential notation
export PX_nm=375
export PY_nm=375
export BG_REFINDEX=1.52
export BSPEC='[6,14]' # l = 1, m = +- 1 (i.e. xy) electric dipoles, nothing more
# Input parameters for T-matrix. It shall have the following form:
# '[[ T_mm, T_mp],
# [ T_mp, T_pp]]'
#
# The following lines are used to specify parameters for the most
# simplistic T-matrix that b having only diagonal elements, but
T_PHASE_MM=0.1
T_PHASE_PP=0.05
# "gain" factors; values larger than 1 are unphysical, 1 conserves energy
T_GAINFACTOR_MM=1
T_GAINFACTOR_PP=1
# Setup bc
echo 'scale=20;pi=3.14159265358979323846;' > bc_env
export BC_ENV_ARGS="bc_env"
# We have only one particle per unit cell here
export P1X_nm=0
export P1Y_nm=0
# Lattice vectors (for the general scripts)
export A1X_nm=${PX_nm}
export A1Y_nm=0
export A2X_nm=0
export A2Y_nm=${PY_nm}
# Reciprocal lattice vectors
export B1X_nmi=$(bc <<< '1/'${PX_nm})
export B1Y_nmi=0
export B2X_nmi=0
export B2Y_nmi=$(bc <<< '1/'${PY_nm})
# Constant T-matrix
T_MM="$(bc -l <<< -.5+.5*${T_GAINFACTOR_MM}*c\(${T_PHASE_MM}\))+$(bc -l <<< .5*${T_GAINFACTOR_MM}*s\(${T_PHASE_MM}\))j"
T_PP="$(bc -l <<< -.5+.5*${T_GAINFACTOR_PP}*c\(${T_PHASE_PP}\))+$(bc -l <<< .5*${T_GAINFACTOR_PP}*s\(${T_PHASE_PP}\))j"
export TMATRIX="\
[[${T_MM},0],\
[0,${T_PP}]]" # note no unescaped whitespaces allowed here