Differentiable RCWA in PyTorch, based on TORCWA
Project description
solwa-0.1.0
- License: LGPL
Differentiable Rigorous Coupled-Wave Analysis (RCWA) package based on PyTorch
Features
solwa (solar + rcwa) is a PyTorch implementation of rigorous coupled-wave analysis (RCWA) based on torcwa https://github.com/kch3782/torcwa
-
GPU-accelerated simulation
-
Supporting automatic differentiation for optimization
-
Units: Lorentz-Heaviside units
-
Speed of light: 1
-
Permittivity and permeability of vacuum: both 1
-
-
Notation: exp(-jωt)
Installation
Install from PyPI using pip:
pip install solwa
Alternatively, install from source by cloning this repository and running:
pip install .
PyTorch ≥ 2.10 is recommended for improved CUDA performance (see PR: https://github.com/pytorch/pytorch/pull/166715)
significant changes from the original torcwa
- Constants are loaded from standard libraries instead of defining them again in the code.
- Major cleanup of the code structure for better readability and maintainability.
- Better error handling and messages.
- Addition of functions for calculation of the poynting vector and power flux.
solwa Examples
-
Example 0: Fresnel equation
-
Example 1: Simulation with rectangular meta-atom
Normal incidence / Parametric sweep on wavelength / View electromagnetic field -
Example 1-1: Simulation with stacked meta-atom
Normal incidence / View electromagnetic field -
Example 2: Simulation with square meta-atom
Oblique incidence / View electromagnetic field -
Example 3: Simulation with rectangular meta-atom
Normal incidence / Parametric sweep on geometric parameters -
Example 4: Gradient calculation of cylindrical meta-atom
Differentiation of transmittance with respect to radius -
Example 5: Shape optimization
Maximize anisotropy -
Example 6: Topology optimization
Maximize 1st order diffraction
Acknowledgements
The fundamental implementation, including mathematical formulation, was implemented in the torcwa package by Changhyun Kim and Byoungho Lee.
This solwa package is a modified version of torcwa for better usability. It will be continuously updated to include more features and improvements.
If this package is useful for your research, please cite the following paper:
@article{
title = {TORCWA: GPU-accelerated Fourier modal method and gradient-based optimization for metasurface design},
journal = {Computer Physics Communications},
volume = {282},
pages = {108552},
year = {2023},
doi = {https://doi.org/10.1016/j.cpc.2022.108552},
author = {Changhyun Kim and Byoungho Lee},
}
Work on the solwa package is supported by the ERC Consolidator Grant (No. 101125948, PHASE).
Furthermore, the authors acknowledge support by the state of Baden-Württemberg through bwHPC through providing computational resources.
The work on the original torcwa was supported by the National Research Foundation of Korea (NRF) grant funded by the Korea government (MSIT) (No. 2020R1A2B5B02002730) and Samsung Electronics Co., Ltd (IO201214-08164-01).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file solwa-0.2.0rc1.tar.gz.
File metadata
- Download URL: solwa-0.2.0rc1.tar.gz
- Upload date:
- Size: 27.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f39866fb1619a75526f2ec1d971481e5127a858495848d290a5f30b70a172b3a
|
|
| MD5 |
0c49c89788992286d1cdf77be5b24ca7
|
|
| BLAKE2b-256 |
ad3ba107c2fd7132d8e100a36163b2157bc66707b77c9e39146c668cdb27f7e9
|
Provenance
The following attestation bundles were made for solwa-0.2.0rc1.tar.gz:
Publisher:
publish.yml on johannesz-codes/solwa
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
solwa-0.2.0rc1.tar.gz -
Subject digest:
f39866fb1619a75526f2ec1d971481e5127a858495848d290a5f30b70a172b3a - Sigstore transparency entry: 1523582737
- Sigstore integration time:
-
Permalink:
johannesz-codes/solwa@ab725611e7a510042c831474e38a0be63e780aa2 -
Branch / Tag:
refs/tags/v0.2.0rc1 - Owner: https://github.com/johannesz-codes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ab725611e7a510042c831474e38a0be63e780aa2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file solwa-0.2.0rc1-py3-none-any.whl.
File metadata
- Download URL: solwa-0.2.0rc1-py3-none-any.whl
- Upload date:
- Size: 22.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6d189cfb7e6cd6d84ba005d7dbd3004b3b63b6c072305f5ba303e71920b8c3f
|
|
| MD5 |
c3b5836a572c43110e23ef410a77d4ac
|
|
| BLAKE2b-256 |
952fa41d1bb78ecdc32c716b297576ea552f5a56247af98334d8a7dccdf28857
|
Provenance
The following attestation bundles were made for solwa-0.2.0rc1-py3-none-any.whl:
Publisher:
publish.yml on johannesz-codes/solwa
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
solwa-0.2.0rc1-py3-none-any.whl -
Subject digest:
e6d189cfb7e6cd6d84ba005d7dbd3004b3b63b6c072305f5ba303e71920b8c3f - Sigstore transparency entry: 1523582757
- Sigstore integration time:
-
Permalink:
johannesz-codes/solwa@ab725611e7a510042c831474e38a0be63e780aa2 -
Branch / Tag:
refs/tags/v0.2.0rc1 - Owner: https://github.com/johannesz-codes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ab725611e7a510042c831474e38a0be63e780aa2 -
Trigger Event:
release
-
Statement type: