Metadata-Version: 2.4
Name: gds2openEMS
Version: 0.8.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: gdstk
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

## 22-29-Nov-2026 (0.8.1, released 29-Nov-2026)

**Fix, holes in merged shapes (`util_gds_reader.py` 1.3.1):** where shapes are merged (via arrays with `merge_polygon_size`, derived layers), a hole of the merged shape could come out filled. The geometry library (gdstk 1.0.2) returned it as a separate polygon in some unions of many shapes, which became metal. The same fix as in gds2palace (reader 1.3.5) and gds_prepare_for_EM 1.9.1.

**Stackup format 3.2:** stackup files can use the new features of gds2palace 0.13.0: limits for stackup variables (minimum/maximum or a list of allowed values), `Priority`, which sets the material used where volumes overlap, and `Datatype` per stackup layer, so that a metal and a keepout can share one GDS layer number. Existing stackups give the same models as before. Thermal conductivity per direction is read but not used by openEMS.

**Stackup reader: four edge cases (`util_stackup_reader.py` 1.10.0):** a `<Layer>` whose `Zmin` and `Zmax` are the same number becomes a sheet also when they are written differently (`"0.4"` and `"0.40"`); before, the text was compared. A negative `<Substrate Offset>` shifts the layers down; before, it was ignored without a message. `<Point>`s of a `<Table>` are sorted by temperature, and two points at the same temperature stop with an error. Two `<Layer>`s with the same `Name` stop with an error; before, the first one was used for `Reference` and ports. None of the stackup files in this repository is affected. The same fixes as in gds2palace 0.12.1. New tests: `tests/test_stackup_reader.py`.

**Stackup Editor (`stackupEditor`):** the editor has the new columns and dialogs for these features, the same as in setupEM: Priority, Datatype, limits and description for variables, and thermal conductivity lateral and vertical.

**Unknown attributes in a stackup file:** a misspelled attribute, e.g. `DataType="20"` instead of `Datatype="20"`, now gives a warning that names the attribute and the closest known one. Before, it was ignored without a message. The same as in gds2palace 0.13.0.

**Stackup Editor, saving:** a comment in `<Layers>` stays in front of its layer when the layers are sorted; before, all comments moved to the top of the section. The comment about format 3.2 names the features the file uses. The file ends with a newline. In the preview, two dielectrics that overlap with different Priority show their Priority, and a layer in the overlap is drawn once. The same as in setupEM 0.21.0.

**Stackup Editor, from setupEM's editor:** Ctrl+C in the preview window copies the cross-section to the clipboard as an image. Deselecting a row in the Layers or Dielectric Stack table clears the highlight in the preview. `stackupEditor --version` prints the version.

**SG13G2 stackups:** `SG13G2_FDTD_300um.xml` and `SG13G2_FDTD_300um_passicut.xml` have a minimum of 25 µm for `total_thickness`.

**Fix, `Boundary` of a `<Dielectric>`:** a dielectric with a `Boundary` layer now takes the size of the shapes on that layer, plus `margin`. Before, `Boundary` had no effect in gds2openEMS: every dielectric got the size of the whole model. The model script must give `read_gds()` the boundary layers: `gds_boundary_layers=dielectrics_list.get_boundary_layers()`. A warning is printed when no shapes were read on a boundary layer.

**Fix:** a dielectric layer whose material has an empty `Color` was missing in the model. A `<Dielectric>` or a layer whose material has no `Color` at all stopped the model setup with a Python error.

## 19-Nov-2026 (0.8.0)

**gdstk instead of gdspy:** the GDSII reader uses [gdstk](https://github.com/heitzmann/gdstk) instead of gdspy, which is no longer maintained and whose polygon fracturing could hang. `pip install gds2openEMS` installs gdstk. The results are the same: `read_gds()` on all GDS files shipped in `workflow/` and `more_examples/`, with and without via merging, gives every layer the same area as before. The mirror/offset options of `read_gds()` now also move paths; before, only polygons moved. The same port as gds2palace 0.11 and gds_prepare_for_EM 1.8.

**Changed behaviour, the cell read without a cell name:** with `cellname=""` (or a name not in the file), `read_gds()` reads the design cell: the top-level cell with the largest bounding box, never KLayout's `$$$CONTEXT_INFO$$$`. Before, it read the first top-level cell, which depends on the order in the file. gds2palace, gds_prepare_for_EM, setupEM and the gds2palace MCP server use the same rule (`select_design_cell()`).

**Fix, via array merging:** with `merge_polygon_size > 0`, merged vias no longer have strips cut out of them. A via array around an opening, e.g. a guard ring of contacts, came out cut open: shrinking back after merging opened the slit that encodes the hole, and, for large arrays, the lines along which the merged shape was split into pieces. The same for derived layers with a negative `Oversize`. Of the shipped layouts only `gsg_through_50ohm.gds` changes, by +0.003 % merged via area.

**Fix, model files with decimal commas:** openEMS and CSXCAD write the numbers of the model file (`sub-<n>/<model>.xml`) and of the CSX file for the model hash in the number format of the C library. When the program had set a locale with decimal commas (Qt does that from `LANG`, e.g. a model script that opens a Qt matplotlib window first, with `LANG=de_DE`), the files got numbers like `endCriteria="0,0001"`, which the openEMS binary does not read as the number, and the model hash changed. The files are now always written with decimal points. The simulation started from Python was not affected: it does not read these files.

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

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

---

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

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