From 2f14de7dde93e912f179d8402e8ecb8c17e10996 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ne=C4=8Dada?= Date: Mon, 27 Apr 2020 16:56:31 +0300 Subject: [PATCH] Hex example fix K point position; add real freq SVD Former-commit-id: 5c7c1e2099a649e778beebf9382cd527108db5f4 --- examples/hexagonal/modes/00_params.sh | 2 +- examples/hexagonal/modes/01a_realfreq_svd.sh | 16 ++++++++++++++++ qpms/argproc.py | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100755 examples/hexagonal/modes/01a_realfreq_svd.sh diff --git a/examples/hexagonal/modes/00_params.sh b/examples/hexagonal/modes/00_params.sh index 3f512f2..050c80f 100644 --- a/examples/hexagonal/modes/00_params.sh +++ b/examples/hexagonal/modes/00_params.sh @@ -25,7 +25,7 @@ export B2Y_nmi=$(bc <<< '4*pi/3/'${SEPARATION_nm}) # a K-point coordinates export KPOINTX_nmi=$(bc <<< '4*pi/3/sqrt(3)'/${SEPARATION_nm}) -export KPOINTY_nmi=$(bc <<< '4*pi/3/sqrt(3)'/${SEPARATION_nm}) +export KPOINTY_nmi=0.0 #$(bc <<< '4*pi/3/sqrt(3)'/${SEPARATION_nm}) export RADIUS_nm=50 export HEIGHT_nm=50 diff --git a/examples/hexagonal/modes/01a_realfreq_svd.sh b/examples/hexagonal/modes/01a_realfreq_svd.sh new file mode 100755 index 0000000..64a2a75 --- /dev/null +++ b/examples/hexagonal/modes/01a_realfreq_svd.sh @@ -0,0 +1,16 @@ +#!/bin/bash +SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +MISCDIR=../../../misc + +source ${SCRIPTDIR}/00_params.sh + +${MISCDIR}/lat2d_realfreqsvd.py \ + -B $BG_REFINDEX \ + -b s${A1X_nm}e-9 s${A1Y_nm}e-9 \ + -b s${A2X_nm}e-9 s${A2Y_nm}e-9 \ + -p s${P1X_nm}e-9 s${P1Y_nm}e-9 \ + -p s${P2X_nm}e-9 s${P2Y_nm}e-9 \ + -L 3 -m $METAL -r ${RADIUS_nm}e-9 -H ${HEIGHT_nm}e-9 \ + -k s${KPOINTX_nmi}e9 s${KPOINTY_nmi}e9 \ + -F 1.3 0.001 1.5 \ + -P diff --git a/qpms/argproc.py b/qpms/argproc.py index b947ff2..cc48d78 100644 --- a/qpms/argproc.py +++ b/qpms/argproc.py @@ -114,6 +114,20 @@ def sfloat(string): else: raise exc return res +def sint(string): + '''Tries to match an int, or an int with prepended 's' + + Used as a workaraound for argparse's negative number matcher if '+' is used as a + prefix + ''' + try: + res = int(string) + except ValueError as exc: + if string[0] == 's': + res = int(string[1:]) + else: raise exc + return res + def material_spec(string): """Tries to parse a string as a material specification, i.e. a real or complex number or one of the string in built-in Lorentz-Drude models.