Skip to content

katmer is a powerful library for optimizing the design of optical thin films using automatic differentiation via JAX and Equinox, enabling efficient and accurate inverse design solutions.

License

Notifications You must be signed in to change notification settings

bahremsd/katmer

Repository files navigation

katmer: inverse design of optical thin films & material fitting with jax and equinox

Table of Contents
  1. Introduction
  2. Documentation
  3. Usage
  4. Database
  5. Benchmarks
  6. Installation
  7. License
  8. Credits
  9. Contact and Support

Introduction

katmer is a high-performance, research-grade python library purpose-built for the inverse design of optical multilayer thin films. Bridging classical optics with modern computational tools, katmer offers a comprehensive suite of features tailored for photonic engineers, researchers, and designers aiming to optimize thin-film structures with precision, speed, and flexibility.

In traditional multilayer thin-film design, achieving desired optical responses—such as reflectance, transmittance, or absorbance—often requires a trial-and-error approach or time-consuming simulations. katmer redefines this workflow by integrating gradient-based optimization into the design loop. This allows users to arrive at precise, physically valid solutions in a fraction of the time, enabling faster iteration and deeper insights.

At its core, katmer is powered by two cutting-edge libraries:

  • tmmax: A transfer matrix method (TMM) engine implemented with JAX, enabling just-in-time (JIT) compilation, vectorized operations, and XLA (Accelerated Linear Algebra). This dramatically speeds up the evaluation of optical properties across complex multilayer systems.

  • equinox: A lightweight yet powerful neural network library designed to work seamlessly with JAX. Its pytree-based architecture enables flexible model building and efficient parameter management, critical for embedding neural architectures into the optimization process.

Core Capabilities

Optimum Number of Layers Prediction

One of katmer’s key features is the intelligent determination of the optimal number of layers required to achieve a user-defined target response. This is achieved using a pre-trained equinox model, which maps spectral objectives (across wavelength and incidence angles) to an ideal layer count—preventing over-engineering while minimizing fabrication complexity and cost. This forms a robust foundation for downstream optimization.

Thickness Sensitivity-Aware Inverse Design

Once the layer number is established, katmer performs gradient-based inverse design to determine the optimal thickness of each layer. Crucially, this process incorporates deposition uncertainties, modeling real-world experimental errors by simulating the effect of layer thickness deviations. This leads to designs that are not only optimal in simulation but also robust in practice.

Inverse Design with Material Constraints

Real-world thin-film fabrication is governed by material compatibility constraints—not all materials can be deposited on each other. katmer addresses this by constructing a material compatibility graph, currently available for materials supported in tmmax. During inverse design, this graph is used to ensure only physically realizable material stacks are considered. Furthermore, each material comes with its own deposition thickness bounds, which katmer rigorously respects during optimization.

Tickness-only Optimization

If you already have a fixed material distribution and only wish to optimize the layer thicknesses, katmer accommodates this effortlessly. With gradient-based methods, the solver converges rapidly, delivering optimal thickness distributions within the specified physical constraints.

Optical Property Reconstruction from Experimental Data

katmer also enables optical property reconstruction: if your multilayer system contains a material with unknown refractive index (n) or extinction coefficient (k), and you possess experimental spectral data, katmer can infer the n and k values through inverse modeling. This feature is particularly useful for characterizing novel or proprietary materials used in your thin-film designs.

Documentation

The complete documentation for katmer is available in the Example Gallery within the docs directory. This repository provides an extensive set of examples demonstrating the key functionalities of katmer, enabling users to efficiently analyze and manipulate multilayer thin-film stacks.

Usage

Database

Benchmarks

Installation

You can install katmer via PyPI:

pip3 install katmer

License

This project is licensed under the MIT License, which permits free use, modification, and distribution of the software, provided that the original copyright notice and license terms are included in all copies or substantial portions of the software. For a detailed explanation of the terms and conditions, please refer to the LICENSE file.

Credits

Also if you find the katmer library beneficial in your work, we kindly ask that you consider citing us.

@software{katmer,
  author = {Bahrem Serhat Danis, Esra Zayim},
  title = {katmer: inverse design of optical thin films and material fitting with jax and equinox},
  version = {1.0.0},
  url = {https://github.com/bahremsd/katmer},
  year = {2025}
}

Contact and Support

For any questions, suggestions, or issues you encounter, feel free to open an issue on the GitHub repository. This not only ensures that your concern is shared with the community but also allows for collaborative problem-solving and creates a helpful reference for similar challenges in the future. If you would like to collaborate or contribute to the code, you can contact me via email.

Bahrem Serhat Danis - bdanis23@ku.edu.tr

About

katmer is a powerful library for optimizing the design of optical thin films using automatic differentiation via JAX and Equinox, enabling efficient and accurate inverse design solutions.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages