Materials
Real materials have a wavelength-dependent complex refractive index — a real part
n (dispersion) and an imaginary part k (absorption). The Material class
supplies these to the solvers, resolving material names against bundled catalogs.
You rarely construct Material objects by hand: every solver auto-wraps the
values you pass in mat_in, mat_out, and mat_ls. You can freely mix:
- scalars —
1.5,2.10(constant, lossless index) - complex —
2.40 + 0.001j(constant index with loss) - names —
"air","N-BK7"(Sellmeier glass),"SiO2","TiO2","Ag"(thin-film n+k tables), resolved case-insensitively
from difftmm import IsotropicFilmSolver, Material, list_materials
print(len(list_materials()), "materials available")
solver = IsotropicFilmSolver(
mat_in="air",
mat_out="N-BK7", # Sellmeier dispersion (AGF catalog)
mat_ls=["TiO2", "SiO2"], # n+k tables for thin-film materials
thickness_ls=[0.06, 0.10],
)
Two dispersion models are supported: Sellmeier (analytical, real n, from the
bundled CDGM / SCHOTT / MISC / PLASTIC AGF glass catalogs) and linear
interpolation (complex n + ik lookup tables, for thin-film materials). For the
4×4 anisotropic solver, per-axis dispersion is expressed as a
(mat_x, mat_y, mat_z) tuple per layer.
Material
difftmm.Material
Optical material with wavelength-dependent complex refractive index.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str | float | complex
|
Lowercase material name for catalog materials, or the original numeric value for constant-dispersion materials. |
dispersion |
str
|
'sellmeier' | 'interp' | 'constant'. |
n |
float
|
Nominal refractive index at d-line (587 nm). |
V |
float
|
Abbe number (1e38 for non-dispersive materials). |
Source code in difftmm-src/difftmm/material/materials.py
to
Move cached interpolation tensors to the given device.
Returns self for chaining.
Source code in difftmm-src/difftmm/material/materials.py
ior
Compute the complex refractive index at given wavelengths.
The TMM solvers always require complex output — even for lossless real-valued materials — because evanescent waves (beyond critical angle) make cos(theta_layer) imaginary during propagation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wvln
|
Tensor
|
real tensor of wavelengths in μm. |
required |
Returns:
torch.complex64 tensor with the same shape as wvln.
Source code in difftmm-src/difftmm/material/materials.py
refractive_index
Return the complex refractive index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wvln
|
'float | torch.Tensor'
|
float (returns Python complex) or tensor (returns complex tensor). |
required |
Returns:
| Type | Description |
|---|---|
|
Python complex when wvln is a scalar, torch.complex64 tensor otherwise. |
Source code in difftmm-src/difftmm/material/materials.py
list_materials
difftmm.list_materials
Return all known material names from all bundled catalogs (sorted).
Returns:
| Type | Description |
|---|---|
list[str]
|
Sorted list of lowercase material name strings. |