{"id":40754041,"url":"https://github.com/fancompute/legume","last_synced_at":"2026-01-21T16:07:56.091Z","repository":{"id":41341808,"uuid":"191653415","full_name":"fancompute/legume","owner":"fancompute","description":" 🌱 Guided-mode expansion of photonic crystal slabs","archived":false,"fork":false,"pushed_at":"2025-02-03T08:02:08.000Z","size":24017,"stargazers_count":131,"open_issues_count":17,"forks_count":37,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-12-02T15:57:12.609Z","etag":null,"topics":["autograd","eigenmodes","optics","photonics"],"latest_commit_sha":null,"homepage":"https://legume.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fancompute.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-12T22:32:00.000Z","updated_at":"2025-11-06T10:32:03.000Z","dependencies_parsed_at":"2024-11-29T15:42:14.066Z","dependency_job_id":null,"html_url":"https://github.com/fancompute/legume","commit_stats":{"total_commits":381,"total_committers":8,"mean_commits":47.625,"dds":"0.40944881889763785","last_synced_commit":"4729bc9980d11df5d5cfd4eec8be70c6f3ad0c76"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/fancompute/legume","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fancompute%2Flegume","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fancompute%2Flegume/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fancompute%2Flegume/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fancompute%2Flegume/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fancompute","download_url":"https://codeload.github.com/fancompute/legume/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fancompute%2Flegume/sbom","scorecard":{"id":392010,"data":{"date":"2025-08-11","repo":{"name":"github.com/fancompute/legume","commit":"7e90d9f7b56217e22daab193f0d7ce924d21150b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":7,"reason":"Found 5/7 approved changesets -- score normalized to 7","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"16 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2021-856 / GHSA-5545-2q6w-2gh6","Warn: Project is vulnerable to: GHSA-6p56-wp2h-9hxr","Warn: Project is vulnerable to: PYSEC-2021-857 / GHSA-f7c7-j99h-c22f","Warn: Project is vulnerable to: GHSA-fpfv-jqm9-f5jm","Warn: Project is vulnerable to: PYSEC-2023-102","Warn: Project is vulnerable to: PYSEC-2023-114","Warn: Project is vulnerable to: GHSA-29gw-9793-fvw7","Warn: Project is vulnerable to: PYSEC-2015-24 / GHSA-4vwq-x64q-j4cj","Warn: Project is vulnerable to: PYSEC-2017-46 / GHSA-66gw-5xpf-gfp5","Warn: Project is vulnerable to: PYSEC-2015-25 / GHSA-92mr-v722-f48m","Warn: Project is vulnerable to: PYSEC-2022-12 / GHSA-pq7m-3gw7-gq5x","Warn: Project is vulnerable to: PYSEC-2017-47","Warn: Project is vulnerable to: PYSEC-2018-34 / GHSA-2fc2-6r4j-p65h","Warn: Project is vulnerable to: PYSEC-2019-108 / GHSA-9fq2-x9r6-wfmf","Warn: Project is vulnerable to: PYSEC-2018-33 / GHSA-cw6w-4rcx-xphc","Warn: Project is vulnerable to: PYSEC-2017-1 / GHSA-frgw-fgh6-9g52"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 29 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T18:04:25.734Z","repository_id":41341808,"created_at":"2025-08-18T18:04:25.734Z","updated_at":"2025-08-18T18:04:25.734Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28635927,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T15:01:31.228Z","status":"ssl_error","status_checked_at":"2026-01-21T14:42:58.942Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autograd","eigenmodes","optics","photonics"],"created_at":"2026-01-21T16:07:56.031Z","updated_at":"2026-01-21T16:07:56.078Z","avatar_url":"https://github.com/fancompute.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Documentation Status](https://readthedocs.org/projects/legume/badge/?version=latest)](https://legume.readthedocs.io/en/latest/?badge=latest)\n[![Code style: yapf pep8](https://img.shields.io/badge/code%20style-yapf-000000.svg)](https://github.com/google/yapf)\n\n\n\u003cimg src=\"https://github.com/fancompute/legume/blob/master/docs/_static/legume-logo.png\" align=\"middle\" title=\"logo\" alt=\"logo\"\u003e\n\nlegume (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!\n\n## New major release!\nWith 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.\n\n## Install\n\nEasiest way:\n\n```\npip install legume-gme\n```\n\nAlternatively, just `git clone` this repository, and make sure you have all the requirements installed.\n\n## Documentation and examples\n\nGo to our [documentation](https://legume.readthedocs.io/en/latest/index.html) to find a number of [examples](https://legume.readthedocs.io/en/latest/examples.html), as well as a detailed [API reference](https://legume.readthedocs.io/en/latest/api.html).\n\nThe examples can also be found in ipython notebook form in `/docs/examples`.\n\nHere'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](http://ab-initio.mit.edu/book/).\n\n\u003cimg src=\"https://github.com/fancompute/legume/blob/master/img/phc_bands.png\" title=\"photonic_bands\" alt=\"Quasi-TE bands of a photonic crystal slab\"\u003e\n\nWe 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. \n\n## Autograd\n\n\u003cimg src=\"https://github.com/fancompute/legume/blob/master/img/cavity_opt.gif\" title=\"cavity_opt\" alt=\"Optimizing the quality factor of a photonic crystal cavity\"\u003e\n\nOne 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. \n\n## Citing\n\nIf you find legume useful for your research, we would apprecite you citing our [paper](https://pubs.acs.org/doi/10.1021/acsphotonics.0c00327). For your convenience, you can use the following BibTex entry: \n```\n@article{minkov2020inverse,\n  title={Inverse design of photonic crystals through automatic differentiation},\n  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},\n  journal={ACS Photonics},\n  volume={7},\n  number={7},\n  pages={1729--1741},\n  year={2020},\n  publisher={American Chemical Society}\n}\n```\nThe paper describing the symmetry separation and polariton theory has been published in [CPC](https://www.sciencedirect.com/science/article/pii/S0010465524002091?dgcid=rss_sd_all). If you find the new features useful, please cite our paper using the following the BibTex entry:\n```\n@article{Zanotti2024legume,\ntitle = {Legume: A free implementation of the guided-mode expansion method for photonic crystal slabs},\njournal = {Computer Physics Communications},\nvolume = {304},\npages = {109286},\nyear = {2024},\nissn = {0010-4655},\ndoi = {https://doi.org/10.1016/j.cpc.2024.109286},\nurl = {https://www.sciencedirect.com/science/article/pii/S0010465524002091},\nauthor = {Simone Zanotti and Momchil Minkov and Davide Nigro and Dario Gerace and Shanhui Fan and Lucio Claudio Andreani},\n}\n```\n\n## Acknowledgements\n\nApart 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](https://nadinegilmer.com/). The backend switching between `numpy` and `autograd` follows the implementation in the [fdfd](https://github.com/flaport/fdtd) package of Floris Laporte.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffancompute%2Flegume","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffancompute%2Flegume","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffancompute%2Flegume/lists"}