nidn

Neural Inverse Design of Nanostructures

https://github.com/esa/nidn

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.1%) to scientific vocabulary
Last synced: 10 months ago · JSON representation ·

Repository

Neural Inverse Design of Nanostructures

Basic Info
  • Host: GitHub
  • Owner: esa
  • License: gpl-3.0
  • Language: Jupyter Notebook
  • Default Branch: main
  • Size: 43.2 MB
Statistics
  • Stars: 42
  • Watchers: 5
  • Forks: 9
  • Open Issues: 11
  • Releases: 2
Created almost 5 years ago · Last pushed over 2 years ago
Metadata Files
Readme License Citation

README.md

Neural Inverse Design of Nanostructures (NIDN)

Documentation Status Tests GitHub last commit GitHub PyPI - Python Version GitHub contributors GitHub issues GitHub pull requests

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact

About The Project

Neural Inverse Design of Nanostructures (NIDN) is a Python project by the Advanced Concepts Team of ESA. The goal of the project is to enable inverse design of stacks of nanostructures, metamaterials, photonic crystals, etc., using neural networks in PyTorch. As forward models, it supports rigorous coupled-wave analysis and a finite-difference time-domain solver. There is an accompanying paper about to be published.

Scheme

Neural Inverse Design of Nanostructures with PyTorch
Explore the docs »

View Example notebook · Report Bug · Request Feature

Built With

This project is based on:

  • grcwa which was modified to include PyTorch support to allow neural network training.
  • fdtd which was modified to allow training neural networks with it and match the setup of NIDN

For more details than provided with NIDN on the forward models please refer to their docs. The adaptations of there code are in the folders nidn/trcwa/ and nidn/fdtd/.

Below you can see results of an exemplary optimization of a three-uniform-layer material to design a 1150nm filter.

Exemplary optimization of a three-uniform-layer material to design a 1150nm filter. | width=300 Exemplary optimization of a three-uniform-layer material to design a 1150nm filter. | width=300 <!-- GETTING STARTED -->

Getting Started

This is a brief guide how to set up NIDN.

Installation

The easiest way is to pip install NIDN via

pip install nidn.

Alternatively, to use the latest code from this repo git clone the repository and make sure you have all the requirements installed.

To set up a conda environment for the project run conda env create -f environment.yml.

This will create a conda environment called nidn for it.

If you just want to install the module in your current environment you can run

pip install . in the root folder where the setup.py is located.

While NIDN does support GPU utilization there are only modest performance benefits to it at time of writing.

Test

After cloning the repository, developers can check the functionality of NIDN by running the following command in the nidn/tests directory:

sh pytest

Usage

Config

NIDN uses a central config file which is passed through the entire program. The default config parameters can be seen here. Practical usage of the config files is demonstrated in the included Jupyter notebook.

Use Case 1: Forward Model Simulation

This serves to compute the spectral characteristics of a material. The Jupyter notebooks ForwardModelSimulationwithFDTD.ipynb and ForwardModelSimulationwithRCWA.ipynb demonstrate this use case.

Use Case 2: Inverse Design of Nanostructures

This is the case you aim to design a material matching some target spectral characteristics. A thorough explanation is given in the Jupyter notebooks InverseMaterialDesignwithFDTD.ipynb and InverseMaterialDesignwithRCWA.ipynb.

Logging & Docs

To change the logging verbosity call nidn.setLogLevel(level) where level is one of TRACE,DEBUG,INFO,WARN and ERROR.

Detailed docs of NIDN are online can be built with sphinx. To do so, make sure sphinx is installed and run make html in the docs folder to get a local html version of the docs. readthedocs support may follow.

Supported Materials

If you try to design a material with the classification approach (see mentioned notebooks for more details), all materials in the materials folder will be utilized. You can manually add other materials there using data from, e.g., refractiveindex.info.

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

The project is open to community contributions. Feel free to open an issue or write us an email if you would like to discuss a problem or idea first.

If you want to contribute, please

  1. Fork the project on GitHub.
  2. Get the most up-to-date code by following this quick guide for installing nidn from source:
    1. Get miniconda or similar
    2. Clone the repo sh git clone https://github.com/esa/nidn.git
    3. With the default configuration PyTorch with CUDA support is installed. If this should not happen, comment out cudatoolkit in the environment.yml.
    4. Set up the environment. This creates a conda environment called nidn and installs the required dependencies. sh conda env create -f environment.yml conda activate nidn

Once the installation is done, you are ready to contribute. Please note that PRs should be created from and into the main branch.

  1. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  2. Commit your Changes (git commit -m 'Add some AmazingFeature')
  3. Push to the Branch (git push origin feature/AmazingFeature)
  4. Open a Pull Request on the main branch.

and we will have a look at your contribution as soon as we can.

Furthermore, please make sure that your PR passes all automated tests. Review will only happen after that. Only PRs created on the main branch with all tests passing will be considered.

License

Distributed under the GPL-3.0 License. See LICENSE for more information.

Contact

Created by ESA's Advanced Concepts Team

  • Pablo Gómez - pablo.gomez at esa.int

Project Link: https://github.com/esa/nidn

Owner

  • Name: European Space Agency
  • Login: esa
  • Kind: organization
  • Location: Europe

The European Space Agency (ESA) is Europe’s gateway to space. Its mission is to shape the development of Europe’s space capability.

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
title: "NIDN: Neural Inverse Design of Nanostructures"
authors:
  - given-names: Pablo
    family-names: Gómez
    email: pablo.gomez@esa.int
    affiliation: >-
      European Space Agency, Advanced Concepts Team,
      Noordwijk, 2201AZ, The Netherlands
    orcid: 'https://orcid.org/0000-0002-5631-8240'
  - given-names: Håvard
    name-particle: Hem
    family-names: Toftevaag
  - given-names: Torbjørn
    family-names: Bogen-Storø
  - given-names: Derek
    family-names: Aranguren van Egmond
  - given-names: José
    name-particle: M.
    family-names: Llorens
repository-code: "https://github.com/esa/nidn/"
repository-artifact: "https://pypi.org/project/nidn/"
license: GPL-3.0
preferred-citation:
  type: article
  authors:
  - given-names: Pablo
    family-names: Gómez
    email: pablo.gomez@esa.int
    affiliation: >-
      European Space Agency, Advanced Concepts Team,
      Noordwijk, 2201AZ, The Netherlands
    orcid: 'https://orcid.org/0000-0002-5631-8240'
  - given-names: Håvard
    name-particle: Hem
    family-names: Toftevaag
  - given-names: Torbjørn
    family-names: Bogen-Storø
  - given-names: Derek
    family-names: Aranguren van Egmond
  - given-names: José
    name-particle: M.
    family-names: Llorens
  doi: "10.48550/arXiv.2208.05480"
  journal: "arXiv"
  title: "NIDN: Neural Inverse Design of Nanostructures"
  year: 2022

GitHub Events

Total
  • Watch event: 4
  • Fork event: 4
Last Year
  • Watch event: 4
  • Fork event: 4

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 50
  • Total pull requests: 52
  • Average time to close issues: 24 days
  • Average time to close pull requests: 6 days
  • Total issue authors: 2
  • Total pull request authors: 3
  • Average comments per issue: 1.52
  • Average comments per pull request: 0.12
  • Merged pull requests: 51
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • gomezzz (39)
  • torbjornstoro (11)
Pull Request Authors
  • gomezzz (29)
  • torbjornstoro (20)
  • htoftevaag (2)
Top Labels
Issue Labels
waveregime_internship (17) enhancement (3) bug (3) help wanted (1) documentation (1) Release (1)
Pull Request Labels
waveregime_internship (4) WIP (3) enhancement (2) Release (1) bug (1)

Packages

  • Total packages: 3
  • Total downloads:
    • pypi 15 last-month
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 1
    (may contain duplicates)
  • Total versions: 6
  • Total maintainers: 1
proxy.golang.org: github.com/esa/NIDN
  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.5%
Dependent repos count: 5.7%
Last synced: 10 months ago
proxy.golang.org: github.com/esa/nidn
  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.5%
Dependent repos count: 5.7%
Last synced: 10 months ago
pypi.org: nidn

A package for inverse material design of nanostructures using neural networks.

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 15 Last month
Rankings
Dependent packages count: 10.1%
Stargazers count: 11.5%
Forks count: 16.8%
Dependent repos count: 21.6%
Average: 27.2%
Downloads: 75.7%
Maintainers (1)
Last synced: 10 months ago

Dependencies

environment.yml conda
  • cudatoolkit >=11.0.221
  • dotmap >=1.3.24
  • loguru >=0.5.3
  • matplotlib >=3.3.3
  • pandas >=1.3.1
  • pytest >=6.2.1
  • python >=3.8
  • pytorch >=1.9
  • scipy >=1.6.0
  • sphinx >=3.4.3
  • sphinx_rtd_theme >=0.5.1
  • toml >=0.10.2
  • tqdm >=4.56.0
requirements.txt pypi
  • dotmap >=1.3.24
  • loguru >=0.5.3
  • matplotlib >=3.3.3
  • pandas >=1.3.1
  • torch ==1.9.0
  • tqdm >=4.56.0
setup.py pypi
  • dotmap >=1.3.24
  • loguru >=0.5.3
  • matplotlib >=3.3.3
  • numpy >=1.20.0
  • pandas >=1.3.1
  • scipy >=1.6.0
  • toml >=0.10.2
  • torch >=1.9
  • tqdm >=4.56.1
.github/workflows/deploy_to_pypi.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/deploy_to_test_pypi.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/run_tests.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • mamba-org/provision-with-micromamba main composite