-
Notifications
You must be signed in to change notification settings - Fork 6
[demo-ready] support QPDK: Merging features from palace-server #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
92563d4
first attempt at merging qpdk from palace-server. Still no double-por…
mdmaas 41645ec
Merge remote-tracking branch 'origin/main' into qpdk
mdmaas e7c5b11
added qpdk to doc deps
mdmaas 0460bd4
obtaining QPDK stack
mdmaas 6c9dea5
Update src/gsim/common/polygon_utils.py
mdmaas c6edfe3
Merge branch 'main' into qpdk
mdmaas 484ef37
fixed pre-commit
mdmaas 2ef31ca
fixed linting issue
mdmaas 0c7d26f
fixed cpw port in example
mdmaas af6a22f
geometry processing for a zero-thickness conductor layer
mdmaas 2c5f575
added sapphire
mdmaas 436a88c
renamed conductor to superconductor
mdmaas 9a78ae4
s parameters in qpdk resonator example
mdmaas 2af0285
Have either the air layer of the current stack or the air box, not both.
dot-cross b1730dd
added port offset to move it with respect to port direction (e.g. inw…
mdmaas 34528d0
merge origin/airbox into qpdk: fragment-based dielectrics with airbox…
mdmaas 4a77d00
implemented boolean pipeline and graded mesh preset
mdmaas ed6aef3
set dielectric constant of sapphire and anisotropy
mdmaas 69768f7
adjusted frequency range
mdmaas e901f80
Change notebook to run on cloud. Fixed qpdk dependency
dot-cross File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
| sim-data-*/ | ||
| palace-sim-*/ | ||
| meep-sim-*/ | ||
| sim_*/ | ||
|
|
||
| # files | ||
| *.c | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
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_localis 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