Lightsmith
The open photonics suite — GPU-native, differentiable, and built for AI agents.
Describe a photonics problem once, as typed JSON, and solve it with the method that fits: from nanoparticles and thin films to metasurfaces, waveguides, photonic crystals, devices and circuits. Every result comes back in the same units and conventions, with provenance, so methods can be cross-checked directly. Many solvers run on GPU and can be differentiated, which is what powers inverse design.
Documentation: https://lightsmith-photonics.github.io/lightsmith/
Status: pre-alpha (v0.1). Validation numbers for every solver are in
tests/and in the technical report (lightsmith-paperrepository).
Install
uv add lightsmith # CPU
uv add "lightsmith[gpu]" # + PyTorch for GPU solvers
uv add "lightsmith[mcp]" # + MCP server for AI agents
uv add "lightsmith[tmatrix]" # + treams T-matrix backend
uv add "lightsmith[layout]" # + gdsfactory import (Python >= 3.11)
From a clone (pulls CUDA 12.8 PyTorch wheels on Windows/Linux):
uv sync --extra gpu --extra mcp
uv run lightsmith doctor
Quick start
import lightsmith as ls
sim = ls.Simulation(
particles=[ls.Particle(shape=ls.Sphere(radius_nm=40),
material=ls.LibraryMaterial(name="Au"))], # Johnson & Christy
medium_index=1.33,
wavelengths=ls.WavelengthRange(start_nm=400, stop_nm=800, num=81),
)
ls.estimate(sim, method="fdtd", device="gpu") # grid, steps, memory; never solves
res = ls.solve(sim) # auto -> exact Mie for a sphere
cmp = ls.compare(sim, ["mie", "dda", "fdtd"]) # cross-check methods
The same from the shell, JSON in and out:
uv run lightsmith solve examples/drude_sphere.json --method dda --device gpu
Problems and solvers
| Problem kind | Solvers (auto order first) | GPU | Gradients |
|---|---|---|---|
scattering — particles, clusters |
Mie (native, miepython), T-matrix (treams), DDA, FDTD, quasistatic | ✅ | Mie |
layer_stack — thin films |
TMM, RCWA, FDTD | ✅ | TMM, RCWA |
periodic — gratings, metasurfaces |
RCWA, FDTD (normal incidence) | ✅ | RCWA |
mode — waveguide cross-sections |
FDE (full vector, bends) | — | — |
device — S-parameters between ports |
EME, FDFD (2D) | FDFD | FDFD |
bands — photonic crystals |
PWE (2D TE/TM, 3D) | ✅ | dense path |
circuit — netlists of compact models |
S-matrix circuit solver | ✅ | ✅ |
optimization — inverse design |
topology optimisation on FDFD | ✅ | — |
lightsmith backends lists what is installed. Materials: bundled CC0 datasets (Au, Ag, Al, Cu, Si, SiO2, TiO2, water) from the refractiveindex.info database, online fetch of any entry, and passive Drude–Lorentz fitting for time-domain solvers.
GPL-licensed solvers live in separate plugin packages discovered through the lightsmith.backends entry point (lightsmith-adda, lightsmith-scattnlay), keeping this core MIT.
Conventions
- Lengths in nm; wavelengths are vacuum wavelengths.
- Time dependence
exp(-iωt): absorbing materials haveIm(ε) > 0. - Scattering cross sections in nm²; efficiencies use the volume-equivalent radius,
Q = C / (π r_eq²).
For AI agents
lightsmith schemaprints the JSON Schema of every problem kind.- Every CLI command prints JSON; failures print
{"error", "message"}to stderr with exit code 1. lightsmith-mcpservesget_schema,list_backends,check_environment,estimate,solveandcompare.- See AGENTS.md and llms.txt.
Licence
MIT. Backends keep their own licences; cite the ones you use (Result.provenance, lightsmith backends).
Related repositories
Lightsmith is split across sibling repositories:
| Repository | Contents |
|---|---|
lightsmith (this one) |
Core library, solvers, benchmarks |
lightsmith-adda, lightsmith-scattnlay |
GPL solver plugins (separate licence) |
lightsmith-paper |
arXiv technical report |
lightsmith-studio, lightsmith-community, lightsmith-cloud, lightsmith-materials, lightsmith-deploy |
GUI, web platform, compute service, materials database, full-stack deployment |
Metadata
Release files for lightsmith 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lightsmith-0.1.0.tar.gz | 395.6 kB | Without provenance | Details for lightsmith-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lightsmith-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for lightsmith-0.1.0-py3-none-any.whl |
Total release size: 728.0 kB
Release files / lightsmith-0.1.0.tar.gz
| Download URL | lightsmith-0.1.0.tar.gz |
|---|---|
| Size | 395.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a715e459010352a73ae6f99f5e0e4cdb4e4222c268ea4ab54824d4e9215569e4
|
|
BLAKE2b-256 checksum How to use checksums |
656972531b67224913820e4b0d588f4702bce8ab343c9e6978dbb95e8d74b742
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.19
|
Release files / lightsmith-0.1.0-py3-none-any.whl
| Download URL | lightsmith-0.1.0-py3-none-any.whl |
|---|---|
| Size | 332.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f4b892cfd2c34e3dddd2a4c2b85cc8eebf2b60a8429fdfce0684f4334dc49be5
|
|
BLAKE2b-256 checksum How to use checksums |
a2860d1fbf33cc9bd3515e4361f4bd7c8087818a249e75a7a716eb68a243fbee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.19
|
Security for lightsmith 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.