GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - tachsin/photonoxide: Light meets Rust. Photonics design and simulation with a live desktop studio, a Rust library and Python bindings: mode solvers, FDFD, FDTD, inverse design, circuits and fabrication flows. Open to everyone.

BranchesTags
Open more actions menu

Latest commit

 

History

701 Commits
701 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
academy
academy
 
 
assets
assets
 
 
circuits
circuits
 
 
crosscode
crosscode
 
 
docker
docker
 
 
docs
docs
 
 
examples
examples
 
 
jobs
jobs
 
 
native
native
 
 
python
python
 
 
site
site
 
 
src
src
 
 
studio
studio
 
 
tests
tests
 
 
.dockerignore
.dockerignore
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
AGENTS.md
AGENTS.md
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
LICENSE-APACHE
LICENSE-APACHE
 
 
LICENSE-MIT
LICENSE-MIT
 
 
README.md
README.md
 
 
ROADMAP.md
ROADMAP.md
 
 
SECURITY.md
SECURITY.md
 
 
clippy.toml
clippy.toml
 
 
justfile
justfile
 
 
release-plz.toml
release-plz.toml
 
 
rust-toolchain.toml
rust-toolchain.toml
 
 

Repository files navigation

photonoxide: light meets Rust

Crates.io PyPI Docs.rs CI MSRV License Validation Examples

Light meets Rust. Photonics design and simulation with a live desktop studio, a Rust library and Python bindings: mode solvers, FDFD, FDTD, inverse design, circuits and fabrication flows. Open to everyone.

The photonoxide studio, scene by scene: an FDTD run of a 1 × 2 MMI, a pulse entering it and leaving by both arms (sped up); a ring resonator's transmission spectrum by 2D FDFD building up point by point (sped up), then the ring lit at resonance in 3D; a directional coupler designed, its gap opened and its coupled length shortened by their sliders as its 3D view follows; a Y-branch's arms spread apart and lengthened the same way; a Mach-Zehnder interferometer wired port to port on the chip and simulated; a thermo-optic phase shifter switched on, the heat spreading from its heater down to the guide on its 2D model's cross-section as the rise the guide feels climbs; an all-pass ring's fabrication flow played in 3D from the bare wafer; the Academy's ring lesson, its input-coupling slider dragged down to critical coupling as the live chart's dip deepens to zero

The studio: a pulse through an MMI by FDTD and a ring's spectrum by 2D FDFD, both live (sped up), then the ring lit at resonance; a coupler and a Y-branch designed with sliders; an MZI wired on the chip and simulated; a heater switched on; the ring's fabrication flow; a lesson's live chart.

photonoxide is software for designing and simulating photonic devices and circuits: a desktop studio that shows every run live, a Rust library and Python bindings, all running the same solvers. It computes materials, waveguide modes, fields and spectra by FDFD and FDTD on the CPU and GPU, components and circuits, and active and nonlinear devices, and it gives the fabrication flow that would make a design. Adjoint gradients and optimization examples work today; inverse design is planned for 0.7. The methods behind the code are written down: the methods pages derive each solver from the papers it implements; the Academy, written lesson by lesson, teaches devices and numerical methods at three depths with charts the library computes; the fabrication flows show step by step how a design would be made, every stated process capability with its source. Each method is checked against an analytic solution or a published result in a validation report that CI keeps current. Every paper and book the project cites is listed once in the references index, with every place that cites it.

It is released milestone by milestone (changelog, roadmap); until 1.0 the API can change between milestones. The methods, examples and report are also at tachsin.gr/projects/photonoxide.

What it holds

  • Methods: 57 write-ups in 10 topics, from waveguide modes to fabrication, each setting out its method, its limits and the papers it implements; their front matter cites 318 distinct sources by DOI.
  • Academy: lessons on devices and numerical methods at three depths, each opening on a drawing of its device, with charts the library computes live; 24 written, and 10 more laid out section by section, read on GitHub or in the studio. New to rings? Start the lesson.
  • Fabrication: the process flow that would make a design, each step with its reason, its alternatives and what its process can achieve, as its source states it; 56 processes on 5 platforms, every flow executed back to its design and shown step by step in the studio. New platforms and exports are in progress.
  • The library, the Python package and the studio: the code that runs a design, with 67 examples that each compute a published result and print it beside the paper's, 45 job files ready to run, and 1003 validation cases that check it.

What it computes

  • Materials: dispersion models with their source, validity range and temperature; a catalogue of Si, SiO₂, SiN, GaAs, AlGaAs, InGaP, InP, AlN, AlGaN, LiNbO₃ and MgO:LiNbO₃, BaTiO₃ and LiTaO₃, and the phase-change Sb₂Se₃, Sb₂S₃ and Ge₂Sb₂Te₅ in both states, and the detector films NbN and MoSi, with χ⁽²⁾ and Pockels tensors, transparency windows, and the Kerr coefficients of Si, SiN, LiNbO₃ and AlN.
  • Geometry for any device: shapes kept exact, from paths with Euler bends to regions defined by expressions; booleans and offsets, arrays and lattices, components drawn with named ports, stacks with partial etches and sidewalls, and 3D bodies and graded media; each solver reads it by points or by each cell's fill.
  • Modes: slabs and multilayers (and their lamellar gratings by RCWA), full-vector cross-sections with PMLs, Hadley's scheme for dielectric corners, bends and dispersion; every mode in a region of the complex effective-index plane by contour integrals.
  • FDFD: 2D and 3D, with mode ports and S-parameters and adjoint gradients; photonoxide's own direct and iterative solvers, on every core (baselines); sweeps sped up by recycling, and farmed to worker processes on one computer or several (farming).
  • FDTD: 2D and 3D with CPMLs, subpixel smoothing, mode sources, monitors, dispersive media and adjoint gradients; a CPU kernel blocked in space and time, and an optional GPU one (wgpu).
  • Circuits: components, netlists, the circuit adjoint, compact models and Touchstone files; optimization with genoxide.
  • Devices: components that know their geometry: the strip and rib waveguides, bend, directional coupler, rings, MMIs, Y-branch and MZIs, each with its models from a closed form to 3D and their errors; computed at a fidelity, swept over one or two parameters and taken through a process's corners, as jobs.
  • Nonlinear optics: phase matching, quasi-phase matching and the acceptance bandwidths; second-harmonic, sum- and difference-frequency generation and photon pairs, from a waveguide's own modes; pulses by the nonlinear Schrödinger equation, four-wave mixing, and Kerr combs by the Lugiato–Lefever equation.
  • Fabrication flows: how a design would be made, each step with its reason, its alternatives and what its process can achieve, with the paper that says so, and how accurately each dimension comes out; shown step by step in the studio.
  • External solvers, optional: oneMKL's PARDISO, MUMPS, SuperLU, Apple Accelerate, NVIDIA cuDSS and Krylov solvers on NVIDIA GPUs, and any BLAS and LAPACK as the dense kernels of photonoxide's own solver, loaded at run time when installed and checked against photonoxide's own, which auto leaves only for one measured faster on the computer that runs it, at the same accuracy (backends, install guides).
  • Jobs and runs: YAML, TOML or JSON job files, checked before they run; every run is recorded and replays exactly.

Getting started · API · Examples · What works in Rust and Python · From any language

The studio

photonoxide opens a window on a folder of jobs, runs and chips: the examples, each run in one click and checked against its paper; each component on its own page, its design in 3D, its models side by side, its runs, sweeps and corners; the Custom device for any other structure; runs played live or replayed (modes, fields, spectra, FDTD as the field propagates); the Academy's lessons with live charts; the materials catalogue, with nonlinear processes and photon-pair sources (a source's joint spectrum, Schmidt modes, brightness and heralding); chips, and photons through them (their statistics, the Hong–Ou–Mandel dip, the loss budget and squeezed light); the validation report; the external solvers installed; and the newest papers of the photonics journals and arXiv, any paper read inside the studio with its abstract, references and citations, and a reading list. The same program runs a job from the command line (photonoxide run job.yaml, --headless for batches). studio/README.md has every page and command.

A directional coupler's page: its gap widened and its coupled length changed with the sliders, the 3D view following each step, then its cross-section, drawn from above with the cut and across the two strips
Components: a directional coupler's gap and length moved, its 3D view following; then its cross-section.
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.
The Academy: the ring resonator's lesson opened on its diagram, the ring and its bus drawn from above with R, w, g and the coupler's r and k, then turned in 3D; then its live chart, the radius and window set on a resonance at 1.55 µm, then the input coupling raised to a wide, shallow dip and lowered to critical coupling, where the through power reaches zero
Academy: the ring resonator's lesson opens on its device, drawn and in 3D; then its transmission follows the coupling as the slider moves, critical coupling at the dip's zero.

Install

Rust:

cargo add photonoxide

Pure Rust, with no C, Fortran or Python dependencies.

Python 3.10 or later, wheels for Linux, macOS and Windows, with uv:

uv add photonoxide          # in a uv project
uv pip install photonoxide  # or into the active environment

pip install photonoxide works too: the guide is docs/python.md, the API reference has every function. Any other language runs the photonoxide program on a job file and reads its results: docs/languages.md.

The studio: the photonoxide program for Linux (x86_64 and ARM64), Windows and macOS is on each release, and updates itself (downloads, channels).

Containers and clusters: the same program without its window is an image on Docker Hub (tachsinachmet/photonoxide) and GitHub's registry, for runs, farm workers and checks wherever Docker runs, and through Apptainer on a cluster: docs/docker.md.

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. In Rust:

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(())
}

In Python:

import photonoxide as phox

si = phox.refractive_index("si", wavelength_um=1.55).real    # Li 1980
ox = phox.refractive_index("sio2", wavelength_um=1.55).real  # Malitson 1965
for polarization in ("te", "tm"):
    for mode in phox.slab_modes(below=ox, core=si, above=ox, thickness_um=0.22,
                                polarization=polarization, wavelength_um=1.55):
        print(f"{polarization.upper()}{mode.order}: n_eff = {mode.effective_index:.4f}")

Both print TE0: n_eff = 2.8475 and TM0: n_eff = 2.0531. Each of the examples computes one paper's numbers, prints them beside the paper's and exits 1 outside its stated tolerance:

photonoxide example strip_waveguide             # the installed program; `photonoxide example --list` lists them
cargo run --release --example strip_waveguide   # from a checkout, or: just example strip_waveguide

Every example prints its setup first: the layers from the top down, the shapes with their positions and sizes, the materials with their models and sources, the grid, the solver and the tolerance.

A design as a job file

A job file holds a whole design, every dimension in it, and runs the same in the studio, on the command line and from Python. docs/design.md walks through Bienstman et al.'s leaky silicon wire and the designs people start from: a strip's modes, a ring's spectrum and a directional coupler.

Building from source

You need:

  • Rust through rustup, 1.95 at least. The repository pins the version CI and its maintainers build with in rust-toolchain.toml: in a checkout, rustup toolchain install fetches it. Each Rust release brings its own LLVM, so another toolchain is also another code generator.
  • just for the commands below. It is optional: each recipe in the justfile is one plain command.
  • For the studio: Node.js and pnpm, and on Linux WebKitGTK and Tauri's other prerequisites (studio/README.md).
  • For the Python package: uv.
git clone https://github.com/tachsin/photonoxide
cd photonoxide
just build         # the library, in release mode
just test          # the unit tests
just studio        # the program as released, target/dist/photonoxide
just python-test   # the Python package in python/.venv, and its tests
just               # every recipe

The optimized build profiles (release, dist and fastest) are described in CONTRIBUTING.md.

Validation

Nothing is merged without an analytic test and a convergence test; adjoint gradients are checked against finite differences. A published result is reproduced as well where its paper states the whole problem, and where it doesn't the two numbers are printed side by side (docs/comparisons.md has every such difference and what would settle it). The report has 1003 cases: 697 against closed forms, 293 against published results and 13 against a second method of photonoxide's own on a shared problem. Each states its source, tolerance and grid; a published case is a number a paper prints or a formula re-implemented from its equations, and a few are bounds, not equalities. The comparisons with other codes (Elmer for the static solver, openEMS for the RF line) are in docs/cross-code.md and run locally. CI fails when a case fails or the committed report isn't the one the code writes. CI checks every example's output too.

Status

Milestone Scope Status
0.1 – 0.3 Units and materials, mode solvers, FDFD in 2D and 3D, the studio ✅ released
0.4 – 0.4.3 Components and circuits, compact models, a 3D preconditioner, multifrontal direct solves ✅ released
0.5 FDTD 2D and 3D, CPML, smoothing, sources, monitors, adjoints, a GPU kernel; solver backends loaded at run time ✅ released
0.5.1 Channels and backends Nightly built from main, MUMPS, SuperLU and Accelerate, the backend chosen from benchmarks, every mode in a region ✅ released
0.5.2 Many solves at once Ports as a block, recycling across sweeps, more contour-integral mode solvers, farming across processes ✅ released
0.5.3 QMR without the matrix QMR without its matrix where the matrix wouldn't fit, MUMPS 5.9 ✅ released
0.5.4 Geometry and devices Geometry for any device; the device library on pages of its own, with its models, runs, sweeps, corners and optimization; compact models; the chip built from devices; devices in Python ✅ released
0.6.0 Thermal and electro-optic, and writing jobs Heat, thermo-optic and Pockels devices, travelling-wave electrodes, phase-change materials, the job editor ✅ released
0.6.1 Nonlinear integrated optics Phase matching and QPM, photon pairs, the NLSE, four-wave mixing and Kerr combs, fabrication flows; open gaps in #595 ✅ released
0.6.2 Eigenmode expansion and the mode solver's tools 2D eigenmode expansion, convergence to a tolerance, adaptive sweeps, effective area and confinement, sidewall-roughness loss; 3D expansion, bends, periodic sections, drawn shapes and Gaussian beams followed in 0.6.3 ✅ released
0.6.3 Quantum light Linear-optical statistics, photon-pair sources, Gaussian states and broadband squeezing, loss budgets of quantum circuits, the quantum view in the studio; 3D eigenmode expansion with bends, periodic sections, drawn shapes and beams; a 1D RCWA ✅ released
0.7 Inverse design Topology and shape optimization with fabrication constraints 🚧 next
0.7.1 – 0.16 Distributed memory, carrier modulators, layout, RCWA in full (a 1D RCWA is in 0.6.3) and beam propagation, a device library, photonic crystals, plasmonics, nonlinear FDTD planned
1.0 A stable API planned

ROADMAP.md has the details, with what each item measured.

Principles

  • Validated: each method is checked against closed forms or published results, and a result names the grid it came from.
  • Cited: every methods page and every written lesson names the papers it rests on, and every stated process capability its source, by DOI where the source has one.
  • Pure Rust: libraries you install yourself are optional backends, loaded at run time and never required (the plan).
  • Reproducible: a rerun gives the same bits and every run replays; across thread counts the parallel kernels match bit for bit and the dense ones to round-off (n_eff to about 3e-15).
  • Visible: the studio and the command line run the same job.

Contributing

Contributions other than code are as welcome as code: a methods page improved, a section of an Academy lesson written, a paper suggested, a correction, a validation case. CONTRIBUTING.md says how to make each, and what a pull request needs. Questions and ideas go to Discussions; reports and proposals go to the issue forms. Everyone taking part follows the code of conduct.

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

Light meets Rust. Photonics design and simulation with a live desktop studio, a Rust library and Python bindings: mode solvers, FDFD, FDTD, inverse design, circuits and fabrication flows. Open to everyone.

tachsin.gr/projects/photonoxide

Topics

eigenmode-solverelectromagneticsfdfdfdtdintegrated-photonicsmode-solveropticsphotonic-designphotonicspythonrustsilicon-photonicssimulationwaveguide

Resources

Readme

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity

Stars

11 stars

Watchers

0 watching

Forks

5 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.