rcwa API

The main user-facing classes: Solver, Layer, LayerStack, Source, Material, Crystal, and Plotter. The Layer class is used to set up the individual simulation layers and define their properties, including thickness, material properties, and crystal structures (if applicable). The Material class can be passed into the Layer class to define a layer whose material properties are dependent on refractive index. The Crystal class is used to define layers which are periodic in x and y, and is also passed into the Layer class. Once all individual layers are constructed, they are used to create a LayerStack, which contains information about which region is considered the “incident” region and which is the “transmission” region (both are semi-infinite).

The Source class is used to define the excitation source - the wavelength, polarization, and incident angle.

Once the user has created a Source and LayerStack class, these are passed into the Solver class, which then runs the simulation, and makes the results available as a dictionary Solver.results.

class rcwa.Solver(layer_stack, source, n_harmonics=1)

Main class that invokes all methods necessary to solve an RCWA/TMM simulation

Parameters
  • layer_stack – layerStack: Stack of layers to simulate

  • source – Source object which includes wavelength and direction information

  • n_harmonics – The number of harmonics in x, y to simulate (number of Fourier components). For planar films this should be 1. For 1D diffraction gratings this should be a single integer. For 2D periodic films this should be a 2-tuple. Must be an odd number.

class rcwa.Layer(er: complex = 1.0, ur: complex = 1.0, thickness: complex = 0.0, n: Optional[complex] = None, material: Union[None, rcwa.material.Material] = None, crystal: Union[None, rcwa.crystal.Crystal] = None)

Class for defining a single layer of a layer stack used in a simulation

Parameters
  • er – Permittivity of the layer. Overridden by crystal permittivity if specified.

  • ur – Permeability of the layer. Overridden by crystal permeability if specified.

  • thickness – Thickness of the layer

  • n – Refractive index of the layer. Overridden by cristal er/ur if specified.

  • material – Material object containing the material’s permittivity and permeability as a function of wavelength/angle.

  • crystal – Crystal object if the layer is periodic in x and/or y. Overrides er, ur, n, and material

class rcwa.LayerStack(*internal_layers: rcwa.layer.Layer, incident_layer: rcwa.layer.Layer = <rcwa.layer.Layer object>, transmission_layer: rcwa.layer.Layer = <rcwa.layer.Layer object>)

Class that defines overall geometry in terms of a stack of layers

Parameters
  • internal_layers – Layer objects, starting with the top-most layer (reflection region) and ending with the top-most region (substrate)

  • incident_layer – Semi-infinite layer of incident region. Defaults to free space

  • transmission_layer – Semi-infinite layer of transmission region. Defaults to free space

class rcwa.Source(wavelength=6.283185307179586, theta=0, phi=0, pTEM=[1, 1], layer=<rcwa.layer.Layer object>)

Class for defining monochromatic excitation source

Parameters
  • wavelength – The wavelength (in microns, or your preferred length unit due to the scale-invariance of Maxwell’s equations.

  • theta – Angle with respect to the vector normal to the layer stack, in radians

  • phi – Rotation angle amount the vector normal to the layer stack

  • pTEM – Polarization vector for TE/TM polarization fraction (can be complex)

  • layer – Layer source is located in

class rcwa.Crystal(*lattice_vectors, er: Union[numpy.typing._array_like._SupportsArray[numpy.dtype], numpy.typing._nested_sequence._NestedSequence[numpy.typing._array_like._SupportsArray[numpy.dtype]], bool, int, float, complex, str, bytes, numpy.typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]] = 1, ur: Union[numpy.typing._array_like._SupportsArray[numpy.dtype], numpy.typing._nested_sequence._NestedSequence[numpy.typing._array_like._SupportsArray[numpy.dtype]], bool, int, float, complex, str, bytes, numpy.typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]] = 1)

Class used for defining periodic structures in x and y

Parameters
  • er – 2D numpy array of permittivity values

  • ur – 2D numpy array of permeability values

  • lattice_vectors – Real-space lattice vectors

class rcwa.Material(name=None, er=1, ur=1, n=None, database_path=None, filename=None, source=None)

Material class for defining materials permittivity / permeability / refractive index as a function of wavelength / angle.

Parameters
  • name – Material name to be looked up in database (i.e. Si)

  • er – Complex-valued numerical permittivity value or function of wavelength

  • ur – Complex-valued numerical permeability value or function of wavelength

  • n – Complex-valued refractive index of material. Overrides er / ur

  • source – Excitation source to link to material (mandatory for dispersive materials)

  • filename – File containing n/k data for the material in question

  • database_path – Raw file path within database

class rcwa.utils.Plotter
static plotRTSpectra(result)

Plots the reflectance, transmittance, and conservation spectra from a set of simulatiotn results

Parameters

resultsList – List of results from simulation output

Returns fig, ax

Figure and axes objects for plot