Invntr
Source

All instruments

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

Admission replaythin_film 0.1.0 · files 53adc6cac4fd…cd06
  1. 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 used
    Rp0.04 ± 4e-110.04lockedunder 0.01 % of the tolerance used
    R_avg0.04 ± 4e-110.04lockedunder 0.01 % of the tolerance used
    Ts0.96 ± 9.6e-100.96lockedunder 0.01 % of the tolerance used
    Tp0.96 ± 9.6e-100.96lockedunder 0.01 % of the tolerance used
    phase_r_s_deg180 ± 1e-09180lockedunder 0.01 % of the tolerance used
    layer_count= 00lockedexact match
  2. r0002Ideal 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 used
    Rp0 ± 1e-121.24822e-32lockedunder 0.01 % of the tolerance used
    Ts1 ± 1e-091lockedunder 0.01 % of the tolerance used
    R_avg_min0 ± 1e-122.59628e-23lockedunder 0.01 % of the tolerance used
    wavelength_at_R_min_nm550 ± 0.001550lockedunder 0.01 % of the tolerance used
  3. r0003Quarter-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 used
    R_avg0.0126008 ± 1.3e-110.0126008lockedunder 0.01 % of the tolerance used
    Ts0.987399 ± 9.9e-100.987399lockedunder 0.01 % of the tolerance used
    R_avg_min0.0126008 ± 1.3e-110.0126008lockedunder 0.01 % of the tolerance used
    wavelength_at_R_min_nm552 ± 0.001552locked0.56 % of the tolerance used
    total_thickness_nm100 ± 1e-10100lockedunder 0.01 % of the tolerance used
  4. r0004Half-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 used
    Rp0.04258 ± 4.3e-110.04258lockedunder 0.01 % of the tolerance used
    T_avg0.95742 ± 9.6e-100.95742lockedunder 0.01 % of the tolerance used
  5. r0005Brewster 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 used
    Tp1 ± 1e-091lockedunder 0.01 % of the tolerance used
    Rs0.147929 ± 1.5e-100.147929lockedunder 0.01 % of the tolerance used
    brewster_bare_deg56.3099 ± 5.6e-1156.3099lockedunder 0.01 % of the tolerance used
    angle_at_Rp_min_deg56.3099 ± 1e-0556.3099locked0.015 % of the tolerance used
    Rp_min0 ± 1e-122.62085e-22lockedunder 0.01 % of the tolerance used
  6. r0006Fresnel 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 used
    Rp0.00846646 ± 8.5e-120.00846646lockedunder 0.01 % of the tolerance used
    R_plus_Ts1 ± 1e-121lockedunder 0.01 % of the tolerance used
    R_plus_Tp1 ± 1e-121locked0.044 % of the tolerance used
  7. r0007Quarter-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 used
    Ts0.0432395 ± 4.3e-100.0432395lockedunder 0.01 % of the tolerance used
    layer_count= 88lockedexact match
  8. r0008Absorbing 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 used
    Rp0.923372 ± 9.2e-100.923372lockedunder 0.01 % of the tolerance used
    Ts0.0766284 ± 7.7e-110.0766284lockedunder 0.01 % of the tolerance used
  9. r0009Absorbing 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 used
    Ts0.342251 ± 3.4e-100.342251lockedunder 0.01 % of the tolerance used
    As0.419294 ± 4.2e-100.419294lockedunder 0.01 % of the tolerance used
    Rp0.145144 ± 1.5e-100.145144lockedunder 0.01 % of the tolerance used
    Tp0.379971 ± 3.8e-100.379971lockedunder 0.01 % of the tolerance used
    Ap0.474885 ± 4.7e-100.474885lockedunder 0.01 % of the tolerance used
  10. r0010Total 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 used
    Rp1 ± 1e-121lockedunder 0.01 % of the tolerance used
    Ts0 ± 1e-120lockedunder 0.01 % of the tolerance used
    Tp0 ± 1e-120lockedunder 0.01 % of the tolerance used
    critical_angle_deg41.8103 ± 4.2e-1141.8103lockedunder 0.01 % of the tolerance used
  11. r0011Energy 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 used
    R_plus_Tp1 ± 1e-121locked0.022 % of the tolerance used
    A_avg0 ± 1e-120lockedunder 0.01 % of the tolerance used
    energy_ok= truetruelockedexact match
    lossless= truetruelockedexact match
11 of 11 cases passed · sandbox macos-seatbeltrecorded from the kernel in a fresh lab

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

NameUnitDefaultMeaning
n_incident11.0Refractive 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.
repeat11The 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_n11.52Real part of the substrate (exit medium) index.
substrate_k10.0Extinction coefficient of the substrate (0 for a clear one; a metal has k of a few).
wavelength_nmnm550.0Vacuum wavelength of the headline readings and of the angle scan.
design_wavelength_nmnm550.0Reference wavelength for thicknesses given as qwot: d = qwot * design_wavelength / (4 n).
angle_degdeg0.0Angle of incidence from the normal, in the incident medium; used for the headline readings and the spectrum.
wavelength_min_nmnm400.0Start of the spectrum.
wavelength_max_nmnm800.0End of the spectrum.
wavelength_points1201Points in the spectrum, evenly spaced in wavelength.
angle_max_degdeg89.0The angle scan runs from 0 to this angle at wavelength_nm.
angle_points190Points in the angle scan.

Readings

NameUnitMeaning
Rs1Reflectance (fraction of incident power), s polarisation, at wavelength_nm and angle_deg.
Rp1Reflectance, p polarisation.
R_avg1Reflectance of unpolarised light, (Rs + Rp) / 2.
Ts1Transmittance into the substrate, s; from the transmitted flux, not from 1 - R.
Tp1Transmittance into the substrate, p.
T_avg1Transmittance of unpolarised light.
As1Absorptance in the layers, 1 - R - T, s (|A| below 1e-12 is written as 0).
Ap1Absorptance in the layers, p.
A_avg1Absorptance of unpolarised light.
R_plus_Ts1R + T for s as computed: 1 for a lossless stack, below 1 with absorption.
R_plus_Tp1R + T for p as computed.
phase_r_s_degdegPhase of the amplitude reflection coefficient, s, exp(-i w t) convention; null when r is zero.
phase_r_p_degdegPhase 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_degdegatan(substrate_n / n_incident), the Brewster angle of the uncoated interface; null for an absorbing substrate.
critical_angle_degdegasin(substrate_n / n_incident) when the substrate is the rarer lossless medium; otherwise null.
R_avg_min1Lowest unpolarised reflectance in the band at angle_deg (grid minimum refined between its neighbours).
wavelength_at_R_min_nmnm
R_avg_max1Highest unpolarised reflectance in the band.
wavelength_at_R_max_nmnm
R_avg_band_mean1Mean unpolarised reflectance over the band (trapezoid rule on the wavelength grid).
T_avg_band_mean1Mean unpolarised transmittance over the band.
Rp_min1Lowest p reflectance in the angle scan.
angle_at_Rp_min_degdegAngle of that minimum: the Brewster angle of a bare dielectric, a pseudo-Brewster angle otherwise.
layer_count1
total_thickness_nmnm
losslesstrue when every layer and the substrate have k = 0.
energy_oktrue when R + T <= 1 + 1e-9 and every number is finite at the headline point, over the spectrum and over the angle scan.
warningsPlain-language cautions: total internal reflection, evanescent layers, very thick layers.
layersThe layer list as resolved (one period), incident side first.
spectrum.csvwavelength_nm, Rs, Rp, R_avg, Ts, Tp, T_avg, As, Ap, A_avg at angle_deg.
angle_scan.csvangle_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.

Terminal
MCP call