Add Circulax transmon optimization notebook with harmonic-balance and transient analysis#583
Draft
Copilot wants to merge 4 commits into
Draft
Add Circulax transmon optimization notebook with harmonic-balance and transient analysis#583Copilot wants to merge 4 commits into
Copilot wants to merge 4 commits into
Conversation
…lysis - Create notebooks/src/circulax_transmon_optimization.py demonstrating: - Josephson junction component definition for Circulax - Layout-to-circuit parameter mapping from qpdk transmon - Harmonic-balance steady-state analysis - Gradient-based optimization of qubit frequency via jax.grad - Transient pulse simulation for coupled-qubit crosstalk - Differentiable crosstalk metric for layout optimization - Add circulax>=0.1.7 as optional dependency in pyproject.toml - Update docs/notebooks.rst with new Differentiable Circuit Simulation section - Add notebook to nb_execution_excludepatterns in docs/conf.py - Update uv.lock with new dependency resolution Agent-Logs-Url: https://github.com/gdsfactory/quantum-rf-pdk/sessions/39b9abaf-f5f7-4be8-af70-3c76131df621 Co-authored-by: nikosavola <7860886+nikosavola@users.noreply.github.com>
- Replace local PHI_0 alias with Φ_0 from qpdk.models.constants - Import ε_0 from qpdk.models.constants instead of redefining locally - Define FLUX_PER_RAD = Φ_0/(2π) as a module-level constant - Include generated .ipynb from jupytext conversion Agent-Logs-Url: https://github.com/gdsfactory/quantum-rf-pdk/sessions/39b9abaf-f5f7-4be8-af70-3c76131df621 Co-authored-by: nikosavola <7860886+nikosavola@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
nikosavola
May 8, 2026 07:46
View session
Contributor
Reviewer's GuideAdds a new Circulax-based transmon optimization example (notebook + jupytext .py) integrating qpdk layout with differentiable circuit simulation, plus small core-library and docs updates to support the example. Sequence diagram for harmonic-balance transmon optimization workflowsequenceDiagram
actor User
participant NB as Notebook
participant QPDK as QPDK
participant Cx as Circulax
participant JAX as JAX
participant Optax as Optax
User->>NB: Run notebook cells (Part 1)
NB->>QPDK: PDK.activate()
QPDK-->>NB: Activated PDK
NB->>QPDK: double_pad_transmon parameters
QPDK-->>NB: pad_size, pad_gap
NB->>QPDK: plate_capacitor_capacitance_analytical
QPDK-->>NB: Cs_initial
NB->>NB: layout_to_circuit_params
NB-->>NB: Ic_initial, Cs_initial, EJ2_ratio
NB->>Cx: build_transmon_netlist(Cs, Ic, EJ2_ratio)
Cx-->>NB: netlist_dict
NB->>Cx: compile_netlist(netlist_dict, models)
Cx-->>NB: groups, num_vars, port_map
NB->>Cx: analyze_circuit(groups, num_vars)
Cx-->>NB: solver
NB->>Cx: solver.solve_dc(initial_guess)
Cx-->>NB: y_dc
NB->>Cx: setup_harmonic_balance(groups, num_vars, freq, num_harmonics)
Cx-->>NB: run_hb callable
NB->>Cx: run_hb(y_dc)
Cx-->>NB: y_time, y_freq
NB->>NB: define hb_loss_fn(params_vec)
NB->>JAX: grad = jax.grad(hb_loss_fn)
JAX-->>NB: grad_fn
NB->>Optax: optimizer = optax.adam()
Optax-->>NB: opt_state
loop Optimization steps
NB->>JAX: grads = grad_fn(params_opt)
JAX-->>NB: grads
NB->>Optax: updates, opt_state = optimizer.update(grads, opt_state)
Optax-->>NB: updates, opt_state
NB->>NB: params_opt = apply_updates(params_opt, updates)
NB->>NB: evaluate hb_loss_fn(params_opt)
end
NB-->>User: Optimized Ic, Cs, f01, alpha
Sequence diagram for transient crosstalk simulation and gradient computationsequenceDiagram
actor User
participant NB as Notebook
participant Cx as Circulax
participant Diffrax as Diffrax
participant JAX as JAX
User->>NB: Run notebook cells (Part 2)
NB->>NB: Define CouplingCapacitor component
NB->>Cx: coupled_netlist with JJ1, JJ2, Cs1, Cs2, Cm, Vpulse
Cx-->>NB: netlist_dict
NB->>Cx: compile_netlist(netlist_dict, models_coupled)
Cx-->>NB: groups_c, num_vars_c, port_map_c
NB->>Cx: analyze_circuit(groups_c, num_vars_c)
Cx-->>NB: solver_c
NB->>Cx: solver_c.solve_dc(initial_guess)
Cx-->>NB: y_dc_c
NB->>Cx: sim = setup_transient(groups_c, solver_c)
Cx-->>NB: sim callable
NB->>Diffrax: sim(t0, t1, dt0, y_dc_c, SaveAt(ts))
Diffrax-->>NB: sol.ys over time
NB->>NB: Extract v_q1, v_q2 from sol.ys
NB-->>User: Crosstalk metrics
NB->>NB: Define crosstalk_metric(log_Cm)
NB->>JAX: grad_fn = jax.grad(crosstalk_metric)
JAX-->>NB: grad_fn
NB->>JAX: grad_crosstalk = grad_fn(log_Cm_init)
JAX-->>NB: grad_crosstalk
NB-->>User: ∂(crosstalk)/∂(log Cm) for layout tuning
Flow diagram for layout-to-circuit mapping and optimization loopflowchart LR
subgraph Layout_to_Circuit
L_Params["Layout parameters\n(pad_width_um, pad_height_um, pad_gap_um, jj_area_um2)"]
L_Map["layout_to_circuit_params"]
C_Params["Circuit parameters\n(Cs, Ic, EJ2_ratio)"]
end
subgraph Optimization_Loop
P_Init["Initial params_vec = [log(Ic), log(Cs)]"]
LossFn["hb_loss_fn(params_vec)"]
Net["build_transmon_netlist(Cs, Ic)"]
Compile["compile_netlist"]
HB["setup_harmonic_balance + run_hb"]
Spectrum["Extract V_1st_harmonic at JJ1"]
Anharm["transmon_anharmonicity"]
LossVal["resonance_loss + 0.1*alpha_error"]
Grad["jax.grad(hb_loss_fn)"]
Opt["optax.adam update"]
P_Update["Updated params_vec"]
end
L_Params --> L_Map --> C_Params
C_Params --> P_Init
P_Init --> LossFn
LossFn --> Net --> Compile --> HB --> Spectrum --> LossVal
LossFn --> Anharm --> LossVal
P_Init --> Grad --> Opt --> P_Update --> LossFn
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
ab0a30f to
e863f14
Compare
| # ### 1.9 Optimization Convergence | ||
|
|
||
| # %% | ||
| fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 4)) |
| # ### 1.9 Optimization Convergence | ||
|
|
||
| # %% | ||
| fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 4)) |
| # ### 2.4 Time-Domain Waveforms | ||
|
|
||
| # %% | ||
| fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(10, 6), sharex=True) |
Fix undefined transmon_frequency and bibtex URN; update notebook
e863f14 to
9ce766f
Compare
Member
|
@copilot resolve the merge conflicts in this pull request |
…son-junction-notebook # Conflicts: # tests/test_models_inductor.py Co-authored-by: nikosavola <7860886+nikosavola@users.noreply.github.com>
Contributor
Author
Resolved the merge conflict in |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds an example notebook demonstrating Circulax (differentiable JAX-based circuit simulator) integration with qpdk for transmon qubit design and optimization.
Notebook content
@componentwith sinusoidal current-phase relation in flux formulationdouble_pad_transmongeometry (pad area, gap, JJ area) to circuit parameters (C_s, I_c, E_J, E_C)jax.grad+ Optax to optimize Ic/Cs toward target f₀₁ = 5 GHz and α = −300 MHzOther changes
pyproject.toml—circulax = ["circulax>=0.1.7", "optax"]optional dependency groupdocs/notebooks.rst— New "Differentiable circuit simulation" sectiondocs/conf.py— Added tonb_execution_excludepatterns(external dep, like HFSS/MATLAB notebooks)uv.lock— Regenerated with circulax resolutionSummary by Sourcery
Add a Circulax-based differentiable transmon circuit simulation and optimization example notebook, along with supporting script, and wire it into the docs and dependency configuration.
New Features:
Enhancements:
Build:
Documentation: