Skip to main content

Documentation Status Code style: yapf pep8

logo

legume (le GUided Mode Expansion) is a python implementation of the GME method for photonic crystal slabs, including multi-layer structures. Plane-wave expansion for purely 2D structures is also included. Also, we have an autograd backend that allows gradients of all output values with respect to all input parameters to be computed efficiently!

New major release!

With the update to version 1.0.0, we introduced new exciting features including symmetry spearation of photonic modes with respect to a vertical (kz) plane of symmetry, and photon-exciton interaction. These features are fully documented and explained in a new set of examples.

Install

Easiest way:

pip install legume-gme

Alternatively, just git clone this repository, and make sure you have all the requirements installed.

Documentation and examples

Go to our documentation to find a number of examples, as well as a detailed API reference.

The examples can also be found in ipython notebook form in /docs/examples.

Here's an example of a computation of the photonic bands of a photonic crystal, compared to Fig. 2(b) in Chapter 8 of the photonic crystal bible, Molding the Flow of Light.

Quasi-TE bands of a photonic crystal slab

We have only computed the quasi-TE modes of the slab (positive symmetry w.r.t. the plane bisecting the slab), which should be compared to the red lines in the figure on the right. The agreement is very good! And, the guided-mode expansion allows us to also compute the quasi-guided modes above light-line, together with their associated quality factor. These modes are typically hard to filter out in first-principle simulations, so legume is great for studying those.

Autograd

Optimizing the quality factor of a photonic crystal cavity

One exciting feature of legume is the autograd backend that can be used to automatically compute the gradient of the eigenmodes and eigenfrequencies with respect to any input parameters! In the optimization shown above, we tune the positions of the holes of a cavity in order to increase the quality factor. As is common in photonic crystal resonators, small modifications lead to tremendous improvement. The gradient of the quality factor with respect to the positions of all holes is computed in parallel using reverse-modeautomatic differentiation.

Citing

If you find legume useful for your research, we would apprecite you citing our paper. For your convenience, you can use the following BibTex entry:

@article{minkov2020inverse,
  title={Inverse design of photonic crystals through automatic differentiation},
  author={Minkov, Momchil and Williamson, Ian AD and Andreani, Lucio C and Gerace, Dario and Lou, Beicheng and Song, Alex Y and Hughes, Tyler W and Fan, Shanhui},
  journal={ACS Photonics},
  volume={7},
  number={7},
  pages={1729--1741},
  year={2020},
  publisher={American Chemical Society}
}

The paper describing the symmetry separation and polariton theory has been published in CPC. If you find the new features useful, please cite our paper using the following the BibTex entry:

@article{Zanotti2024legume,
title = {Legume: A free implementation of the guided-mode expansion method for photonic crystal slabs},
journal = {Computer Physics Communications},
volume = {304},
pages = {109286},
year = {2024},
issn = {0010-4655},
doi = {https://doi.org/10.1016/j.cpc.2024.109286},
url = {https://www.sciencedirect.com/science/article/pii/S0010465524002091},
author = {Simone Zanotti and Momchil Minkov and Davide Nigro and Dario Gerace and Shanhui Fan and Lucio Claudio Andreani},
}

Acknowledgements

Apart from all the contributors to this repository, all the authors of the paper cited above contributed in various ways with the development of this package. Our logo was made by Nadine Gilmer. The backend switching between numpy and autograd follows the implementation in the fdfd package of Floris Laporte.

Release files for legume-gme 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for legume-gme 1.0.3
File Size Uploaded
legume_gme-1.0.3.tar.gz 79.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for legume-gme 1.0.3
File Interpreter ABI Platform
legume_gme-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 161.8 kB

Release files / legume_gme-1.0.3.tar.gz

Download URL legume_gme-1.0.3.tar.gz
Size 79.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2301143b33df4fb3930ce2b887529af08d3d003a09c7644652f09e63c23247a3
BLAKE2b-256 checksum
How to use checksums
681b5661dd1fac36bc041b200e2b0c77e656fdb9489238e5e8e17f3d6a9a58c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / legume_gme-1.0.3-py3-none-any.whl

Download URL legume_gme-1.0.3-py3-none-any.whl
Size 81.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
387ff3e7d6ae75dd17450aeb3b093893cfa37356717ae1054967d7b4a5b2643b
BLAKE2b-256 checksum
How to use checksums
912be80a78cd800ee45466c643733a5c319e3943c3b5f39400ffa0460157597b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.1.10

1 release file

0.1.9

2 release files

0.1.8

1 release file

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page