gitwtfhub

wtf is fmmax?

facebookresearch/fmmax — explained in plain English

Analysis updated 2026-07-05 · repo last pushed 2026-02-10

147Jupyter NotebookAudience · researcherComplexity · 4/5MaintainedLicenseSetup · moderate

TL;DR

FMMAX is a Python library that simulates how light interacts with nanostructured layered materials like photonic crystals and metasurfaces, using JAX for GPU acceleration and automatic gradient computation for design optimization.

Mindmap

mindmap
  root((repo))
    What it does
      Simulates light in materials
      Uses Fourier modal method
      Computes scattering matrices
    Tech stack
      Python
      JAX
      GPU acceleration
    Use cases
      Inverse design
      Nanostructured optics
      Micro-LED simulation
    Audience
      Optics researchers
      Photonics engineers
    License
      MIT license

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Simulate light scattering and absorption in nanostructured optical devices like metasurfaces.

REASON 2

Optimize photonic crystal designs using automatic gradient computation for inverse design.

REASON 3

Model localized light emission inside periodic structures using Brillouin zone integration.

REASON 4

Simulate anisotropic and magnetic optical materials for advanced device modeling.

What's in the stack?

PythonJAXJupyter Notebook

How it stacks up

facebookresearch/fmmaxalexeygrigorev/build-your-own-search-enginekrishnaik06/complete-machine-learning-2023
Stars147156119
LanguageJupyter NotebookJupyter NotebookJupyter Notebook
Last pushed2026-02-102025-12-152023-09-16
MaintenanceMaintainedQuietDormant
Setup difficultymoderateeasyeasy
Complexity4/52/51/5
Audienceresearcherdevelopergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · moderate Time to first run · 30min

Installable via pip, but requires familiarity with photonics concepts and JAX, GPU recommended for performance but not strictly required.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

Wtf does this do

FMMAX is a tool from Facebook Research that simulates how light behaves when it passes through structured, layered materials, like photonic crystals, metasurfaces, or the tiny patterns found on advanced LEDs. If you are designing a nanostructured optical device and need to predict how it will scatter, transmit, or absorb light, this library computes those electromagnetic fields for you. Under the hood, it implements a technique called the Fourier modal method (FMM), which is a standard approach in computational photonics. The method works by breaking a periodic structure into flat layers, representing the light's field within each layer as a sum of Fourier components, and then stitching the layers together using a scattering matrix. This makes it relatively efficient for certain geometries compared to fully numerical solvers. The implementation is built on JAX, which means it can run on GPUs for speed and can automatically compute gradients, useful if you want to optimize a design rather than just analyze one. The project stands out for a few capabilities beyond the basics. It supports Brillouin zone integration, which lets you model localized light sources (like a single emitter or a focused beam) inside a periodic structure, rather than only uniform plane waves. It also includes advanced "vector FMM" formulations that improve simulation accuracy for tricky geometries, and it handles anisotropic and magnetic materials, broadening the range of devices you can model. The likely users are optics researchers and engineers working on things like metasurface-enhanced micro-LEDs, photonic crystal slabs, or other nanostructured optical components. The automatic differentiation support makes it particularly suited for inverse design, where you specify desired optical behavior and let an optimizer search for the structure that produces it. The project is installable via pip and released under the MIT license.

Yoink these prompts

Prompt 1
Using the FMMAX library, write a JAX-based script that simulates a 2D photonic crystal slab and returns the transmission and reflection spectra for a range of incident angles.
Prompt 2
Using FMMAX with JAX autodiff, set up an inverse design loop that optimizes a metasurface unit cell geometry to maximize transmission at a target wavelength.
Prompt 3
Using FMMAX, simulate a localized dipole emitter inside a periodic photonic crystal structure using Brillouin zone integration and plot the far-field radiation pattern.
Prompt 4
Using FMMAX, model an anisotropic layered optical device and compute the electromagnetic fields and scattering matrix for each layer.

Frequently asked questions

wtf is fmmax?

FMMAX is a Python library that simulates how light interacts with nanostructured layered materials like photonic crystals and metasurfaces, using JAX for GPU acceleration and automatic gradient computation for design optimization.

What language is fmmax written in?

Mainly Jupyter Notebook. The stack also includes Python, JAX, Jupyter Notebook.

Is fmmax actively maintained?

Maintained — commit in last 6 months (last push 2026-02-10).

What license does fmmax use?

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

How hard is fmmax to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is fmmax for?

Mainly researcher.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.