Add D2h/D4h choice for square lattices in finiterectlat-modes.py

This commit is contained in:
Marek Nečada 2020-08-03 14:50:33 +03:00
parent 5285210489
commit 1a4b279eff
1 changed files with 9 additions and 4 deletions

View File

@ -19,8 +19,9 @@ ap.add_argument("-f", "--centre", type=complex, required=True, help='Contour cen
ap.add_argument("--ai", type=float, default=0.05, help="Contour imaginary half-axis in eV")
ap.add_argument("--ar", type=float, default=0.05, help="Contour real half-axis in eV")
ap.add_argument("-N", type=int, default="150", help="Integration contour discretisation size")
ap.add_argument("--D2", action='store_true', help="Use D2h symmetry even if the array has square symmetry")
ap.add_argument("--irrep", type=str, default="none", help="Irrep subspace (irrep index from 0 to 7, irrep label, or 'none' for no irrep decomposition")
ap.add_argument("--irrep", type=str, default="none", help="Irrep subspace (irrep index from 0 to 7 (9 for D4h), irrep label, or 'none' for no irrep decomposition")
a=ap.parse_args()
@ -30,11 +31,15 @@ logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)
Nx, Ny = a.size
px, py = a.period
thegroup = 'D4h' if px == py and Nx == Ny and not a.D2 else 'D2h'
particlestr = ("sph" if a.height is None else "cyl") + ("_r%gnm" % (a.radius*1e9))
if a.height is not None: particlestr += "_h%gnm" % (a.height * 1e9)
defaultprefix = "%s_p%gnmx%gnm_%dx%d_m%s_B%s_L%d_c(%s±%g±%gj)eV_cn%d" % (
defaultprefix = "%s_p%gnmx%gnm_%dx%d_m%s_B%s_L%d_c(%s±%g±%gj)eV_cn%d_%s" % (
particlestr, px*1e9, py*1e9, Nx, Ny, str(a.material), str(a.background), a.lMax,
str(a.centre), a.ai, a.ar, a.N)
str(a.centre), a.ai, a.ar, a.N,
thegroup,
)
logging.info("Default file prefix: %s" % defaultprefix)
def inside_ellipse(point_xy, centre_xy, halfaxes_xy):
@ -69,7 +74,7 @@ bspec = BaseSpec(lMax = a.lMax)
medium = EpsMuGenerator(ap.background_epsmu)
particles= [Particle(orig_xy[i], ap.tmgen, bspec) for i in np.ndindex(orig_xy.shape[:-1])]
sym = FinitePointGroup(point_group_info['D2h'])
sym = FinitePointGroup(point_group_info[thegroup])
logging.info("Creating scattering system object")
ss, ssw = ScatteringSystem.create(particles, medium, a.centre * eh, sym=sym)