solwa 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- solwa-0.1.0/LICENSE +21 -0
- solwa-0.1.0/PKG-INFO +118 -0
- solwa-0.1.0/README.md +102 -0
- solwa-0.1.0/pyproject.toml +28 -0
- solwa-0.1.0/setup.cfg +4 -0
- solwa-0.1.0/setup.py +3 -0
- solwa-0.1.0/src/solwa/__init__.py +23 -0
- solwa-0.1.0/src/solwa/geometry.py +752 -0
- solwa-0.1.0/src/solwa/materials.py +181 -0
- solwa-0.1.0/src/solwa/rcwa.py +2172 -0
- solwa-0.1.0/src/solwa/torch_eig.py +98 -0
- solwa-0.1.0/src/solwa/utils.py +51 -0
- solwa-0.1.0/src/solwa.egg-info/PKG-INFO +118 -0
- solwa-0.1.0/src/solwa.egg-info/SOURCES.txt +15 -0
- solwa-0.1.0/src/solwa.egg-info/dependency_links.txt +1 -0
- solwa-0.1.0/src/solwa.egg-info/requires.txt +3 -0
- solwa-0.1.0/src/solwa.egg-info/top_level.txt +1 -0
solwa-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Original TORCWA: GPU-accelerated rigorous coupled-wave analysis with automatic differentiation
|
|
5
|
+
Copyright (C) 2022 Changhyun Kim
|
|
6
|
+
|
|
7
|
+
SOLWA:
|
|
8
|
+
Copyright (C) 2025 Johannes Zeiser
|
|
9
|
+
|
|
10
|
+
This program is free software: you can redistribute it and/or modify
|
|
11
|
+
it under the terms of the GNU Lesser General Public License as
|
|
12
|
+
published by the Free Software Foundation, either version 3 of the
|
|
13
|
+
License, or (at your option) any later version.
|
|
14
|
+
|
|
15
|
+
This program is distributed in the hope that it will be useful,
|
|
16
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18
|
+
GNU Lesser General Public License for more details.
|
|
19
|
+
|
|
20
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
21
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
solwa-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: solwa
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Differentiable RCWA in PyTorch, based on TORCWA
|
|
5
|
+
Author: Johannes Zeiser
|
|
6
|
+
License: LGPL-3.0-or-later
|
|
7
|
+
Project-URL: Repository, https://github.com/johannesz-codes/solwa
|
|
8
|
+
Project-URL: Issues, https://github.com/johannesz-codes/solwa/issues
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: torch>=2.0
|
|
13
|
+
Requires-Dist: numpy
|
|
14
|
+
Requires-Dist: scipy
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
|
|
17
|
+
**solwa-0.1.0**
|
|
18
|
+
======
|
|
19
|
+
|
|
20
|
+
* License: LGPL
|
|
21
|
+
|
|
22
|
+
Differentiable Rigorous Coupled-Wave Analysis (RCWA) package based on PyTorch
|
|
23
|
+
|
|
24
|
+
<br/>
|
|
25
|
+
|
|
26
|
+
Features
|
|
27
|
+
--------
|
|
28
|
+
**solwa** (**solar** + **rcwa**) is a PyTorch implementation of rigorous coupled-wave analysis (RCWA) based on **torcwa** https://github.com/kch3782/torcwa
|
|
29
|
+
|
|
30
|
+
* **GPU-accelerated** simulation
|
|
31
|
+
|
|
32
|
+
* Supporting **automatic differentiation** for optimization
|
|
33
|
+
|
|
34
|
+
* Units: Lorentz-Heaviside units
|
|
35
|
+
|
|
36
|
+
* Speed of light: 1
|
|
37
|
+
|
|
38
|
+
* Permittivity and permeability of vacuum: both 1
|
|
39
|
+
|
|
40
|
+
* Notation: exp(-*jωt*)
|
|
41
|
+
|
|
42
|
+
<br/>
|
|
43
|
+
|
|
44
|
+
Installation
|
|
45
|
+
------------
|
|
46
|
+
currently only installation from source is supported
|
|
47
|
+
|
|
48
|
+
PyTorch ≥ 2.10 is recommended for improved CUDA performance
|
|
49
|
+
(see PR: https://github.com/pytorch/pytorch/pull/166715)
|
|
50
|
+
|
|
51
|
+
<br/>
|
|
52
|
+
|
|
53
|
+
significant changes from the original torcwa
|
|
54
|
+
------------
|
|
55
|
+
1. Constants are loaded from standard libraries instead of defining them again in the code.
|
|
56
|
+
2. Major cleanup of the code structure for better readability and maintainability.
|
|
57
|
+
3. Better error handling and messages.
|
|
58
|
+
4. Addition of functions for calculation of the poynting vector and power flux.
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
<br/>
|
|
62
|
+
|
|
63
|
+
**solwa** Examples
|
|
64
|
+
---------------
|
|
65
|
+
1. [Example 0](./example/Example0.ipynb): Fresnel equation
|
|
66
|
+
|
|
67
|
+
2. [Example 1](./example/Example1.ipynb): Simulation with rectangular meta-atom
|
|
68
|
+
Normal incidence / Parametric sweep on wavelength / View electromagnetic field
|
|
69
|
+
|
|
70
|
+
3. [Example 1-1](./example/Example1-1.ipynb): Simulation with stacked meta-atom
|
|
71
|
+
Normal incidence / View electromagnetic field
|
|
72
|
+
|
|
73
|
+
4. [Example 2](./example/Example2.ipynb): Simulation with square meta-atom
|
|
74
|
+
Oblique incidence / View electromagnetic field
|
|
75
|
+
|
|
76
|
+
5. [Example 3](./example/Example3.ipynb): Simulation with rectangular meta-atom
|
|
77
|
+
Normal incidence / Parametric sweep on geometric parameters
|
|
78
|
+
|
|
79
|
+
6. [Example 4](./example/Example4.ipynb): Gradient calculation of cylindrical meta-atom
|
|
80
|
+
Differentiation of transmittance with respect to radius
|
|
81
|
+
|
|
82
|
+
7. [Example 5](./example/Example5.ipynb): Shape optimization
|
|
83
|
+
Maximize anisotropy
|
|
84
|
+
|
|
85
|
+
8. [Example 6](./example/Example6.ipynb): Topology optimization
|
|
86
|
+
Maximize 1st order diffraction
|
|
87
|
+
|
|
88
|
+
<br/>
|
|
89
|
+
|
|
90
|
+
Acknowledgements
|
|
91
|
+
----------------
|
|
92
|
+
The fundamental implementation, including mathematical formulation, was implemented in the **torcwa** package
|
|
93
|
+
by Changhyun Kim and Byoungho Lee.
|
|
94
|
+
|
|
95
|
+
This **solwa** package is a modified version of **torcwa** for better usability.
|
|
96
|
+
It will be continuously updated to include more features and improvements.
|
|
97
|
+
|
|
98
|
+
If this package is useful for your research, please cite the following paper:
|
|
99
|
+
```
|
|
100
|
+
@article{
|
|
101
|
+
title = {TORCWA: GPU-accelerated Fourier modal method and gradient-based optimization for metasurface design},
|
|
102
|
+
journal = {Computer Physics Communications},
|
|
103
|
+
volume = {282},
|
|
104
|
+
pages = {108552},
|
|
105
|
+
year = {2023},
|
|
106
|
+
doi = {https://doi.org/10.1016/j.cpc.2022.108552},
|
|
107
|
+
author = {Changhyun Kim and Byoungho Lee},
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Work on the **solwa** package is supported by the ERC Consolidator Grant (No. 101125948, PHASE).
|
|
112
|
+
|
|
113
|
+
Furthermore, the authors acknowledge support by the state of Baden-Württemberg through bwHPC
|
|
114
|
+
through providing computational resources.
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
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).
|
solwa-0.1.0/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
**solwa-0.1.0**
|
|
2
|
+
======
|
|
3
|
+
|
|
4
|
+
* License: LGPL
|
|
5
|
+
|
|
6
|
+
Differentiable Rigorous Coupled-Wave Analysis (RCWA) package based on PyTorch
|
|
7
|
+
|
|
8
|
+
<br/>
|
|
9
|
+
|
|
10
|
+
Features
|
|
11
|
+
--------
|
|
12
|
+
**solwa** (**solar** + **rcwa**) is a PyTorch implementation of rigorous coupled-wave analysis (RCWA) based on **torcwa** https://github.com/kch3782/torcwa
|
|
13
|
+
|
|
14
|
+
* **GPU-accelerated** simulation
|
|
15
|
+
|
|
16
|
+
* Supporting **automatic differentiation** for optimization
|
|
17
|
+
|
|
18
|
+
* Units: Lorentz-Heaviside units
|
|
19
|
+
|
|
20
|
+
* Speed of light: 1
|
|
21
|
+
|
|
22
|
+
* Permittivity and permeability of vacuum: both 1
|
|
23
|
+
|
|
24
|
+
* Notation: exp(-*jωt*)
|
|
25
|
+
|
|
26
|
+
<br/>
|
|
27
|
+
|
|
28
|
+
Installation
|
|
29
|
+
------------
|
|
30
|
+
currently only installation from source is supported
|
|
31
|
+
|
|
32
|
+
PyTorch ≥ 2.10 is recommended for improved CUDA performance
|
|
33
|
+
(see PR: https://github.com/pytorch/pytorch/pull/166715)
|
|
34
|
+
|
|
35
|
+
<br/>
|
|
36
|
+
|
|
37
|
+
significant changes from the original torcwa
|
|
38
|
+
------------
|
|
39
|
+
1. Constants are loaded from standard libraries instead of defining them again in the code.
|
|
40
|
+
2. Major cleanup of the code structure for better readability and maintainability.
|
|
41
|
+
3. Better error handling and messages.
|
|
42
|
+
4. Addition of functions for calculation of the poynting vector and power flux.
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
<br/>
|
|
46
|
+
|
|
47
|
+
**solwa** Examples
|
|
48
|
+
---------------
|
|
49
|
+
1. [Example 0](./example/Example0.ipynb): Fresnel equation
|
|
50
|
+
|
|
51
|
+
2. [Example 1](./example/Example1.ipynb): Simulation with rectangular meta-atom
|
|
52
|
+
Normal incidence / Parametric sweep on wavelength / View electromagnetic field
|
|
53
|
+
|
|
54
|
+
3. [Example 1-1](./example/Example1-1.ipynb): Simulation with stacked meta-atom
|
|
55
|
+
Normal incidence / View electromagnetic field
|
|
56
|
+
|
|
57
|
+
4. [Example 2](./example/Example2.ipynb): Simulation with square meta-atom
|
|
58
|
+
Oblique incidence / View electromagnetic field
|
|
59
|
+
|
|
60
|
+
5. [Example 3](./example/Example3.ipynb): Simulation with rectangular meta-atom
|
|
61
|
+
Normal incidence / Parametric sweep on geometric parameters
|
|
62
|
+
|
|
63
|
+
6. [Example 4](./example/Example4.ipynb): Gradient calculation of cylindrical meta-atom
|
|
64
|
+
Differentiation of transmittance with respect to radius
|
|
65
|
+
|
|
66
|
+
7. [Example 5](./example/Example5.ipynb): Shape optimization
|
|
67
|
+
Maximize anisotropy
|
|
68
|
+
|
|
69
|
+
8. [Example 6](./example/Example6.ipynb): Topology optimization
|
|
70
|
+
Maximize 1st order diffraction
|
|
71
|
+
|
|
72
|
+
<br/>
|
|
73
|
+
|
|
74
|
+
Acknowledgements
|
|
75
|
+
----------------
|
|
76
|
+
The fundamental implementation, including mathematical formulation, was implemented in the **torcwa** package
|
|
77
|
+
by Changhyun Kim and Byoungho Lee.
|
|
78
|
+
|
|
79
|
+
This **solwa** package is a modified version of **torcwa** for better usability.
|
|
80
|
+
It will be continuously updated to include more features and improvements.
|
|
81
|
+
|
|
82
|
+
If this package is useful for your research, please cite the following paper:
|
|
83
|
+
```
|
|
84
|
+
@article{
|
|
85
|
+
title = {TORCWA: GPU-accelerated Fourier modal method and gradient-based optimization for metasurface design},
|
|
86
|
+
journal = {Computer Physics Communications},
|
|
87
|
+
volume = {282},
|
|
88
|
+
pages = {108552},
|
|
89
|
+
year = {2023},
|
|
90
|
+
doi = {https://doi.org/10.1016/j.cpc.2022.108552},
|
|
91
|
+
author = {Changhyun Kim and Byoungho Lee},
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Work on the **solwa** package is supported by the ERC Consolidator Grant (No. 101125948, PHASE).
|
|
96
|
+
|
|
97
|
+
Furthermore, the authors acknowledge support by the state of Baden-Württemberg through bwHPC
|
|
98
|
+
through providing computational resources.
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
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).
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "solwa"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Differentiable RCWA in PyTorch, based on TORCWA"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "LGPL-3.0-or-later" }
|
|
12
|
+
authors = [{ name = "Johannes Zeiser" }]
|
|
13
|
+
dependencies = [
|
|
14
|
+
"torch>=2.0",
|
|
15
|
+
"numpy",
|
|
16
|
+
"scipy",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
[project.urls]
|
|
20
|
+
Repository = "https://github.com/johannesz-codes/solwa"
|
|
21
|
+
Issues = "https://github.com/johannesz-codes/solwa/issues"
|
|
22
|
+
|
|
23
|
+
[tool.setuptools]
|
|
24
|
+
package-dir = {"" = "src"}
|
|
25
|
+
|
|
26
|
+
[tool.setuptools.packages.find]
|
|
27
|
+
where = ["src"]
|
|
28
|
+
include = ["solwa*"]
|
solwa-0.1.0/setup.cfg
ADDED
solwa-0.1.0/setup.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""
|
|
2
|
+
SOLWA: PyTorch-based Rigorous Coupled-Wave Analysis.
|
|
3
|
+
|
|
4
|
+
GPU-accelerated Fourier Modal Method with automatic differentiation support
|
|
5
|
+
for metasurface design and optimization.
|
|
6
|
+
|
|
7
|
+
This package provides:
|
|
8
|
+
- RCWA simulation (rcwa class)
|
|
9
|
+
- Geometry generation utilities (geometry, rcwa_geo)
|
|
10
|
+
- Material property management (materials)
|
|
11
|
+
- Stable eigendecomposition (Eig)
|
|
12
|
+
|
|
13
|
+
Uses Lorentz-Heaviside units with speed of light = 1 and
|
|
14
|
+
time harmonics notation exp(-jωt).
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from .torch_eig import Eig as Eig
|
|
18
|
+
from .geometry import geometry as geometry, rcwa_geo as rcwa_geo
|
|
19
|
+
from .rcwa import rcwa as rcwa
|
|
20
|
+
from . import materials as materials
|
|
21
|
+
|
|
22
|
+
__author__ = """Johannes Zeiser"""
|
|
23
|
+
__version__ = "0.1.0"
|