Skip to main content

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

  1. Constants are loaded from standard libraries instead of defining them again in the code.
  2. Major cleanup of the code structure for better readability and maintainability.
  3. Better error handling and messages.
  4. Addition of functions for calculation of the poynting vector and power flux.

solwa Examples

  1. Example 0: Fresnel equation

  2. Example 1: Simulation with rectangular meta-atom
    Normal incidence / Parametric sweep on wavelength / View electromagnetic field

  3. Example 1-1: Simulation with stacked meta-atom
    Normal incidence / View electromagnetic field

  4. Example 2: Simulation with square meta-atom
    Oblique incidence / View electromagnetic field

  5. Example 3: Simulation with rectangular meta-atom
    Normal incidence / Parametric sweep on geometric parameters

  6. Example 4: Gradient calculation of cylindrical meta-atom
    Differentiation of transmittance with respect to radius

  7. Example 5: Shape optimization
    Maximize anisotropy

  8. 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).

Metadata

Release files for solwa 0.2.0

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

Source distribution (sdist)

Source distribution for solwa 0.2.0
File Size Uploaded Provenance Actions
solwa-0.2.0.tar.gz 29.6 kB With provenance Details for solwa-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for solwa 0.2.0
File Interpreter ABI Platform Actions
solwa-0.2.0-py3-none-any.whl Python 3 none any Details for solwa-0.2.0-py3-none-any.whl

Total release size: 54.0 kB

Release files / solwa-0.2.0.tar.gz

Download URL solwa-0.2.0.tar.gz
Size 29.6 kB
Tags Source
SHA-256 checksum
How to use checksums
285a1a9f18f21d265896b0de91e6d30f31e02712c9b2a744befe24b360e47b50
BLAKE2b-256 checksum
How to use checksums
a153f25666dc269b8417fe2121529cf2d876f270b5f7a9a4aeff502a26eaf905
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Release files / solwa-0.2.0-py3-none-any.whl

Download URL solwa-0.2.0-py3-none-any.whl
Size 24.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc897bb0bf28c191bc7c8fdad29edbb5ca1e375a3aa34d314b74ee5cd3cad1d6
BLAKE2b-256 checksum
How to use checksums
cf0bd99cf8007482b9fe96b9352791c564554fad27a035048264331c0cfb57f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Security for solwa 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for solwa-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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