Metadata-Version: 2.4
Name: gds2openEMS
Version: 0.7.1
Summary: Create and run openEMS FDTD model from RFIC GDSII layout file
Author-email: Volker Muehlhaus <volker@muehlhaus.com>
License-Expression: GPL-3.0-or-later
Project-URL: Homepage, https://github.com/VolkerMuehlhaus/gds2openEMS
Project-URL: Repository, https://github.com/VolkerMuehlhaus/gds2openEMS
Project-URL: Changelog, https://github.com/VolkerMuehlhaus/gds2openEMS/blob/main/doc/CHANGES.md
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: gdspy>1.6.0
Requires-Dist: CSXCAD
Requires-Dist: openEMS
Requires-Dist: numpy
Requires-Dist: shapely
Requires-Dist: PySide6
Dynamic: license-file

# gds2openEMS: FDTD simulation workflow for RFIC

The files provided here enable openEMS EM simulation with layouts
created for the IHP SG13G2 RFIC technology.

![Intro](https://raw.githubusercontent.com/VolkerMuehlhaus/gds2openEMS/main/doc/png/gds2openEMS_banner.png)

## Install

    pip install gds2openEMS

**Full documentation, installation guide, and usage walkthrough:**
https://github.com/VolkerMuehlhaus/gds2openEMS

## Recent changes

## 17-Nov-2026 (0.7.1)

**Model file for the openEMS command line:** `sub-<n>/<model>.xml` is now the complete openEMS model, written with `FDTD.Write2XML()` (openEMS v0.37.0 and newer): besides geometry, mesh and ports, it has the excitation, the end criterion and the boundaries, so `openEMS <model>.xml` runs it without Python. Before, it held only the CSX (`CSX.Write2XML()`), which the openEMS program can't run. `runSimulation()` prints the command for each excitation, with the options the script passes to openEMS (`--engine`, `--gpu-device`, `--numThreads`, `--verbose`), since they are not part of the file. Nothing else changes: the simulation still starts from Python as before, and the hash that detects an unchanged model is still taken from the CSX alone, so existing results are not simulated again. With an older openEMS the file holds the CSX only, as before. Checked: the via port line run from the command line gives the same S-parameters as the run from the script.

**L6n2 study redone** ([`more_examples/measured_vs_simulated/more_accurate_models_L6n2`](../more_examples/measured_vs_simulated/more_accurate_models_L6n2/README.md)). All models were run again with a larger simulation box and today's software, so that all numbers and times in the README come from one setup:

- **The box:** the PEC walls were too close: 250 µm margin and no air beyond it, with the bottom wall directly under the 180 µm substrate. A sweep of the air around the model (step 0 of the README) shows L 1.8 % too low and the SRF 0.9 % too high with that box. All models now use 250 µm margin and 800 µm air on all sides.
- **The software:** gds2openEMS 0.7.0 and openEMS built from source (1d710c2), with its new CPU engine, on the same machine as before. The earlier runs used gds2openEMS 0.5.0 (the 1 µm models with the z mesh fix of 28-Sep-2026, which removed a 0.1 µm cell in TopMetal2) and openEMS v0.0.36 with its default engine; the 1 µm model took 34 min then, 7 min now.
- **The order of the steps:** the end criterion now comes before the mesh check, which runs at −60 dB. Before, the mesh was checked at −40 dB, where the low-frequency resistance still carries the truncation error of the end criterion. At −60 dB, peak Q changes by 6 % from 1 µm to 0.5 µm, so the final model now uses a 0.5 µm mesh (102 min).
- **What changed in the results:** the conclusions of all steps hold. Against the measurement, the earlier final model (1 µm mesh) was 3.9 % low in L, 8.9 % low in peak Q and within 0.1 % in SRF; the new final model (0.5 µm mesh, box far enough) is 2.1 % low in L, 2.4 % low in peak Q and 0.5 % high in SRF.
- **The comparison with Palace** now uses the gds2palace v5 model, whose boundary is far enough away too. The earlier comparison used the v2 model (100 µm margin) and agreed within 1.9 % in peak Q. With both boundaries far enough and the 0.5 µm mesh in openEMS, the two solvers agree within 1.4 % in peak Q and 0.5 % in SRF; L is 2.3 % lower in openEMS, not explained yet.

## 16-Nov-2026

**GPU device:** `settings['gpu_device']` selects the GPU of the GPU engine on a machine with more than one GPU (default: openEMS takes the best one). It is passed to openEMS only if the installed openEMS has this option; older ones would stop with an unknown-option error, so gds2openEMS prints a warning instead. See [Choosing the GPU](userguide_md_format/Using_OpenEMS_Python_with_IHP_SG13G2_v3.md#choosing-the-gpu) in the user's guide.

**More openEMS messages:** openEMS now runs at verbose level 1. Its output adds about 30 lines per excitation: the model statistics (cells, memory of operator and field data, PEC edges, timestep, excitation length, time to build the operator) and, for the GPU engine, the list of GPU devices.

**Engine from the environment:** without `settings['engine']`, current openEMS takes the engine from the environment variable `OPENEMS_ENGINE`. gds2openEMS now writes that engine to `time_information.txt` too, and warns for `OPENEMS_ENGINE=gpu` with an openEMS without the GPU engine, as for `settings['engine']`. Older openEMS ignores the variable; gds2openEMS warns about that. See [The engine from the environment](userguide_md_format/Using_OpenEMS_Python_with_IHP_SG13G2_v3.md#the-engine-from-the-environment) in the user's guide.

## 12-Nov-2026

**New CPU engine of openEMS:** `settings['engine'] = 'cpu'` selects the new CPU engine of openEMS, in addition to `'gpu'` for the GPU engine:

```python
settings['engine'] = 'cpu'   # new CPU engine
settings['engine'] = 'gpu'   # GPU engine
```

Without `settings['engine']`, nothing changes: no engine is passed, and openEMS uses its default (the multithreaded SSE engine). The new CPU engine is experimental in openEMS and not in an openEMS release yet (v0.37.0 doesn't have it): openEMS has to be built from its current source code. openEMS without this engine ignores `'cpu'` and runs its default engine, without a warning; the openEMS output shows which engine runs. Example, on an AMD Ryzen AI Max+ PRO 395: `run_line_full2port.py` (PML boundaries) took 7.7 s per port instead of 33 s, with S-parameters equal to 1e-6. See [The new CPU engine](userguide_md_format/Using_OpenEMS_Python_with_IHP_SG13G2_v3.md#the-new-cpu-engine) in the user's guide.

**`convert2settings`**, the tool that converts model scripts from the older loose-variable syntax to the `settings[]` syntax (see 26-Oct-2026 below), can set both engines:

```
convert2settings my_model.py --engine cpu       # also use the new CPU engine
convert2settings my_model.py --engine gpu       # also run on the GPU
convert2settings --gui my_model.py              # preview side by side in a window, then convert
```

In the `--gui` window, the "Run on the GPU" checkbox is now a choice of `settings['engine']`: not set, `'cpu'` or `'gpu'`. The tool is described in [Converting older models](userguide_md_format/Using_OpenEMS_Python_with_IHP_SG13G2_v3.md#converting-older-models-to-the-settings-syntax) in the user's guide, and now also mentioned in the README.

Full history: [CHANGES.md](https://github.com/VolkerMuehlhaus/gds2openEMS/blob/main/doc/CHANGES.md)

---

**Note:** the `gds2openEMS` PyPI package itself only requires:

- gdspy>1.6.0
- CSXCAD
- openEMS
- numpy
- shapely
- PySide6

(Other Python modules mentioned above are only needed to run the example/model scripts in this repository, not to use the installed package.)
