Lightsmith¶
The open photonics suite — GPU-native, differentiable, and built for AI agents.
Lightsmith lets you describe a photonics problem once, as typed JSON, and solve it with the method that fits. It covers nanoparticles, thin films, metasurfaces, waveguides, photonic crystals, devices and circuits. Every result uses the same units and conventions and records its provenance, so you can cross-check methods directly. Many solvers run on a GPU and can be differentiated, which is what powers inverse design.
import lightsmith as ls
sim = ls.Simulation(
particles=[ls.Particle(shape=ls.Sphere(radius_nm=40), material=ls.LibraryMaterial(name="Au"))],
medium_index=1.33,
wavelengths=ls.WavelengthRange(start_nm=400, stop_nm=800, num=81),
)
res = ls.solve(sim) # auto -> exact Mie for a sphere
cmp = ls.compare(sim, ["mie", "dda", "fdtd"]) # cross-check methods
Pre-alpha
Lightsmith 0.1 is pre-alpha, so the API may still change between minor versions. Each solver page
lists the validation behind it, with numbers taken from the test suite. Read the warnings on every
result before you trust its numbers.
What it solves¶
| Problem kind | Solvers (auto order first) | GPU | Gradients |
|---|---|---|---|
scattering: particles, clusters |
Mie, T-matrix, DDA, FDTD, quasistatic | Mie, DDA, FDTD | Mie (functional API) |
layer_stack: thin films |
TMM, RCWA, FDTD | ✅ | TMM, RCWA |
periodic: gratings, metasurfaces |
RCWA, FDTD (normal incidence) | ✅ | RCWA |
mode: waveguide cross-sections |
FDE | — | — |
device: S-parameters between ports |
EME, FDFD (2D) | FDFD | FDFD (adjoint) |
bands: photonic crystals |
PWE | ✅ | dense path |
circuit: netlists of compact models |
S-matrix circuit solver | ✅ | ✅ |
optimization: inverse design |
Topology optimisation on FDFD | ✅ | — |
Three ways in, all JSON¶
- Python:
import lightsmith as ls, thenls.solve,ls.estimateandls.compare. See the quick start. - Command line:
lightsmith solve spec.json. See the CLI. - AI agents: the
lightsmith-mcpserver. See MCP.
Where to go next¶
- Installation: CPU, GPU and optional extras.
- Conventions: units, time convention, and how cross sections are normalised.
- Solvers: method, options, validation and limits for each solver.
- Contributing: how to write a solver backend or a plugin package.
- Related software: a survey of other open-source solvers.
Licence and citation¶
Lightsmith is MIT-licensed. GPL-licensed solvers live in separate plugin packages (lightsmith-adda,
lightsmith-scattnlay), so the core stays MIT. If you use Lightsmith, please cite it. GitHub's "Cite this
repository" button reads CITATION.cff. Please also cite the solver backends you used: they are listed
in Result.provenance and by lightsmith backends.