Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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

GPU continuous integration

SOLWA can run its physics tests on a fresh Nebius GPU VM through GitHub Actions. To run them on a pull request, add the gpu-ci label; they start after the CPU tests pass. See GPU CI setup and recovery for the two secrets, project/subnet configuration, the gpu-ci PR label, manual runs, and automatic cleanup.

Metadata

Release files for solwa 0.3.0rc1

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.3.0rc1
File Size Uploaded Provenance Actions
solwa-0.3.0rc1.tar.gz 32.5 kB With provenance Details for solwa-0.3.0rc1.tar.gz

Built distribution (wheel)

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

Total release size: 57.9 kB

Release files / solwa-0.3.0rc1.tar.gz

Download URL solwa-0.3.0rc1.tar.gz
Size 32.5 kB
Tags Source
SHA-256 checksum
How to use checksums
dbae775d1d4a5a8f20674e139795990c55fb8b90b0d51b6e6fc550c6dc4f9c0b
BLAKE2b-256 checksum
How to use checksums
60bd0ea864666c17a54f9ac2ee90dec14a004bf928739da73d0d6616b6556cc6
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 Nov 3, 2026.

Transparency log

Release files / solwa-0.3.0rc1-py3-none-any.whl

Download URL solwa-0.3.0rc1-py3-none-any.whl
Size 25.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed1ad1909918823d9654975cc8c76926cfb10b5d763417fe083d0748527d3755
BLAKE2b-256 checksum
How to use checksums
eeeecb8a9a1aff53d7d7c1d0b01d6715f6e6e929d09336603a2be3b1c5246250
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 Nov 3, 2026.

Transparency log

Security for solwa 0.3.0rc1

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.3.0rc1.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 Nov 3, 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