LayerOptics Tutorial

by Christian Vorwerk & Caterina Cocchi for exciting carbon

Purpose: This tutorial demonstrates the usage of the LayerOptics package, which allows for the determination of optical coefficients of layered systems. We will demonstrate the functionality of the package on the example of bithiophene thin films.

### 0. How to get the source code

Before starting, we need to download the python scripts of the LayerOptics package. In order to do this, first create a working directory LayerOptics and move inside it. From now on the symbol $will indicate the shell prompt. $ mkdir LayerOptics
$cd LayerOptics  A tar-file can be downloaded from the LayerOptics webpage. Once you have downloaded the tar-file LayerOptics_1.1.tar.gz to the working directory LayerOptics, we will extract the constituent files: $ tar xvf LayerOptics_1.1.tar.gz


Now the directory LayerOptics contains the three files:

• LO-setup.py
• LO-execute.py
• generate_ex.py

In order to perform calculations, we also need the dielectric tensor of the bithiophene thin film, which can be obtained either from TDDFT or BSE calculations. In this tutorial, we will not calculate explicitly the dielectric tensor, but use the one obtained from converged BSE calculations. The corresponding tar-file can be downloaded here. Once again, we extract from epsilon.tar.gz the files EPSILON_NAR_BSEsinglet_SCRfull_OCij.OUT (where i,j = 1,2,3 are the cartesian directions) with the following command:

$tar xvf epsilon.tar.gz  ### 1. Introduction Theoretical spectroscopy is a powerful tool to describe and predict optical properties of materials. Nowadays, routinely performed first-principles calculations only provide bulk dielectric tensors in the coordinate system of the unit cell. However, these outputs are hardly comparable with experimental data, which are typically given by macroscopic quantities, crucially depending on the laboratory setup. LayerOptics is a versatile and user-friendly implementation, based on the 4$\times$4 matrix formalism for the Maxwell equations, to compute optical coefficients in anisotropic layered materials. This formalism is a generalization for anisotropic media of the 2$\times$2 approach, commonly used for isotropic layered systems. More details on the approach can be found in a recent publication. We assume a system of layers, which are stacked in negative z-direction and are infinitely extended in the xy-plane. Each layer has a frequency-dependent dielectric tensor and a specific thickness. The top of the layered structure is occupied by a semi-infinite vacuum, the bottom by a semi-infinite substrate with constant isotropic dielectric function$\epsilon_s$. Between the vacuum and the substrate, there are the active layers with dielectric tensor$\mathbf{\epsilon}_i$and thickness$t_i$, where$i$runs over the number of intermediate layers. The beam angle is described by the azimuth angle$\Theta$relative to the z-axis. The polarization of the beam is described by the angle$\delta$relative to the positive y-axis, such that$\delta$=$0$degrees corresponds to full parallel polarization (p-polarization) and$\delta$=$90$degrees to fully perpendicular polarization (s-polarization). The setup for the following calculations is shown in this scheme LayerOptics is executed in two steps: • At first, the dielectric tensor of each layer can be rotated by three Euler angles to simulate different orientations of the layer with respect to the substrate and the incoming light. For this purpose, the script LO-setup.py is used, which activates an interactive script to guide the user through the setup. The rotation is performed by three successive rotations with three independent Euler angles$\alpha$,$\beta$, and$\gamma$. The direction of the rotations is illustrated in the following schema. More information can be found in Ref.[1]. • In the second step, the Fresnel coefficients, namely absorbance, reflection and transmission coefficients, are calculated for the layered system. Here, the beam angle and the polarization of the incoming light have to be specified. For this purpose, the script LO-execute.py is used, which also uses an interactive script. ### 2. Polarization-dependent absorption coefficient ##### i) Setup As an example, we study the polarization-dependent absorption of a thin-film of bithiophene crystal. This material is characterized by a monoclinic unit cell, including two inequivalent bithiophene molecules, as shown in the figure below. In such a crystal structure, the dielectric tensor has four independent components. To execute the setup script type the following line in your bash shell: $ ./LO-setup.py


At this point, an interactive interface will appear on the screen, asking the user to provide the necessary information to post-process the dielectric tensor. Specifically, the number of active layers has to be specified, as well as the Euler angles defining the rotation of the tensor, mimicking the rotation of the sample. Since we are considering here only a bithiophene thin film, type 1 after the line Please provide the layer index:. In this first example, no rotation is applied to the dielectric tensors. Hence, all Euler angles are to be set to zero. At this point, the interactive shell will look like the following:

The interactive script should look like the following:

       _________________________________________________________________
|                                                                 |
|                 WELCOME TO LAYEROPTICS (SETUP)                  |
|                                                                 |
|                 written by Christian Vorwerk                    |
|_________________________________________________________________|

>>>>>>>>     1

Please provide the Euler angle ALPHA (deg):
>>>>>>>>     0

Please provide the Euler angle BETA (deg):
>>>>>>>>     0

Please provide the Euler angle GAMMA (deg):
>>>>>>>>     0


After running the setup script, 9 additional files will appear in the working directory, labelled 1_ij.OUT, where i,j = 1,2,3 label the optical components, following the convention of the files EPSILON_NAR_BSEsinglet_SCRfull_OCij.OUT. They include the components of the rotated dielectric tensor of the first layer.

##### ii) Calculation of the absorption coefficients

Now, we want to calculate the absorbance of the bithiophene thin film at different polarization angles of the incoming light. To do so, run the script typing the following command on the bash shell:

$./LO-execute.py  Another interacting interface will appear. First, the user is asked to insert the the incidence angle$\Theta$of the incoming light. In this example, we choose$\Theta$=$0$degrees, such that the light beam is normal to the surface. Next, the angle of light polarization has to be specified. We explore a range of angles, from$\delta$=$0$degrees, corresponding to parallel (p) polarized light, to$\delta$=$90$degrees, denoting perpendicular (s)) light polarization, with steps of$10$degrees. Also, the number of active layers has to be specified. Important: The vacuum layer and the semi-infinite substrate are not to be included here! Again, we are considering a single thin film, hence you should type 1. Finally, the thickness of the active layer should be given in input. In this example, we assume the bithiophene layer to be 10 nm thick. Following these instructions, the interactive interface will look like this:  _________________________________________________________________ | | | WELCOME TO LAYEROPTICS | | | | written by Christian Vorwerk | |_________________________________________________________________| Set the ANGLE of the INCOMING BEAM or Type "RANGE" to consider a range of angles >>>>>>>> 0 Set the POLARIZATION ANGLE or Type "RANGE" to consider a range of angles >>>>>>>> RANGE Please type the two values between which the angle should be varied and the number of steps. >>>>>>>> 0 90 10 Provide the number of layers, not counting vacuum and substrate >>>>>>>> 1 For each layer. specify the thickness (nm): ******************************************* For Layer 1 >>>>>>>> 10 *******************************************  The calculation of the absorption coefficients will take a few seconds. Once the script is finished, 30 new files will appear in the working directory, namely absorbancel.out, transmissionl.out, and reflectionl.out coefficients, for each considered angle of the light polarization, indicated by l ranging from 0 ($\delta$=$0$degrees) to 9 ($\delta$=$90$degrees). Each file contains four columns. The first one is the energy of the incoming photon, expressed in eV; the second and the third ones are the parallel (p) and perpendicular (s) component of the given optical coefficient, respectively; the fourth column contains the total value of the optical coefficient. Using your favorite plotting program, for example xmgrace, you can now visualize the dependence of the total absorbance on the polarization angle. We plot here the total contribution of the optical coefficient, which is stored in the fourth column of the corresponding output file. The resulting plot, showing only the spectra obtained for$\delta$=$0$,$30$,$60$, and$90$degrees will look like this: We notice that for$\delta$=$90$degrees (p polarization) the spectrum is dominated by an intense peak centered at 4.75 eV. At increasing values of$\delta$additional peaks of increasing intensity appear at lower energy. For$\delta$=$90$degrees (s polarization), the spectrum exhibits three peaks, with the most intense on being centered at 4.5 eV. ### 3. Angle-dependent absorption coefficient As a second example, we calculate the dependence of the optical coefficients on the angle$\Theta$of the incoming light. To do so, we rotate the bithiophene thin film around the z-axis of the unit cell, in order to simulate different orientations of the molecules with respect to the substrate, as well as to the plane of incidence of the incoming light. First, we need to generate a new directory where we copy the scripts and necessary input files. To do so, type the following lines on your shell: $ cd ../
$mkdir LayerOptics_Theta$ cd LayerOptics_Theta
$cp ../LayerOptics/* ./$ rm *.out


Next, following the procedure showed and explained above, we have to run the setup script specifying the number of layers and the Euler rotation angles to apply to the system. The script is invoked with the command:

$./LO-setup.py  Again, we are considering only a one-layer system. However, differently from the previous example, we now apply an effective rotation of the Euler angle$\alpha$=$45$degrees to the four independent components of the dielectric tensor. The other two Euler angles are set to zero:$\beta$=$\gamma$=$0$degrees. The resulting interacting interface will look like this:  _________________________________________________________________ | | | WELCOME TO LAYEROPTICS (SETUP) | | | | written by Christian Vorwerk | |_________________________________________________________________| Please provide the layer index: >>>>>>>> 1 Please provide the Euler angle ALPHA (deg): >>>>>>>> 45 Please provide the Euler angle BETA (deg): >>>>>>>> 0 Please provide the Euler angle GAMMA (deg): >>>>>>>> 0  To calculate the optical coefficients at different angles of the incoming light beam, we execute the script by typing: $ ./LO-execute.py


Again, an interacting shell will appear. In this case, we vary the angle of the incoming beam ranging from $\Theta$=$0$ to $\Theta$=$80$ degrees. The polarization angle is kept fixed. We again consider a layer thickness of 10 nm. After typing these commands into the interacting interface, you will see on the screen:

       _________________________________________________________________
|                                                                 |
|                    WELCOME TO LAYEROPTICS                       |
|                                                                 |
|                 written by Christian Vorwerk                    |
|_________________________________________________________________|

Set the ANGLE of the INCOMING BEAM
or
Type "RANGE" to consider a range of angles
>>>>>>>>     RANGE

Please type the two values between which the angle
should be varied and the number of steps.
>>>>>>>>     0 80 10

Choose the polarization angle.
For an array of beam angles the polarization
has to be fixed
>>>>>>>>     0
Provide the number of layers, not counting vacuum and substrate
>>>>>>>>     1

For each layer. specify the thickness (nm):
*******************************************
For Layer  1
>>>>>>>>     10
*******************************************


After a few seconds, the calculation is completed. Again, a number of new files will appear in the working directory, labeled absorbancej.out, transmissionj.out, and reflectionj.out. In this case j ranges from 0 ($\Theta$=$0$ degrees) to 9 ($\Theta$=$80$ degrees). We visualize the s-polarized component of the reflection coefficient at different angles of the incident beam. This quantity is stored in the third column of the output files reflectionj.out.

The final plot for selected values of $\Theta$ will look like the following:

##### Exercise 1
• Calculate the optical coefficients of a two-layer system of bithiophene with different molecular orientation on a substrate. Use the original orientation for the top layer ($\alpha$=$\beta$=$\gamma$=$0$ degrees). The bottom layer is rotated by $\alpha$=$45$ and $\beta$=$\gamma$=$0$ degrees with respect to the orientation of the top layer. Use for each layer a thickness of 10 nm.
• Plot the total absorbance of this system as a function of the beam energy. Keep the beam angle at $\Theta$=$45$ degrees and consider incoming light, which is fully parallel (p) polarized. Compare the absorbance for the two-layer system with that of a 20 nm thick layer of unchanged orientation ($\alpha$=$\beta$=$\gamma$=$0$ degrees) and a 20 nm thick layer rotated by $\alpha$=$45$ and $\beta$=$\gamma$=$0$ degrees. For all three systems (two-layer system, only bottomlayer, only toplayer) use the same beam parameters.

Bibliography
1. C. Vorwerk, C. Cocchi, and C. Draxl, LayerOptics: Microscopic modeling of optical coefficients in layered materials, Comp. Phys. Comm. 201, 119–125 (2016)