PyLlama: A stable and versatile Python toolkit for the electromagnetic modelling of multilayered anisotropic media - Bay, Mélanie M.; Vignolini, Silvia; Vynck, Kevin (Computer physics communications, 2022)
PyLlama is a handy Python toolkit to compute the electromagnetic reflection and transmission properties of arbitrary multilayered linear media, including the case of anisotropy. Relying on a 4×4-matrix formalism, PyLlama implements not only the transfer matrix method, that is the most popular choice in existing codes, but also the scattering matrix method, which is numerically stable in all situations (e.g., thick, highly birefringent cholesteric structures at grazing incident angles). PyLlama is also designed to suit the practical needs by allowing the user to create, edit and assemble layers or multilayered domains with great ease. In this article, we present the electromagnetic theory underlying the transfer matrix and scattering matrix methods and outline the architecture and main features of PyLlama. Finally, we validate the code by comparison with available analytical solutions and demonstrate its versatility and numerical stability by modelling cholesteric media of varying complexity. A detailed documentation and tutorial are provided in a separate user manual. Applications of PyLlama range from the design of optical components to the modelling of polaritonic effects in polar crystals, to the study of structurally coloured materials in the living world. Program Title: PyLlama – Python Toolkit for the Electromagnetic Modelling of Multilayered Anisotropic Media CPC Library link to program files:https://doi.org/10.17632/dzw8x5vyrv.1 Developer's repository link:https://github.com/VignoliniLab/PyLlama Licensing provisions: GPLv3 Programming language: Python Supplementary material: User guide and tutorials at https://pyllama.readthedocs.io/ Nature of problem: Computation of the optical reflection and transmission coefficients of arbitrary multilayered linear media, composed of an arbitrary number of layers, possibly mixing isotropic and anisotropic, absorbing and non-absorbing materials, for linearly or circularly polarised light. Solution method: Implementation of both the transfer matrix method (faster) and the scattering matrix method (more robust) relying on a 4×4 matrix formalism. Additional comments including restrictions and unusual features: Integration of a physical model to handle cholesteric structures, blueprint for the integration of user-created custom systems, hassle-free export of spectra for non-programmers even for complex and/or custom systems. External routines include: Numpy [1], Scipy [2], as well as Sympy [3] (optional). [1]Numpy, https://numpy.org/.[2]Scipy, https://www.scipy.org/.[3]Sympy, https://www.sympy.org/.