Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
sim-data-*/
palace-sim-*/
meep-sim-*/
sim_*/

# files
*.c
Expand Down
10 changes: 10 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,18 @@

### Functions

::: gsim.common.cpw_layer_stack

::: gsim.common.create_etched_component

::: gsim.common.decimate

::: gsim.common.extract_geometry_model

::: gsim.common.klayout_to_shapely

::: gsim.common.shapely_to_klayout

---

## gsim.common.viz
Expand Down
182 changes: 182 additions & 0 deletions nbs/palace_qpdk_qubit_resonator.ipynb
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can these be run right now?

With the cloud runner I get

---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Cell In[6], line 1
----> 1 results = sim.run()
      2 # sim.write_config()
      3 # results = sim.run_local()
      5 if results.ok:

File ~/dev/gsim/src/gsim/palace/eigenmode.py:578, in EigenmodeSim.run(self, output_dir, verbose)
    560 def run(
    561     self,
    562     output_dir: str | Path | None = None,
    563     *,
    564     verbose: bool = True,
    565 ) -> dict[str, Path]:
    566     """Run eigenmode simulation on GDSFactory+ cloud.
    567 
    568     Args:
   (...)    576         NotImplementedError: Eigenmode is not yet fully implemented
    577     """
--> 578     raise NotImplementedError(
    579         "Eigenmode simulation is not yet fully implemented on cloud. "
    580         "Use DrivenSim for S-parameter extraction."
    581     )

NotImplementedError: Eigenmode simulation is not yet fully implemented on cloud. Use DrivenSim for S-parameter extraction.

and trying with

sim.write_config()
results = sim.run_local()

I get

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[7], line 2
      1 # results = sim.run()
----> 2 sim.write_config()
      3 results = sim.run_local()
      5 if results.ok:

File ~/dev/gsim/.venv/lib/python3.12/site-packages/pydantic/main.py:1026, in BaseModel.__getattr__(self, item)
   1023     return super().__getattribute__(item)  # Raises AttributeError if appropriate
   1024 else:
   1025     # this is the current error
-> 1026     raise AttributeError(f'{type(self).__name__!r} object has no attribute {item!r}')

AttributeError: 'EigenmodeSim' object has no attribute 'write_config'

Seems the run_local is also implemented only for driven sims but the code could likely be just moved to https://github.com/gdsfactory/gsim/blob/main/src/gsim/palace/base.py

Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "0",
"metadata": {},
"outputs": [],
"source": [
"import gdsfactory as gf\n",
"\n",
"from qpdk import PDK, cells\n",
"from qpdk.cells.helpers import apply_additive_metals\n",
"from qpdk.tech import LAYER\n",
"\n",
"PDK.activate()\n",
"\n",
"\n",
"@gf.cell\n",
"def transmon_component() -> gf.Component:\n",
" \"\"\"Create a qubit with resonator layout.\"\"\"\n",
" c = gf.Component()\n",
"\n",
" ref = c << cells.qubit_with_resonator(\n",
" qubit=\"double_pad_transmon_with_bbox\",\n",
" resonator_length=5000.0,\n",
" resonator_meanders=5,\n",
" qubit_rotation=90,\n",
" )\n",
" c.add_ports(ref.ports)\n",
"\n",
" # Add simulation area around the component\n",
" c.kdb_cell.shapes(LAYER.SIM_AREA).insert(c.bbox().enlarged(100, 100))\n",
"\n",
" return c\n",
"\n",
"\n",
"component = transmon_component()\n",
"_c = component.copy()\n",
"_c.draw_ports()\n",
"_c"
]
},
{
"cell_type": "markdown",
"id": "1",
"metadata": {},
"source": [
"### Inspect raw layers and apply additive metals"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2",
"metadata": {},
"outputs": [],
"source": [
"from gsim.common.polygon_utils import inspect_layers\n",
"\n",
"inspect_layers(component, filename=\"transmon_raw_layers.png\")\n",
"\n",
"# Apply additive metals processing (QPDK-specific step)\n",
"processed = apply_additive_metals(component.copy())\n",
"inspect_layers(processed, filename=\"transmon_processed_layers.png\")"
]
},
{
"cell_type": "markdown",
"id": "3",
"metadata": {},
"source": [
"### Convert QPDK etch layers to conductor geometry"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4",
"metadata": {},
"outputs": [],
"source": [
"from gsim.common.stack.qpdk_utils import create_etched_component\n",
"\n",
"etched = create_etched_component(processed)\n",
"\n",
"inspect_layers(etched, filename=\"transmon_etched_layers.png\")\n",
"etched"
]
},
{
"cell_type": "markdown",
"id": "5",
"metadata": {},
"source": [
"### Configure eigenmode simulation\n",
"\n",
"The junction port is modelled as a lumped element with a 10 nH inductance."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6",
"metadata": {},
"outputs": [],
"source": [
"from gsim.palace import EigenmodeSim\n",
"\n",
"sim = EigenmodeSim()\n",
"sim.set_geometry(etched)\n",
"sim.set_stack(substrate_thickness=500, air_above=500)\n",
"\n",
"# Junction port with 10 nH inductance\n",
"sim.add_port(\"junction\", layer=\"SUPERCONDUCTOR\", length=5.0, inductance=10e-9)\n",
"\n",
"# CPW feed ports\n",
"sim.add_cpw_port(\"o1\", layer=\"SUPERCONDUCTOR\", s_width=10.0, gap_width=6.0, length=5.0)\n",
"\n",
"sim.set_eigenmode(target=5e9, num_modes=3)"
]
},
{
"cell_type": "markdown",
"id": "7",
"metadata": {},
"source": [
"### Mesh and run"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8",
"metadata": {},
"outputs": [],
"source": [
"sim.set_output_dir(\"./sim_qpdk_qubit_resonator\")\n",
"sim.mesh(preset=\"coarse\")\n",
"sim.plot_mesh()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9",
"metadata": {},
"outputs": [],
"source": [
"results = sim.run()\n",
"\n",
"if results.ok:\n",
" print(\"Eigenvalues\")\n",
" print(f\"{'Freq (GHz)':<16} {'Q':<16}\")\n",
" for ev in results.eigenvalues:\n",
" print(f\"{ev.freq:<16.4f} {ev.quality_factor:<16.4f}\")\n",
"else:\n",
" print(\"Simulation failed:\", results.error_msg)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading