Skip to content

Repository files navigation

photonoxide: validated, fabrication-ready photonics for Rust

Crates.io Docs.rs CI MSRV License Validation Examples

Photonics for Rust: validated, fabrication-ready, and visible while it runs.

The photonoxide studio: a silicon strip's first mode travelling along it in 3D as the camera orbits; a ring resonator's transmission spectrum building up point by point, then the ring lit at resonance in 3D; a Mach-Zehnder interferometer wired on the chip and its spectrum appearing

The studio: a strip's mode travelling in 3D; a ring's spectrum by 2D FDFD building up live (sped up) and the ring lit at resonance; an MZI wired on the chip and simulated.

photonoxide is a photonics library for Rust and a program to use it with. The library computes waveguide modes, fields and S-parameters by frequency-domain finite differences, and connects components into circuits that it simulates, differentiates and optimizes. Every method is checked against an analytic solution or a published result, and the checks are collected in a validation report that CI keeps current. The program, photonoxide, is a studio: a desktop window where you build jobs and chips, watch them run in 3D and 2D, and read the report. The plan goes on to FDTD, thermal and electro-optic modulators, inverse design, layout and tape-out; see the roadmap.

Alpha. The latest release is 0.3.3: materials, mode solvers and FDFD, and the studio. The 0.4 milestone, components and circuits, is on the main branch and nearly complete; it isn't on crates.io yet. The API will change between milestones.

The project's pages are at tachsin.gr/projects/photonoxide: the methods, the examples with their output, the validation report and the roadmap.

What you can do today

In the 0.3.3 release:

On the main branch, for the next release:

  • Circuits: components with ports, parameters, a fidelity and their error against their source; netlists solved as one sparse system, checked against Filipsson's sub-network growth; nested circuits; the circuit adjoint, every parameter's gradient from one transposed solve; optimization by genoxide's L-BFGS-B, Adam and CMA-ES (in the examples).
  • The first components: waveguide and bend from the mode solvers, phase shifter, directional coupler, 1 × 2 and 2 × 2 MMIs, Y-branch, all-pass and add-drop rings, MZI, and a 2D FDFD job's sampled S-matrix.
  • Compact models and Touchstone: vector fitting with its fit error, stability and passivity; models over parameters, polynomial or piecewise linear with an exact test of uniform stability; Touchstone 1.1 and 2.0 files read and written, as the measured fidelity.
  • 3D FDFD ports: the grid's own full-vector port modes, one-way sources and a reciprocal S-matrix.
  • More materials: AlN's index (Rigler 2015), AlGaN films (Rigler 2013), and InGaP beyond Tanaka's range (Ferrini 2002).

Getting started goes from cargo add to a strip waveguide's modes. The API is on docs.rs.

The studio

photonoxide with no arguments opens the studio, a window on a workspace folder of jobs, runs and chips:

  • Examples: the simulations of jobs/ and the published results of examples/ built in, each run in one click and checked against its paper as it prints.
  • Job builder: a form for each kind of job, the device previewed in 3D as you type, the TOML beside it, and the library checking the job as it changes.
  • Runs, Viewer and Compare: runs played live or replayed; in 3D, the layers as solids and the selected mode travelling along its guide as a volume; in 2D, fields, modes, S-parameters and spectra, with a slider through a sweep's points; several runs' sweeps and spectra on shared axes.
  • Materials: the catalogue, each model plotted over its range with its equation, its coefficients and tensors, and its papers.
  • Validation: the release's report, with its math rendered, and the same report run on your machine.
  • Settings: every daisyUI theme, the workspace folder, tips and updates.
  • On the main branch: Components, the component library with each kind's S-parameters recomputed as its parameters move and Touchstone import and export, and Chip, where components are placed, wired port to port, checked and simulated.
The job builder: the ring-fdfd job's ring radius and position changed in the form, the 3D preview following each step
Job builder: the ring's radius and place edited in the form; the 3D preview follows.
The Materials page: lithium niobate's ordinary and extraordinary indices read off the plot, then AlGaAs's index as its aluminium fraction slider moves
Materials: LiNbO₃'s no and ne read off the plot; AlGaAs as its aluminium fraction moves.
The Validation page: two cases looked up and opened, showing what each computes and what it is checked against, with the math rendered
Validation: cases looked up and opened, each against its exact solution or paper.
Settings: daisyUI themes picked one after another, then the 3D viewer in the chosen theme and in photonoxide's own light and dark
Themes: any daisyUI theme, or photonoxide's light and dark; the 3D view follows.

The same program runs a job (photonoxide run job.toml, live in the window or --headless), replays a run (photonoxide view runs/<run>), runs a built-in example and checks the report. studio/README.md describes every page and command, and how to build it.

Install

The library:

cargo add photonoxide

It is pure Rust, with no C, Fortran or Python dependencies, so cargo build is all it needs. For the work on the main branch: photonoxide = { git = "https://github.com/tachsin/photonoxide" }.

The program: each release has it for Linux x86_64 and ARM64 (.AppImage, .deb, .rpm, .tar.gz), Windows x86_64 (an installer that needs no administrator rights, and a portable .zip) and macOS (one universal .dmg for Apple Silicon and Intel). An installed copy looks for a new release when it opens and every hour, and updates itself with one click after checking the release's signature. The downloads table has the details for each platform, clusters included.

A first example

220 nm of silicon in oxide at 1550 nm, each material with its published dispersion, and the slab's modes solved exactly:

use photonoxide::material::{silica, silicon};
use photonoxide::mode::Polarization;
use photonoxide::mode::slab::Slab;
use photonoxide::units::{Length, Wavelength};

fn main() -> photonoxide::Result<()> {
    let wavelength = Wavelength::um(1.55)?;
    let si = silicon().refractive_index(wavelength)?.re; // Li 1980
    let oxide = silica().refractive_index(wavelength)?.re; // Malitson 1965
    let slab = Slab::new(oxide, si, oxide, Length::nm(220.0))?;
    for (name, polarization) in [("TE", Polarization::Te), ("TM", Polarization::Tm)] {
        for mode in slab.modes(polarization, wavelength) {
            println!("{name}{}: n_eff = {:.4}", mode.order(), mode.effective_index());
        }
    }
    Ok(())
}

It prints TE0: n_eff = 2.8475 and TM0: n_eff = 2.0531. The examples go further, each reproducing one published result and failing when it disagrees with the paper:

cargo run --release --example strip_waveguide

Validation

Nothing is merged without an analytic test, a reproduction of a published result and a convergence test; adjoint gradients are checked against finite differences. The validation report has 143 cases, all passing:

  • 70 analytic: closed forms and exact properties, such as the exact slab, Fresnel reflection, reciprocity, energy conservation, a ring's free spectral range, and the adjoints against finite differences.
  • 72 published: results reproduced from papers and books, such as Li's and Malitson's tables, Hadley's corner problems, the leaky photonic-wire benchmark, Bogaerts's rings and Gustavsen and Semlyen's vector-fitting test. Six of them are measurements: the effective and group indices of three silicon wires from Dwivedi et al.'s Mach-Zehnder interferometers (2015), predicted from the wires' measured cross-sections and within the paper's own fabrication estimate.
  • 1 cross-code: the 3D FDFD port mode against the mode solver. Comparisons with Meep, MPB, S4 and Ceviche come with the later milestones.

Each case states its source, tolerance and grid. The report is written by photonoxide validate; CI fails when a case fails or when the committed report differs from the one the code writes. The 19 examples each reproduce one paper's numbers, and CI checks their output too.

Status

Milestone Scope Status
0.1 Foundations Units, materials with provenance, geometry, run records, the studio's first window, the validation harness ✅ released
0.2 Mode solvers Slab, multilayer, full-vector 2D finite differences, EIM, bends, dispersion ✅ released
0.3 FDFD 2D and 3D, mode ports, S-parameters, adjoints, an iterative 3D solver; Hadley's high-accuracy mode solver ✅ released
0.3.1 – 0.3.3 The studio and materials The studio as a workspace (examples inside, the job builder, run comparison, updates by one click); rings and 3D previews; the travelling mode in 3D, sweeps in the viewer, the report's math, every theme; the materials catalogue ✅ released
0.4 Components and circuits Components at several fidelities, netlists, the circuit adjoint, optimization through genoxide, compact models, Touchstone, 3D FDFD ports; the studio's component library and chip view 🚧 on main; a preconditioner for high-contrast 3D FDFD is the last item
0.5 FDTD 2D and 3D Yee, CPML, subpixel smoothing, dispersive media, GPU planned
0.6 Thermal and electro-optic Heat and electrostatics, thermo-optic phase shifters, Pockels modulators (thin-film lithium niobate first), travelling-wave electrodes planned
0.7 Inverse design Adjoint topology and shape optimization, fabrication constraints, the 2D-to-3D pipeline, device and circuit co-design planned
0.8 Carrier modulators and signals Drift-diffusion, plasma-dispersion modulators, time-domain circuits and eye diagrams, programmable meshes planned
0.9 Layout and PDK GDSII and OASIS, parametric cells, routing, DRC, SiEPIC EBeam and Cornerstone planned
0.10 Tape-out Submission packages, test structures, sign-off, openEBL and Cornerstone runs, measurements back planned
0.11 Fabrication realism Process variation, lithography proxies, corners, yield, circuit variability planned
0.12 Semi-analytic RCWA, eigenmode expansion, BPM planned
0.13 Device library Validated devices, each a component at several fidelities planned
0.14 – 0.16 Photonic crystals, metasurfaces, plasmonics, nonlinear and fiber optics, Kerr microcombs, quantum planned
1.0 Stable API and the published validation report planned

The details, with what each item measured, are in ROADMAP.md; what each release changed is in CHANGELOG.md.

Why photonoxide?

Open-source photonics has excellent individual tools, each in its own corner:

  • Meep for FDTD, MPB for band structures and S4 for RCWA;
  • Ceviche and SPINS for inverse design;
  • KLayout for layout.

Rust has oxiphoton, which is broad but has no GUI, and its README shows no comparison with published results. photonoxide aims to be one coherent toolkit with three things none of them combine:

  • Validated: every solver checked against analytic solutions, published devices and established codes, with the results in a public report. Every reported number carries its convergence.
  • Fabricable: foundry design rules inside the optimization, and a tape-out package ready for a multi-project wafer run: GDSII or OASIS on the foundry's layers, DRC and connectivity checked, test structures included, and performance reported across process variation. The first target is SiEPIC openEBL, where photonoxide designs will be fabricated and measured.
  • Visible: a studio that shows modes, fields, spectra and, later, layouts and optimizations as they run. The command line and the studio run the same job, and every run replays.

And underneath:

  • Pure Rust: no C, Fortran or Python dependencies, from the linear algebra to the GDS writer. There are no Python bindings.
  • Fast: parallel on the CPU, with a GPU backend planned for FDTD.
  • Reproducible: the same input gives the same result on any number of threads.
  • Inverse design built in: adjoint gradients for every solver, and the optimizers from genoxide, our optimization library, which grows the general methods photonoxide needs.

Contributing

photonoxide is pre-1.0, which is the best time to shape it. Ideas, use cases and validation cases you'd like to see are as welcome as code: open an issue. CONTRIBUTING.md says what a pull request needs.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in photonoxide by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Photonics for Rust: validated, fabrication-ready, and visible while it runs. Mode solvers, FDFD, FDTD, inverse design, layout and PDKs, with a live studio.

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages