Skip to content

MaterialDB

compass.materials.database.MaterialDB is the central registry for optical material properties. It provides wavelength-dependent refractive index (n,k) and complex permittivity ε for all materials used in simulations.

Interactive Material Optical Properties

Select a material to view its refractive index (n) and extinction coefficient (k) across the visible spectrum.

n (refractive index)4.05.06.0k (extinction coeff.)0.001.002.00400450500550600650700750Wavelength (nm)nk

Constructor

python
class MaterialDB:
    def __init__(self, db_path: Optional[str] = None):

Parameters:

  • db_path -- Path to directory containing CSV material files. Defaults to the materials/ directory at the project root.

On construction, MaterialDB automatically:

  1. Registers built-in constant and analytic materials (air, polymers, dielectrics)
  2. Loads tabulated CSV data from the materials directory (silicon, tungsten, color filters)
  3. Falls back to approximate built-in data if CSV files are missing

Querying methods

get_nk

python
def get_nk(self, name: str, wavelength: float) -> Tuple[float, float]:

Returns (n, k) -- real and imaginary parts of the refractive index -- at the given wavelength (in um).

Raises: KeyError if the material is not registered.

get_epsilon

python
def get_epsilon(self, name: str, wavelength: float) -> complex:

Returns complex permittivity ε=(n+ik)2 at the given wavelength.

get_epsilon_spectrum

python
def get_epsilon_spectrum(self, name: str, wavelengths: np.ndarray) -> np.ndarray:

Returns an array of complex permittivity values over a wavelength array.

list_materials

python
def list_materials(self) -> List[str]:

Returns a sorted list of all registered material names.

has_material

python
def has_material(self, name: str) -> bool:

Returns True if the material exists in the database.

Registration methods

register_constant

python
def register_constant(self, name: str, n: float, k: float = 0.0) -> None:

Register a material with fixed refractive index, independent of wavelength.

python
db.register_constant("my_glass", n=1.52, k=0.0)

register_cauchy

python
def register_cauchy(self, name: str, A: float, B: float = 0.0, C: float = 0.0) -> None:

Register a material with Cauchy dispersion model:

n(λ)=A+Bλ2+Cλ4

where λ is in um. The extinction coefficient k is zero (non-absorbing).

python
db.register_cauchy("polymer", A=1.56, B=0.004, C=0.0)

register_sellmeier

python
def register_sellmeier(self, name: str, B: List[float], C: List[float]) -> None:

Register a material with Sellmeier dispersion model:

n2(λ)=1+iBiλ2λ2Ci
python
db.register_sellmeier(
    "sio2",
    B=[0.6961663, 0.4079426, 0.8974794],
    C=[0.0684043**2, 0.1162414**2, 9.896161**2],
)

load_csv

python
def load_csv(self, name: str, filepath: str, interpolation: str = "cubic_spline") -> None:

Load tabulated material data from a CSV file. The CSV format is:

# wavelength(um), n, k
0.400, 5.381, 0.340
0.410, 5.253, 0.296
...

Lines starting with # are treated as comments. Data is automatically sorted by wavelength. Interpolation uses cubic splines (requires >= 4 data points) or linear interpolation as fallback.

Parameters:

  • name -- Material name for registration.
  • filepath -- Path to CSV file.
  • interpolation -- "cubic_spline" (default) or "linear".

Built-in materials

Core materials

NameTypeModelTypical nTypical k
airConstantn=1.0, k=0.01.00.0
polymer_n1p56CauchyA=1.56, B=0.0041.560.0
sio2Sellmeier3-term1.460.0
si3n4Sellmeier2-term2.00.0
hfo2CauchyA=1.90, B=0.021.900.0
tio2CauchyA=2.27, B=0.052.270.0
siliconTabulatedGreen 20083.5-5.60.003-3.0
tungstenTabulatedApproximate3.4-3.72.7-3.4
cf_redTabulatedLorentzian1.550-0.15
cf_greenTabulatedLorentzian1.550-0.12
cf_blueTabulatedLorentzian1.550-0.18

Metals

Tabulated optical constants for metals commonly used in CIS interconnects, metal grids, and plasmonic structures. Wavelength range: 300--1100 nm.

NameFormulaSourceTypical n (550nm)Typical k (550nm)
aluminumAlRakic 19980.585.52
goldAuJohnson & Christy 19720.173.29
silverAgJohnson & Christy 19720.074.39
copperCuJohnson & Christy 19720.531.74
titaniumTiJohnson & Christy 19742.373.30
titanium_nitrideTiNPatsalas 20031.312.31

Dielectrics

Tabulated optical constants for dielectric films used in antireflection coatings (ARC), passivation, and transparent conductors.

NameFormulaSourceTypical n (550nm)Typical k (550nm)
silicon_nitrideSi3N4Philipp 19732.020.0
aluminum_oxideAl2O3Malitson 19621.770.0
tantalum_pentoxideTa2O5Bright 20122.110.0
magnesium_fluorideMgF2Dodge 19841.380.0
zinc_oxideZnOBond 19652.070.0
indium_tin_oxideITOKonig 20141.950.0
silicon_oxynitrideSiONApproximate1.700.0

Polymers

Tabulated optical constants for polymer materials used in microlenses, planarization layers, and photoresists.

NameFormulaSourceTypical n (550nm)Typical k (550nm)
pmmaPMMASultanova 20091.490.0
polycarbonatePCSultanova 20091.580.0
polyimidePIBirkholz 20001.700.0
benzocyclobuteneBCBDow Chemical1.540.0
su8SU-8MicroChem1.590.0

Semiconductors

Tabulated optical constants for semiconductor materials beyond silicon, for NIR and III-V sensor modeling.

NameFormulaSourceTypical n (550nm)Typical k (550nm)
germaniumGeAspnes 19834.040.36
gallium_arsenideGaAsAspnes 19833.980.17
indium_phosphideInPAspnes 19833.700.17

MaterialData

The internal data container for each material:

python
@dataclass
class MaterialData:
    name: str
    mat_type: Literal["constant", "tabulated", "cauchy", "sellmeier"]
    n_const: float = 1.0
    k_const: float = 0.0
    wavelengths: Optional[np.ndarray] = None
    n_data: Optional[np.ndarray] = None
    k_data: Optional[np.ndarray] = None
    interpolation: str = "cubic_spline"
    cauchy_A: float = 1.0
    cauchy_B: float = 0.0
    cauchy_C: float = 0.0
    sellmeier_B: Optional[List[float]] = None
    sellmeier_C: Optional[List[float]] = None

MaterialData.get_nk(wavelength) -> Tuple[float, float]

Returns (n, k) using the appropriate dispersion model.

MaterialData.get_epsilon(wavelength) -> complex

Returns ε=(n+ik)2.

CSV auto-loading

On construction, MaterialDB looks for CSV files in the materials directory using these filename mappings:

Core materials (top-level directory):

Material nameExpected filenames
siliconsilicon_green2008.csv, silicon_palik.csv
tungstentungsten.csv
cf_redcolor_filter_red.csv
cf_greencolor_filter_green.csv
cf_bluecolor_filter_blue.csv

If a CSV file is found, it is loaded automatically. Otherwise, a built-in approximation is used.

Extended materials (categorized subdirectories):

SubdirectoryMaterials
metals/aluminum.csv, gold.csv, silver.csv, copper.csv, titanium.csv, titanium_nitride.csv
dielectrics/silicon_nitride.csv, aluminum_oxide.csv, tantalum_pentoxide.csv, magnesium_fluoride.csv, zinc_oxide.csv, indium_tin_oxide.csv, silicon_oxynitride.csv
polymers/pmma.csv, polycarbonate.csv, polyimide.csv, benzocyclobutene.csv, su8.csv
semiconductors/germanium.csv, gallium_arsenide.csv, indium_phosphide.csv

Extended material CSV files are optional. If a file is missing, the corresponding material is simply not registered (no fallback).