Metadata-Version: 2.4
Name: fdtdx
Version: 0.6.0
Summary: A JAX framework for the finite-difference time-domain (FDTD) method for solving Maxwell's equations with a focus on inverse design of photonic devices.
Project-URL: Repository, https://github.com/ymahlau/fdtdx
Project-URL: Documentation, https://fdtdx.readthedocs.io/en/latest/
Author-email: Yannik Mahlau <mahlau@tnt.uni-hannover.de>, Frederik Schubert <schubert@tnt.uni-hannover.de>
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: equinox>=0.11.10
Requires-Dist: jax>=0.4.36
Requires-Dist: loguru>=0.7.3
Requires-Dist: matplotlib>=3.9.4
Requires-Dist: moviepy>=2.1.1
Requires-Dist: optax>=0.2.4
Requires-Dist: pytreeclass>=0.11
Requires-Dist: rich>=13.9.4
Requires-Dist: seaborn>=0.13.2
Requires-Dist: tidy3d>=2.8.0
Requires-Dist: trimesh>=4.5.3
Requires-Dist: typing-extensions>=4.14.1
Provides-Extra: cuda12
Requires-Dist: jax[cuda12]>=0.4.36; extra == 'cuda12'
Provides-Extra: dev
Requires-Dist: black>=24.10.0; extra == 'dev'
Requires-Dist: ipykernel>=6.29.5; extra == 'dev'
Requires-Dist: myst-nb>=1.3.0; extra == 'dev'
Requires-Dist: nbsphinx>=0.9; extra == 'dev'
Requires-Dist: pre-commit>=4.0.1; extra == 'dev'
Requires-Dist: pydoclint>=0.6.6; extra == 'dev'
Requires-Dist: pymdown-extensions>=10.12; extra == 'dev'
Requires-Dist: pytest-cov>=6.0.0; extra == 'dev'
Requires-Dist: pytest>=8.3.4; extra == 'dev'
Requires-Dist: ruff>=0.8.2; extra == 'dev'
Requires-Dist: sphinx-autobuild>=2025.8.25; extra == 'dev'
Requires-Dist: sphinx-autodoc-typehints>=3.2.0; extra == 'dev'
Requires-Dist: sphinx-book-theme>=1.1.4; extra == 'dev'
Requires-Dist: sphinx-copybutton>=0.5.2; extra == 'dev'
Requires-Dist: sphinx<9.0; extra == 'dev'
Requires-Dist: tox-uv>=1.16.1; extra == 'dev'
Provides-Extra: rocm
Requires-Dist: jax[rocm]>=0.4.36; extra == 'rocm'
Description-Content-Type: text/markdown


<div align="center">
<img src="docs/source/_static/logo.png" alt="logo"></img>
</div>

[![Documentation](https://img.shields.io/badge/docs-latest-blue.svg)](https://fdtdx.readthedocs.io/en/latest/)
[![arXiv](https://img.shields.io/badge/arXiv-2407.10273-b31b1b.svg)](https://arxiv.org/abs/2407.10273)
[![arXiv](https://img.shields.io/badge/arXiv-2412.12360-b31b1b.svg)](https://arxiv.org/abs/2412.12360)
[![codecov](https://codecov.io/gh/ymahlau/fdtdx/branch/main/graph/badge.svg)](https://codecov.io/gh/ymahlau/fdtdx)
[![PyPI version](https://img.shields.io/pypi/v/fdtdx)](https://pypi.org/project/fdtdx/)
[![Continuous integration](https://github.com/ymahlau/fdtdx/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/ymahlau/fdtdx/actions/workflows/main.yml/badge.svg?branch=main)
[![status](https://joss.theoj.org/papers/d0844d2ee5a573165bcc61fb51f575ae/status.svg)](https://joss.theoj.org/papers/d0844d2ee5a573165bcc61fb51f575ae)

# FDTDX: Electromagnetic Simulations in JAX

FDTDX is an efficient open-source Python package for the simulation and design of three-dimensional photonic nanostructures using the Finite-Difference Time-Domain (FDTD) method. Built on JAX, it provides native GPU support and automatic differentiation capabilities, making it ideal for large-scale design tasks.

## Key Features
The key features differentiating FDTDX from other simulation software packages like Meep (which is also great!) are the following:

- **High Performance**: GPU-accelerated FDTD simulations with multi-GPU scaling capabilities
- **Memory Efficient**: Leverages time-reversibility in Maxwell's equations for efficient gradient computation
- **Automatic Differentiation**: Built-in gradient-based optimization for complex 3D structures
- **User-Friendly API**: Intuitive positioning and sizing of objects in absolute or relative coordinates
- **Large-Scale Design**: Capable of handling simulations with billions of grid cells
- **Open Source**: Freely available for research, development and commercial use.

## Documentation

Visit our [documentation](https://fdtdx.readthedocs.io/en/latest/) for:
- Detailed API reference
- Tutorial guides
- Best practices

Also check out our [whitepaper](https://arxiv.org/abs/2412.12360) for some examples and a comparison to other popular FDTD-frameworks.

## Installation

Install FDTDX using pip:

```bash
pip install fdtdx  # Basic CPU-Installation
pip install fdtdx[cuda12]  # GPU-Acceleration (Highly Recommended!)
pip install fdtdx[rocm]   # AMD-GPU (only python<=3.12)
```

For development installation, see the contributing guidelines!

## Multi-GPU

```bash
# The following lines often lead to better memory usage in JAX
# when using multiple GPU.
export XLA_PYTHON_CLIENT_ALLOCATOR="platform"
export XLA_PYTHON_CLIENT_PREALLOCATE="false"
export NCCL_LL128_BUFFSIZE="-2"
export NCCL_LL_BUFFSIZE="-2"
export NCCL_PROTO="SIMPLE,LL,LL128"
```

## Citation
If you find this repository helpful for you work, please consider citing:
```
@article{Mahlau2026,
  doi = {10.21105/joss.08912},
  url = {https://doi.org/10.21105/joss.08912},
  year = {2026},
  publisher = {The Open Journal},
  volume = {11},
  number = {117},
  pages = {8912},
  author = {Mahlau, Yannik and Schubert, Frederik and Berg, Lukas and Rosenhahn, Bodo},
  title = {FDTDX: High-Performance Open-Source FDTD Simulation with Automatic Differentiation},
  journal = {Journal of Open Source Software}
}
```

## Acknowedgement
This project was developed at the [Institute of Information Processing](https://www.tnt.uni-hannover.de/) at Leibniz University Hannover, Germany and sponsored by the cluster of excellence [PhoenixD](https://www.phoenixd.uni-hannover.de/en/) (Photonics, Optics, Engineering, Innovation across Disciplines).
