# Internals

These functions are not exported by the TransferMatrix.jl module and can be called using the `TransferMatrix.`

qualifier. Use these methods if you wish to construct a transfer matrix method manually step by step or modify intermediate steps.

## Index

`TransferMatrix.abs_ratio`

`TransferMatrix.calculate_q`

`TransferMatrix.calculate_Γ_S`

`TransferMatrix.calculate_γ`

`TransferMatrix.construct_a`

`TransferMatrix.construct_Δ`

`TransferMatrix.dynamical_matrix`

`TransferMatrix.evaluate_birefringence`

`TransferMatrix.interp_data`

`TransferMatrix.layer_params`

`TransferMatrix.permeability_tensor`

`TransferMatrix.poynting`

`TransferMatrix.poynting`

`TransferMatrix.tr_from_poynting`

`TransferMatrix.tr_from_poynting`

`TransferMatrix.tr_from_Γ`

`TransferMatrix.tr_from_Γ`

`TransferMatrix.transfermatrix`

`TransferMatrix.yaml_example`

## Transfer Matrix Functions

`TransferMatrix.abs_ratio`

— MethodRatio of the absolution squares of two components used to evaluate if a material is birefringent.

`TransferMatrix.calculate_q`

— Method`calculate_q(Δ, a)`

The four eigenvalues of $q$ may be obtained from the 4x4 matrix Δ and then eigenvectors may be found for each eigenvalue. Here the eigenvalues must be sorted appropriately to avoid potentially discontinuous solutions. This extends from the work in

Li et al, 1988, DOI: 10.1364/AO.27.001334

`TransferMatrix.calculate_Γ_S`

— Function`calculate_Γ_S(s::Structure, θ=0.0)`

Calculate the total structure transfer matrix Γ and the Poynting vector S for all input frequencies ω, returning the TransferMatrixResult type, which contains all transfer matrices, Poynting vectors, and ξ.

`TransferMatrix.calculate_γ`

— Method`calculate_γ(ξ, q, ε, μ)`

The 4 x 3 matrix γ contains vector components that belong to the electric field calculated such that singularities are identified and removed.

`q[1]`

and `q[2]`

are forward-traveling modes and `q[3]`

and `q[4]`

are backward-traveling modes.

This is based on the work in:

Xu et al. Optical degeneracies in anisotropic layered media: Treatment of singularities in a 4x4 matrix formalism, 2000. DOI: 10.1103/PhysRevB.61.1740

`TransferMatrix.construct_a`

— Method`construct_a(ξ, M)`

Construct the elements of the intermediate 6x6 matrix $a$ in terms of the elements of matrix $M$ (the 6x6 matrix holding the material dielectric and permeability tensors) and propagation vector ξ. This is implemented as described in

Berreman, 1972, DOI: 10.1364/JOSA.62.000502

`TransferMatrix.construct_Δ`

— Method`construct_Δ(ξ, M, a)`

Construct the reordered matrix Δ in terms of the elements of the two matrices, M and a, and the in-plane reduced wavevector ξ = $k_x / k_0$. The matrix Δ is involved in the relation

$\frac{\delta}{\delta z}\Psi = \frac{i \omega}{c}\Delta \Psi$

and Δ is the reordered S matrix in Berreman's formulation.

Berreman, 1972, DOI: 10.1364/JOSA.62.000502

`TransferMatrix.dynamical_matrix`

— Method`dynamical_matrix(ξ, q, γ, μ)`

The dynamical matrix relating two layers at the interface where matrix $A_i$ for layer $i$ relates the field $E_i$ to the field in the previous layer $i - 1$ via

$A_{i-1}E_{i-1} = A_{i}E_{i}$

Xu et al., 2000, DOI: 10.1103/PhysRevB.61.1740

`TransferMatrix.evaluate_birefringence`

— Method`evaluate_birefringence(Ψ, S, t_modes, r_modes)`

For the four modes (two transmitting and two reflecting), the ratio

\[\begin{aligned} C &= |E_x|^2 / (|E_x|^2 + |E_y|^2) \\&= |Ψ_1|^2 / (|Ψ_1|^2 + |Ψ_3|^2) \end{aligned}\]

is evaluated. Recall that the values for the electric field are contained in the eigenvector matrix, Ψ.

If the layer material is birefringent, there will be anisotropy in the dielectric tensor. If this is the case, the x and y components of the Poynting vector needs to be analyzed (eqn 15 in Passler et al., 2017):

\[C = |S_x|^2 / (|S_x|^2 + |S_y|^2)\]

If there is no birefringence, then the electric field is analyzed. This analysis follows

Li et al., 1988, DOI: 10.1364/AO.27.001334

and the use of the Poynting vector is from

Passler et al., 2017, DOI: 10.1364/JOSAB.34.002128

and

Passler et al., 2019, DOI: 10.1364/JOSAB.36.003246

`TransferMatrix.interp_data`

— Method`interp_data(layer::Layer, λs)`

Given a new set of wavelengths (the Vector, λs), interpolate the complex refractive index values for the input Layer and return a new Layer with the new λ, n, and κ. The new wavelengths must not extend beyond the domain of the existing wavelengths in the Layer (i.e. no extrapolation).

Here we use LinearInterpolation from the package DataInterpolations.jl

`TransferMatrix.layer_params`

— Method`layer_params(ω, ξ, n, μ, d)`

Calculate all parameters for a single layer, particularly the propagation matrix and dynamical matrix so that the overall transfer matrix can be calculated.

`TransferMatrix.permeability_tensor`

— Method`permeability_tensor(μ1, μ2, μ3)`

This produces the diagonal permeability tensor, which is identical to the way we build the `dielectric_tensor`

, and we include this function simply for completeness.

`TransferMatrix.poynting`

— Method`poynting(ξ, q_in, q_out, γ_in, γ_out, t_coefs, r_coefs)`

Calculate the Poynting vector from wavevectors $q$, componments of the electric field γ, and transmission and reflection coefficients.

`TransferMatrix.poynting`

— Method`poynting(Ψ, a)`

Calculates the Poynting vector for the structure from Ψ and matrix $a$.

From Berreman, 1972, Ψ is the column matrix:

\[\Psi = \begin{pmatrix} Ex \\Hy \\Ey \\-Hx \end{pmatrix}\]

for a right-handed Cartesian coordinate system with the z-axis along the normal to the multilayer structure.

Berreman, 1972, DOI: 10.1364/JOSA.62.000502

`TransferMatrix.tr_from_poynting`

— Method`tr_from_poynting(S::Poynting)`

Calculate transmittance from the Poynting vector struct, which contains incident and transmitted energy for both p-polarized and s-polarized waves.

`TransferMatrix.tr_from_poynting`

— Method`tr_from_poynting(Ss::Vector{Poynting})`

Calculate transmission and reflection spectra from a Vector of `Poynting`

types.

`TransferMatrix.tr_from_Γ`

— Method`tr_from_Γ(Γ::Matrix)`

Calculate reflectance and transmittance for the total structure. This takes the matrix Γ*, but for brevity we call it Γ in this function.

This follows the formalism in:

Yeh, Electromagnetic propagation in birefringent layered media, 1979, DOI: 10.1364/JOSA.69.000742

`TransferMatrix.tr_from_Γ`

— Method`tr_from_Γ(Γs::Vector)`

Calculate reflectance and transmittance for the total structure for each `Γ`

in the Vector of `Γs`

.

`TransferMatrix.transfermatrix`

— Method`transfermatrix(ω, ξ, q, γ, μ, d)`

Calcuate the transfer matrix from the dynamical (interface) matrix and propagation matrix for one layer.

## Types

## Data Read/Write Functions

`TransferMatrix.yaml_example`

— Method`yaml_example()`

Generate an example input parameter yaml file.