thin_film
Multilayer thin-film stack by the transfer-matrix (characteristic-matrix) method: reflectance, transmittance and absorptance for s and p polarisation at one wavelength and angle, across a wavelength band and across an angle scan.
Layers are listed from the incident side to the substrate, each with a complex index n + i k (k ≥ 0 absorbs) and a thickness in nm or in quarter-waves at the design wavelength.
Indices are constants: give them at the wavelength of interest (no dispersion model, no material table).
Coherent, flat, isotropic layers; the substrate is semi-infinite (no back-face reflection).
- Field
- Waves, optics and circuits
- Version
- 0.1.0
- Runs as
- Compiled (Rust)
- Typical run
- 0.05 s
Compiled from source: run sh packs/install.sh once before admitting it.
Known answers it must pass
r0001Fresnel, normal incidence, air to glass n = 1.5: R = ((1 - 1.5)/(1 + 1.5))² = 0.04, T = 0.96, reflection phase 180° (Hecht, Optics, sec. 4.6); closed form, 10⁻⁹passed
Rs0.04 ± 4 × 10⁻¹¹0.04lockedunder 0.01 % of the tolerance usedRp0.04 ± 4 × 10⁻¹¹0.04lockedunder 0.01 % of the tolerance usedR_avg0.04 ± 4 × 10⁻¹¹0.04lockedunder 0.01 % of the tolerance usedTs0.96 ± 9.6 × 10⁻¹⁰0.96lockedunder 0.01 % of the tolerance usedTp0.96 ± 9.6 × 10⁻¹⁰0.96lockedunder 0.01 % of the tolerance usedphase_r_s_deg180 ± 10⁻⁹180lockedunder 0.01 % of the tolerance usedlayer_count= 00lockedexact matchr0002Ideal quarter-wave antireflection layer, n₁ = √(n₀ ns) = √(1.5): R = 0 and T = 1 at the design wavelength 550 nm, and the band minimum sits there; closed form (abs 10⁻¹² on R; 10⁻³ nm on the refined minimum)passed
Rs0 ± 10⁻¹²1.24822 × 10⁻³²lockedunder 0.01 % of the tolerance usedRp0 ± 10⁻¹²1.24822 × 10⁻³²lockedunder 0.01 % of the tolerance usedTs1 ± 10⁻⁹1lockedunder 0.01 % of the tolerance usedR_avg_min0 ± 10⁻¹²2.59628 × 10⁻²³lockedunder 0.01 % of the tolerance usedwavelength_at_R_min_nm550 ± 0.001550lockedunder 0.01 % of the tolerance usedr0003Quarter-wave MgF₂-like layer n₁ = 1.38, d = 552/(4·1.38) = 100 nm, on ns = 1.52 at 552 nm: R = ((n₀ ns - n₁²)/(n₀ ns + n₁²))² = 0.01260079021463 (1.26 %), minimum of the band at 552 nm; closed form, 10⁻⁹passed
Rs0.0126008 ± 1.3 × 10⁻¹¹0.0126008lockedunder 0.01 % of the tolerance usedR_avg0.0126008 ± 1.3 × 10⁻¹¹0.0126008lockedunder 0.01 % of the tolerance usedTs0.987399 ± 9.9 × 10⁻¹⁰0.987399lockedunder 0.01 % of the tolerance usedR_avg_min0.0126008 ± 1.3 × 10⁻¹¹0.0126008lockedunder 0.01 % of the tolerance usedwavelength_at_R_min_nm552 ± 0.001552locked0.56 % of the tolerance usedtotal_thickness_nm100 ± 10⁻¹⁰100lockedunder 0.01 % of the tolerance usedr0004Half-wave (absentee) layer n₁ = 2.3 on ns = 1.52: R is the bare-substrate value ((1 - 1.52)/(1 + 1.52))² = 0.04257999496095; closed form, 10⁻⁹passed
Rs0.04258 ± 4.3 × 10⁻¹¹0.04258lockedunder 0.01 % of the tolerance usedRp0.04258 ± 4.3 × 10⁻¹¹0.04258lockedunder 0.01 % of the tolerance usedT_avg0.95742 ± 9.6 × 10⁻¹⁰0.95742lockedunder 0.01 % of the tolerance usedr0005Brewster angle atan(1.5) = 56.30993247402° on bare glass: Rp = 0, Tp = 1, Rs = ((n² - 1)/(n² + 1))² = 0.147928994083, and the angle scan finds the same angle; closed form (abs 10⁻¹² on Rp, 10⁻⁵ deg on the refined scan minimum)passed
Rp0 ± 10⁻¹²3.08149 × 10⁻³³lockedunder 0.01 % of the tolerance usedTp1 ± 10⁻⁹1lockedunder 0.01 % of the tolerance usedRs0.147929 ± 1.5 × 10⁻¹⁰0.147929lockedunder 0.01 % of the tolerance usedbrewster_bare_deg56.3099 ± 5.6 × 10⁻¹¹56.3099lockedunder 0.01 % of the tolerance usedangle_at_Rp_min_deg56.3099 ± 10⁻⁵56.3099locked0.015 % of the tolerance usedRp_min0 ± 10⁻¹²2.62085 × 10⁻²²lockedunder 0.01 % of the tolerance usedr0006Fresnel at 45° on glass n = 1.5: Rs = ((cos t - √(n² - sin² t))/(cos t + √(n² - sin² t)))² = 0.0920133630455 and the exact identity Rp = Rs² = 0.00846645897895; closed form, 10⁻⁹passed
Rs0.0920134 ± 9.2 × 10⁻¹¹0.0920134lockedunder 0.01 % of the tolerance usedRp0.00846646 ± 8.5 × 10⁻¹²0.00846646lockedunder 0.01 % of the tolerance usedR_plus_Ts1 ± 10⁻¹²1lockedunder 0.01 % of the tolerance usedR_plus_Tp1 ± 10⁻¹²1locked0.044 % of the tolerance usedr0007Quarter-wave mirror air|(HL)⁴|glass, nH = 2.3, nL = 1.38, ns = 1.52: Y = (nH/nL)⁸ ns, R = ((1 - Y)/(1 + Y))² = 0.956760461605 (Macleod, Thin-Film Optical Filters, quarter-wave stack); closed form, 10⁻⁹passed
Rs0.95676 ± 9.6 × 10⁻¹⁰0.95676lockedunder 0.01 % of the tolerance usedTs0.0432395 ± 4.3 × 10⁻¹⁰0.0432395lockedunder 0.01 % of the tolerance usedlayer_count= 88lockedexact matchr0008Absorbing substrate N = 0.2 + 3i at normal incidence: R = ((n - 1)² + k²)/((n + 1)² + k²) = 9.64/10.44, T = 4n/((n + 1)² + k²) = 0.8/10.44 (Born and Wolf, metal reflection); closed form, 10⁻⁹passed
Rs0.923372 ± 9.2 × 10⁻¹⁰0.923372lockedunder 0.01 % of the tolerance usedRp0.923372 ± 9.2 × 10⁻¹⁰0.923372lockedunder 0.01 % of the tolerance usedTs0.0766284 ± 7.7 × 10⁻¹¹0.0766284lockedunder 0.01 % of the tolerance usedr0009Absorbing film N = 2.0 + 0.5i, 80 nm, on ns = 1.52, 600 nm, 30°: Airy single-film formula r = (r01 + r12 e^{2i d})/(1 + r01 r12 e^{2i d}) with Fresnel coefficients, evaluated apart from this program; closed form, 10⁻⁹passed
Rs0.238455 ± 2.4 × 10⁻¹⁰0.238455lockedunder 0.01 % of the tolerance usedTs0.342251 ± 3.4 × 10⁻¹⁰0.342251lockedunder 0.01 % of the tolerance usedAs0.419294 ± 4.2 × 10⁻¹⁰0.419294lockedunder 0.01 % of the tolerance usedRp0.145144 ± 1.5 × 10⁻¹⁰0.145144lockedunder 0.01 % of the tolerance usedTp0.379971 ± 3.8 × 10⁻¹⁰0.379971lockedunder 0.01 % of the tolerance usedAp0.474885 ± 4.7 × 10⁻¹⁰0.474885lockedunder 0.01 % of the tolerance usedr0010Total internal reflection, glass n = 1.5 to air at 45° (critical angle asin(1/1.5) = 41.8103148958°): R = 1, T = 0 for both polarisations; exactpassed
Rs1 ± 10⁻¹²1lockedunder 0.01 % of the tolerance usedRp1 ± 10⁻¹²1lockedunder 0.01 % of the tolerance usedTs0 ± 10⁻¹²0lockedunder 0.01 % of the tolerance usedTp0 ± 10⁻¹²0lockedunder 0.01 % of the tolerance usedcritical_angle_deg41.8103 ± 4.2 × 10⁻¹¹41.8103lockedunder 0.01 % of the tolerance usedr0011Energy conservation, lossless five-layer stack at 45°, 633 nm: R + T = 1 and A = 0 for s and p (T comes from the transmitted flux, not from 1 - R); exact, abs 10⁻¹²passed
R_plus_Ts1 ± 10⁻¹²1lockedunder 0.01 % of the tolerance usedR_plus_Tp1 ± 10⁻¹²1locked0.022 % of the tolerance usedA_avg0 ± 10⁻¹²0lockedunder 0.01 % of the tolerance usedenergy_ok= truetruelockedexact matchlossless= truetruelockedexact match
Each line is one reading the kernel checked. The bright band is the tolerance; the needle is the value the instrument actually returned when it was admitted. A needle near the centre line used little of its tolerance.
Inputs
| Name | Unit | Default | Meaning |
|---|---|---|---|
n_incident | 1 | 1.0 | Refractive index of the lossless medium the light comes from (1.0 for air). |
layers | [] | Layers from the incident side to the substrate. Each is {"n": index, "k": extinction (optional, ≥ 0), and either "d_nm": physical thickness or "qwot": optical thickness in quarter-waves at design_wavelength_nm, "name": optional label}. Empty list: a bare interface. | |
repeat | 1 | 1 | The layer list is laid down this many times in a row, e.g. [H, L] with repeat 8 is a 16-layer mirror. At most 2000 layers in all. |
substrate_n | 1 | 1.52 | Real part of the substrate (exit medium) index. |
substrate_k | 1 | 0.0 | Extinction coefficient of the substrate (0 for a clear one; a metal has k of a few). |
wavelength_nm | nm | 550.0 | Vacuum wavelength of the headline readings and of the angle scan. |
design_wavelength_nm | nm | 550.0 | Reference wavelength for thicknesses given as qwot: d = qwot · design_wavelength / (4 n). |
angle_deg | deg | 0.0 | Angle of incidence from the normal, in the incident medium; used for the headline readings and the spectrum. |
wavelength_min_nm | nm | 400.0 | Start of the spectrum. |
wavelength_max_nm | nm | 800.0 | End of the spectrum. |
wavelength_points | 1 | 201 | Points in the spectrum, evenly spaced in wavelength. |
angle_max_deg | deg | 89.0 | The angle scan runs from 0 to this angle at wavelength_nm. |
angle_points | 1 | 90 | Points in the angle scan. |
Readings
| Name | Unit | Meaning |
|---|---|---|
Rs | 1 | Reflectance (fraction of incident power), s polarisation, at wavelength_nm and angle_deg. |
Rp | 1 | Reflectance, p polarisation. |
R_avg | 1 | Reflectance of unpolarised light, (Rs + Rp) / 2. |
Ts | 1 | Transmittance into the substrate, s; from the transmitted flux, not from 1 - R. |
Tp | 1 | Transmittance into the substrate, p. |
T_avg | 1 | Transmittance of unpolarised light. |
As | 1 | Absorptance in the layers, 1 - R - T, s (|A| below 10⁻¹² is written as 0). |
Ap | 1 | Absorptance in the layers, p. |
A_avg | 1 | Absorptance of unpolarised light. |
R_plus_Ts | 1 | R + T for s as computed: 1 for a lossless stack, below 1 with absorption. |
R_plus_Tp | 1 | R + T for p as computed. |
phase_r_s_deg | deg | Phase of the amplitude reflection coefficient, s, exp(-i w t) convention; null when r is zero. |
phase_r_p_deg | deg | Phase of r for p in the tangential-E (admittance) convention, in which r_p = r_s at normal incidence; null when r is zero. |
brewster_bare_deg | deg | atan(substrate_n / n_incident), the Brewster angle of the uncoated interface; null for an absorbing substrate. |
critical_angle_deg | deg | asin(substrate_n / n_incident) when the substrate is the rarer lossless medium; otherwise null. |
R_avg_min | 1 | Lowest unpolarised reflectance in the band at angle_deg (grid minimum refined between its neighbours). |
wavelength_at_R_min_nm | nm | |
R_avg_max | 1 | Highest unpolarised reflectance in the band. |
wavelength_at_R_max_nm | nm | |
R_avg_band_mean | 1 | Mean unpolarised reflectance over the band (trapezoid rule on the wavelength grid). |
T_avg_band_mean | 1 | Mean unpolarised transmittance over the band. |
Rp_min | 1 | Lowest p reflectance in the angle scan. |
angle_at_Rp_min_deg | deg | Angle of that minimum: the Brewster angle of a bare dielectric, a pseudo-Brewster angle otherwise. |
layer_count | 1 | |
total_thickness_nm | nm | |
lossless | true when every layer and the substrate have k = 0. | |
energy_ok | true when R + T ≤ 1 + 10⁻⁹ and every number is finite at the headline point, over the spectrum and over the angle scan. | |
warnings | Plain-language cautions: total internal reflection, evanescent layers, very thick layers. | |
layers | The layer list as resolved (one period), incident side first. | |
spectrum.csv | wavelength_nm, Rs, Rp, R_avg, Ts, Tp, T_avg, As, Ap, A_avg at angle_deg. | |
angle_scan.csv | angle_deg and the same nine columns at wavelength_nm. |
Try the call
Change a value and the command updates. Nothing runs here; paste it into your terminal or give it to your agent.