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))^2 = 0.04, T = 0.96, reflection phase 180 deg (Hecht, Optics, sec. 4.6); closed form, 1e-9passed
Rs0.04 ± 4e-110.04lockedunder 0.01 % of the tolerance usedRp0.04 ± 4e-110.04lockedunder 0.01 % of the tolerance usedR_avg0.04 ± 4e-110.04lockedunder 0.01 % of the tolerance usedTs0.96 ± 9.6e-100.96lockedunder 0.01 % of the tolerance usedTp0.96 ± 9.6e-100.96lockedunder 0.01 % of the tolerance usedphase_r_s_deg180 ± 1e-09180lockedunder 0.01 % of the tolerance usedlayer_count= 00lockedexact matchr0002Ideal quarter-wave antireflection layer, n1 = sqrt(n0 ns) = sqrt(1.5): R = 0 and T = 1 at the design wavelength 550 nm, and the band minimum sits there; closed form (abs 1e-12 on R; 1e-3 nm on the refined minimum)passed
Rs0 ± 1e-121.24822e-32lockedunder 0.01 % of the tolerance usedRp0 ± 1e-121.24822e-32lockedunder 0.01 % of the tolerance usedTs1 ± 1e-091lockedunder 0.01 % of the tolerance usedR_avg_min0 ± 1e-122.59628e-23lockedunder 0.01 % of the tolerance usedwavelength_at_R_min_nm550 ± 0.001550lockedunder 0.01 % of the tolerance usedr0003Quarter-wave MgF2-like layer n1 = 1.38, d = 552/(4*1.38) = 100 nm, on ns = 1.52 at 552 nm: R = ((n0 ns - n1^2)/(n0 ns + n1^2))^2 = 0.01260079021463 (1.26 %), minimum of the band at 552 nm; closed form, 1e-9passed
Rs0.0126008 ± 1.3e-110.0126008lockedunder 0.01 % of the tolerance usedR_avg0.0126008 ± 1.3e-110.0126008lockedunder 0.01 % of the tolerance usedTs0.987399 ± 9.9e-100.987399lockedunder 0.01 % of the tolerance usedR_avg_min0.0126008 ± 1.3e-110.0126008lockedunder 0.01 % of the tolerance usedwavelength_at_R_min_nm552 ± 0.001552locked0.56 % of the tolerance usedtotal_thickness_nm100 ± 1e-10100lockedunder 0.01 % of the tolerance usedr0004Half-wave (absentee) layer n1 = 2.3 on ns = 1.52: R is the bare-substrate value ((1 - 1.52)/(1 + 1.52))^2 = 0.04257999496095; closed form, 1e-9passed
Rs0.04258 ± 4.3e-110.04258lockedunder 0.01 % of the tolerance usedRp0.04258 ± 4.3e-110.04258lockedunder 0.01 % of the tolerance usedT_avg0.95742 ± 9.6e-100.95742lockedunder 0.01 % of the tolerance usedr0005Brewster angle atan(1.5) = 56.30993247402 deg on bare glass: Rp = 0, Tp = 1, Rs = ((n^2 - 1)/(n^2 + 1))^2 = 0.147928994083, and the angle scan finds the same angle; closed form (abs 1e-12 on Rp, 1e-5 deg on the refined scan minimum)passed
Rp0 ± 1e-123.08149e-33lockedunder 0.01 % of the tolerance usedTp1 ± 1e-091lockedunder 0.01 % of the tolerance usedRs0.147929 ± 1.5e-100.147929lockedunder 0.01 % of the tolerance usedbrewster_bare_deg56.3099 ± 5.6e-1156.3099lockedunder 0.01 % of the tolerance usedangle_at_Rp_min_deg56.3099 ± 1e-0556.3099locked0.015 % of the tolerance usedRp_min0 ± 1e-122.62085e-22lockedunder 0.01 % of the tolerance usedr0006Fresnel at 45 deg on glass n = 1.5: Rs = ((cos t - sqrt(n^2 - sin^2 t))/(cos t + sqrt(n^2 - sin^2 t)))^2 = 0.0920133630455 and the exact identity Rp = Rs^2 = 0.00846645897895; closed form, 1e-9passed
Rs0.0920134 ± 9.2e-110.0920134lockedunder 0.01 % of the tolerance usedRp0.00846646 ± 8.5e-120.00846646lockedunder 0.01 % of the tolerance usedR_plus_Ts1 ± 1e-121lockedunder 0.01 % of the tolerance usedR_plus_Tp1 ± 1e-121locked0.044 % of the tolerance usedr0007Quarter-wave mirror air|(HL)^4|glass, nH = 2.3, nL = 1.38, ns = 1.52: Y = (nH/nL)^8 ns, R = ((1 - Y)/(1 + Y))^2 = 0.956760461605 (Macleod, Thin-Film Optical Filters, quarter-wave stack); closed form, 1e-9passed
Rs0.95676 ± 9.6e-100.95676lockedunder 0.01 % of the tolerance usedTs0.0432395 ± 4.3e-100.0432395lockedunder 0.01 % of the tolerance usedlayer_count= 88lockedexact matchr0008Absorbing substrate N = 0.2 + 3i at normal incidence: R = ((n - 1)^2 + k^2)/((n + 1)^2 + k^2) = 9.64/10.44, T = 4n/((n + 1)^2 + k^2) = 0.8/10.44 (Born and Wolf, metal reflection); closed form, 1e-9passed
Rs0.923372 ± 9.2e-100.923372lockedunder 0.01 % of the tolerance usedRp0.923372 ± 9.2e-100.923372lockedunder 0.01 % of the tolerance usedTs0.0766284 ± 7.7e-110.0766284lockedunder 0.01 % of the tolerance usedr0009Absorbing film N = 2.0 + 0.5i, 80 nm, on ns = 1.52, 600 nm, 30 deg: 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, 1e-9passed
Rs0.238455 ± 2.4e-100.238455lockedunder 0.01 % of the tolerance usedTs0.342251 ± 3.4e-100.342251lockedunder 0.01 % of the tolerance usedAs0.419294 ± 4.2e-100.419294lockedunder 0.01 % of the tolerance usedRp0.145144 ± 1.5e-100.145144lockedunder 0.01 % of the tolerance usedTp0.379971 ± 3.8e-100.379971lockedunder 0.01 % of the tolerance usedAp0.474885 ± 4.7e-100.474885lockedunder 0.01 % of the tolerance usedr0010Total internal reflection, glass n = 1.5 to air at 45 deg (critical angle asin(1/1.5) = 41.8103148958 deg): R = 1, T = 0 for both polarisations; exactpassed
Rs1 ± 1e-121lockedunder 0.01 % of the tolerance usedRp1 ± 1e-121lockedunder 0.01 % of the tolerance usedTs0 ± 1e-120lockedunder 0.01 % of the tolerance usedTp0 ± 1e-120lockedunder 0.01 % of the tolerance usedcritical_angle_deg41.8103 ± 4.2e-1141.8103lockedunder 0.01 % of the tolerance usedr0011Energy conservation, lossless five-layer stack at 45 deg, 633 nm: R + T = 1 and A = 0 for s and p (T comes from the transmitted flux, not from 1 - R); exact, abs 1e-12passed
R_plus_Ts1 ± 1e-121lockedunder 0.01 % of the tolerance usedR_plus_Tp1 ± 1e-121locked0.022 % of the tolerance usedA_avg0 ± 1e-120lockedunder 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 1e-12 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 + 1e-9 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.