Note
This page was generated from tut//4-Analysis//4.13-Analyze-transmon-and-resonator.ipynb.
Analyzing and tuning a transmon qubit with a resonator#
We will showcase two methods (EPR amd LOM) to analyze the same design. Specifically, we will use here the advanced
methods to run the simulations and analysis, which directly contorl renderers and external packages. Please refer to the tutorial notebooks 4.1 and 4.2 to follow the suggested
flow to run the analysis.
Index#
Transmon & resonator design#
Prepare the single transmon qubit layout in qiskit-metal.
Transmon & resonator analysis using EPR method#
Set-up and run a finite element simulate to extract the eigenmode.
Display EM fields to inspect quality of the setup.
Identify junction parameters for the EPR analysis.
Run EPR analysis on single eigenmode.
Get qubit freq and anharmonicity.
Calculate EPR of substrate.
Transmon & resonator analysis using LOM method#
Calculate the capacitance matrix.
Execute analysis on extracted LOM.
Prerequisite#
You need to have a working local installation of Ansys. Also you will need the following directives and inports.
[1]:
%load_ext autoreload
%autoreload 2
import qiskit_metal as metal
from qiskit_metal import designs, draw
from qiskit_metal import MetalGUI, Dict, Headings
import pyEPR as epr
1. Create the Qbit design#
Fix the design dimensions that you intend to reflect in the design rendering. Note that the design size extends from the origin into the first quadrant.
[2]:
design = designs.DesignPlanar({}, True)
design.chips.main.size['size_x'] = '2mm'
design.chips.main.size['size_y'] = '2mm'
gui = MetalGUI(design)
Create a single transmon with one readout resonator. Please refer to the notebook tutorials 4.11 ad 4.12 if you’re not familiar with the code in the cell below.
[3]:
from qiskit_metal.qlibrary.qubits.transmon_pocket import TransmonPocket
from qiskit_metal.qlibrary.terminations.open_to_ground import OpenToGround
from qiskit_metal.qlibrary.tlines.meandered import RouteMeander
design.delete_all_components()
q1 = TransmonPocket(design, 'Q1', options = dict(
pad_width = '425 um',
pocket_height = '650um',
connection_pads=dict(
readout = dict(loc_W=+1,loc_H=+1, pad_width='200um')
)))
otg = OpenToGround(design, 'open_to_ground', options=dict(pos_x='1.75mm', pos_y='0um', orientation='0'))
readout = RouteMeander(design, 'readout', Dict(
total_length='6 mm',
hfss_wire_bonds = True,
fillet='90 um',
lead = dict(start_straight='100um'),
pin_inputs=Dict(
start_pin=Dict(component='Q1', pin='readout'),
end_pin=Dict(component='open_to_ground', pin='open')), ))
gui.rebuild()
gui.autoscale()
2. Analyze the transmon & resonator using the Eigenmode-EPR method#
In this section we will use a semi-manual (advanced) analysis flow. Please refer to tutorial 4.2 for the suggested
method. As illustrated, the methods are equivalent, but the advanced method allows you to directly override some renderer-specific settings.
Select the analysis you intend to run from the qiskit_metal.analyses
collection. Select the design to analyze and the tool to use for any external simulation.
[4]:
from qiskit_metal.analyses.quantization import EPRanalysis
eig_qres = EPRanalysis(design, "hfss")
For the Eigenmode simulation portion, you can either: 1. Use the eig_qres
user-friendly methods (see tutorial 4.2) 2. Control directly the simulation tool from the tool’s GUI (outside metal - see specific vendor instructions) 3. Use the renderer methods In this section we show the advanced method (method 3).
The renderer can be reached from the analysis class. Let’s give it a shorter alias.
[5]:
hfss = eig_qres.sim.renderer
Now we connect to the tool using the unified command.
[6]:
hfss.start()
INFO 09:29AM [connect_project]: Connecting to Ansys Desktop API...
INFO 09:29AM [load_ansys_project]: Opened Ansys App
INFO 09:29AM [load_ansys_project]: Opened Ansys Desktop v2020.2.0
INFO 09:29AM [load_ansys_project]: Opened Ansys Project
Folder: C:/Ansoft/
Project: Project23
INFO 09:29AM [connect_design]: No active design found (or error getting active design).
INFO 09:29AM [connect]: Connected to project "Project23". No design detected
[6]:
True
The previous command is supposed to open ansys (if closed), create a new project and finally connect this notebook to it.
If for any reason the previous cell failed, please try the manual path described in the next three cells: 1. uncomment and execute only one of the lines in the first cell. 1. uncomment and execute the second cell. 1. uncomment and execute only one of the lines in the third cell.
[7]:
# hfss.open_ansys() # this opens Ansys 2021 R2 if present
# hfss.open_ansys(path_var='ANSYSEM_ROOT211')
# hfss.open_ansys(path='C:\Program Files\AnsysEM\AnsysEM21.1\Win64')
# hfss.open_ansys(path='../../../Program Files/AnsysEM/AnsysEM21.1/Win64')
[8]:
# hfss.new_ansys_project()
[9]:
# hfss.connect_ansys()
# hfss.connect_ansys('C:\\project_path\\', 'Project1') # will open a saved project before linking the Jupyter session
Create and activate an eigenmode design called “TransmonReadout”.
[10]:
hfss.activate_ansys_design("TransmonReadout", 'eigenmode') # use new_ansys_design() to force creation of a blank design
09:29AM 17s WARNING [activate_ansys_design]: The design_name=TransmonReadout was not in active project. Designs in active project are:
[]. A new design will be added to the project.
INFO 09:29AM [connect_design]: Opened active design
Design: TransmonReadout [Solution type: Eigenmode]
WARNING 09:29AM [connect_setup]: No design setup detected.
WARNING 09:29AM [connect_setup]: Creating eigenmode default setup.
INFO 09:29AM [get_setup]: Opened setup `Setup` (<class 'pyEPR.ansys.HfssEMSetup'>)
Render everything inlcuding the qubit and resonator in Metal, to “TransmonReadout” design in Ansys.
[11]:
hfss.render_design(['Q1', 'readout', 'open_to_ground'], [])
hfss.save_screenshot()
[11]:
WindowsPath('C:/workspace/qiskit-metal/docs/tut/4-Analysis/ansys.png')
Set the convergence parameters and junction properties in the Ansys design. Then run the analysis and plot the convergence.
Note that we seek 2 eigenmodes - one with stronger fields near the transmon, the other with stronger fields near the resonator.
[12]:
# Analysis properties
setup = hfss.pinfo.setup
setup.n_modes = 2
setup.passes = 10
print(f"""
Number of eigenmodes to find = {setup.n_modes}
Number of simulation passes = {setup.passes}
Convergence freq max delta percent diff = {setup.delta_f}
""")
pinfo = hfss.pinfo
pinfo.design.set_variable('Lj', '10 nH')
pinfo.design.set_variable('Cj', '0 fF')
setup.analyze()
INFO 09:29AM [analyze]: Analyzing setup Setup
Number of eigenmodes to find = 2
Number of simulation passes = 10
Convergence freq max delta percent diff = 0.1
To plot the results you can use the plot_convergences()
method from the eig_qres.sim
object. The method will read the data from the variables local to the eig_qres.sim
object, so we first need to assign the simulation results to these two variables. let’s do both (assignment and plotting) in the next cell.
[13]:
eig_qres.sim.convergence_t, eig_qres.sim.convergence_f, _ = hfss.get_convergences()
eig_qres.sim.plot_convergences()
09:31AM 32s INFO [get_f_convergence]: Saved convergences to C:\orkspace\qiskit-metal\docs\tut\4-Analysis\hfss_eig_f_convergence.csv
Display the Ansys modeler window and plot the E-field on the chip’s surface.
[14]:
hfss.modeler._modeler.ShowWindow()
hfss.plot_fields('main')
hfss.save_screenshot()
Delete the newly created E-field plot before moving on.
[15]:
hfss.clear_fields(['Mag_E1'])
To look at the second eigenmode created, we use the following command, and then plot the corresponding E-field.
[16]:
hfss.set_mode(2, "Setup")
INFO 09:31AM [get_setup]: Opened setup `Setup` (<class 'pyEPR.ansys.HfssEMSetup'>)
[17]:
hfss.modeler._modeler.ShowWindow()
hfss.plot_fields('main')
hfss.save_screenshot()
[17]:
WindowsPath('C:/workspace/qiskit-metal/docs/tut/4-Analysis/ansys.png')
We delete this design to prepare for further analysis.
[18]:
hfss.clear_fields(['Mag_E1'])
In the suggested
(tutorial 4.2) flow, we would now prepare the setup using eig_qres.setup
and run the analysis with eig_qres.run_epr()
. Notice that this method requires previous set of the eig_qres
variables convergence_t
and convergence_f
like we did a thee cells earlier.
However we here exemplify the advanced approach, which is Ansys-specific since it uses the pyEPR module methods directly. #### Setup Identify the non-linear (Josephson) junctions in the model. You will need to list the junctions in the epr setup.
In this case there’s only one junction, namely ‘jj’. Let’s see what we need to change in the default setup.
[19]:
pinfo = hfss.pinfo
pinfo.junctions['jj'] = {'Lj_variable': 'Lj', 'rect': 'JJ_rect_Lj_Q1_rect_jj',
'line': 'JJ_Lj_Q1_rect_jj_', 'Cj_variable': 'Cj'}
pinfo.validate_junction_info() # Check that valid names of variables and objects have been supplied
pinfo.dissipative['dielectrics_bulk'] = ['main'] # Dissipative elements: specify
Execute microwave analysis on eigenmode solutions.
[20]:
eprd = epr.DistributedAnalysis(pinfo)
Design "TransmonReadout" info:
# eigenmodes 2
# variations 1
Find the electric and magnetic energy stored in the substrate and the system as a whole.
[21]:
ℰ_elec = eprd.calc_energy_electric()
ℰ_elec_substrate = eprd.calc_energy_electric(None, 'main')
ℰ_mag = eprd.calc_energy_magnetic()
print(f"""
ℰ_elec_all = {ℰ_elec}
ℰ_elec_substrate = {ℰ_elec_substrate}
EPR of substrate = {ℰ_elec_substrate / ℰ_elec * 100 :.1f}%
ℰ_mag_all = {ℰ_mag}
ℰ_mag % of ℰ_elec_all = {ℰ_mag / ℰ_elec * 100 :.1f}%
""")
ℰ_elec_all = 3.26471284274784e-24
ℰ_elec_substrate = 2.97883438844215e-24
EPR of substrate = 91.2%
ℰ_mag_all = 3.25556453337484e-24
ℰ_mag % of ℰ_elec_all = 99.7%
Perform EPR analysis for all modes and variations.
[22]:
eprd.do_EPR_analysis()
# 4a. Perform Hamiltonian spectrum post-analysis, building on mw solutions using EPR
epra = epr.QuantumAnalysis(eprd.data_filename)
epra.analyze_all_variations(cos_trunc = 8, fock_trunc = 7)
# 4b. Report solved results
swp_variable = 'Lj' # suppose we swept an optimetric analysis vs. inductance Lj_alice
epra.plot_hamiltonian_results(swp_variable=swp_variable)
epra.report_results(swp_variable=swp_variable, numeric=True)
Variation 0 [1/1]
Mode 0 at 6.15 GHz [1/2]
Calculating ℰ_magnetic,ℰ_electric
(ℰ_E-ℰ_H)/ℰ_E ℰ_E ℰ_H
99.2% 2.265e-24 1.798e-26
Calculating junction energy participation ration (EPR)
method=`line_voltage`. First estimates:
junction EPR p_0j sign s_0j (p_capacitive)
Energy fraction (Lj over Lj&Cj)= 97.10%
jj 0.991637 (+) 0.0296031
(U_tot_cap-U_tot_ind)/mean=1.48%
Calculating Qdielectric_main for mode 0 (0/1)
p_dielectric_main_0 = 0.9140622276689435
Mode 1 at 9.35 GHz [2/2]
Calculating ℰ_magnetic,ℰ_electric
(ℰ_E-ℰ_H)/ℰ_E ℰ_E ℰ_H
0.3% 1.632e-24 1.628e-24
Calculating junction energy participation ration (EPR)
method=`line_voltage`. First estimates:
junction EPR p_1j sign s_1j (p_capacitive)
Energy fraction (Lj over Lj&Cj)= 93.54%
jj 0.0028119 (+) 0.000194101
(U_tot_cap-U_tot_ind)/mean=0.01%
Calculating Qdielectric_main for mode 1 (1/1)
p_dielectric_main_1 = 0.9124338133013002
WARNING 09:31AM [__init__]: <p>Error: <class 'IndexError'></p>
ANALYSIS DONE. Data saved to:
C:\data-pyEPR\Project23\TransmonReadout\2021-07-20 09-31-40.npz
Differences in variations:
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Variation 0
Starting the diagonalization
Finished the diagonalization
Pm_norm=
modes
0 1.03016
1 1.03288
dtype: float64
Pm_norm idx =
jj
0 True
1 False
*** P (participation matrix, not normlz.)
jj
0 0.963126
1 0.002811
*** S (sign-bit matrix)
s_jj
0 1
1 1
*** P (participation matrix, normalized.)
0.99
0.0028
*** Chi matrix O1 PT (MHz)
Diag is anharmonicity, off diag is full cross-Kerr.
285 2.45
2.45 0.00528
*** Chi matrix ND (MHz)
316 2.11
2.11 0.00393
*** Frequencies O1 PT (MHz)
0 5863.051538
1 9348.912585
dtype: float64
*** Frequencies ND (MHz)
0 5848.062275
1 9348.956927
dtype: float64
*** Q_coupling
Empty DataFrame
Columns: []
Index: [0, 1]
Mode frequencies (MHz)#
Numerical diagonalization
Lj | 10 |
---|---|
eigenmode | |
0 | 5863.05 |
1 | 9348.91 |
Kerr Non-linear coefficient table (MHz)#
Numerical diagonalization
0 | 1 | ||
---|---|---|---|
Lj | |||
10 | 0 | 316.47 | 2.11e+00 |
1 | 2.11 | 3.93e-03 |
Release Ansys session
[23]:
eig_qres.sim.close()
3. Analyze the transmon using the LOM method#
In this section we will use a semi-manual (advanced) analysis flow. Please refer to tutorial 4.1 for the suggested
method. As illustrated, the methods are equivalent, but the advanced method allows you to directly override some renderer-specific settings.
Select the analysis you intend to run from the qiskit_metal.analyses
collection. Select the design to analyze and the tool to use for any external simulation.
[24]:
from qiskit_metal.analyses.quantization import LOManalysis
c2 = LOManalysis(design, "q3d")
For the capacitive simulation portion, you can either: 1. Use the c2
user-friendly methods (see tutorial 4.1) 2. Control directly the simulation tool from the tool’s GUI (outside metal - see specific vendor instructions) 3. Use the renderer methods In this section we show the advanced method (method 3).
The renderer can be reached from the analysis class. Let’s give it a shorter alias.
[25]:
q3d = c2.sim.renderer
Now we connect to the simulation tool, similarly to what we have done for the eigenmode analysis.
[26]:
q3d.start()
INFO 09:31AM [connect_project]: Connecting to Ansys Desktop API...
INFO 09:31AM [load_ansys_project]: Opened Ansys App
INFO 09:31AM [load_ansys_project]: Opened Ansys Desktop v2020.2.0
INFO 09:31AM [load_ansys_project]: Opened Ansys Project
Folder: C:/Ansoft/
Project: Project23
INFO 09:31AM [connect_design]: Opened active design
Design: TransmonReadout [Solution type: Eigenmode]
INFO 09:31AM [get_setup]: Opened setup `Setup` (<class 'pyEPR.ansys.HfssEMSetup'>)
INFO 09:31AM [connect]: Connected to project "Project23" and design "TransmonReadout" 😀
[26]:
True
If the simulator is already open, the line above will simply connect to the open session, project and design.
Create and activate a q3d design called “TransmonResonator_q3d”.
[27]:
q3d.activate_ansys_design("TransmonResonator_q3d", 'capacitive')
09:31AM 53s WARNING [activate_ansys_design]: The design_name=TransmonResonator_q3d was not in active project. Designs in active project are:
['TransmonReadout']. A new design will be added to the project.
INFO 09:31AM [connect_design]: Opened active design
Design: TransmonResonator_q3d [Solution type: Q3D]
WARNING 09:31AM [connect_setup]: No design setup detected.
WARNING 09:31AM [connect_setup]: Creating Q3D default setup.
INFO 09:31AM [get_setup]: Opened setup `Setup` (<class 'pyEPR.ansys.AnsysQ3DSetup'>)
Next, we render the exisitng design to Ansys Q3D for analysis. To ensure that the readout is insulated from the ground plane, we set the ‘readout’ pin of Q1 to have an open termination.
[28]:
q3d.render_design(['Q1'], [('Q1','readout')])
Execute the capacitance extraction and verify converengence. This cell analyzes the default setup.
[29]:
q3d.analyze_setup("Setup")
INFO 09:31AM [get_setup]: Opened setup `Setup` (<class 'pyEPR.ansys.AnsysQ3DSetup'>)
INFO 09:31AM [analyze]: Analyzing setup Setup
This simulation had 4 nets, the two charge islands of the floating transmon, the readout coupler, and the ground, resulting in a 4x4 capacitance matrix. Output is of type DataFrame.
[30]:
c2.sim.capacitance_matrix, c2.sim.units = q3d.get_capacitance_matrix()
c2.sim.capacitance_all_passes, _ = q3d.get_capacitance_all_passes()
c2.sim.capacitance_matrix
INFO 09:32AM [get_matrix]: Exporting matrix data to (C:\Temp\tmpgmpsvgo8.txt, C, , Setup:LastAdaptive, "Original", "ohm", "nH", "fF", "mSie", 5000000000, Maxwell, 1, False
INFO 09:32AM [get_matrix]: Exporting matrix data to (C:\Temp\tmpz049gek3.txt, C, , Setup:AdaptivePass, "Original", "ohm", "nH", "fF", "mSie", 5000000000, Maxwell, 1, False
INFO 09:32AM [get_matrix]: Exporting matrix data to (C:\Temp\tmpysoqm_6d.txt, C, , Setup:AdaptivePass, "Original", "ohm", "nH", "fF", "mSie", 5000000000, Maxwell, 2, False
INFO 09:32AM [get_matrix]: Exporting matrix data to (C:\Temp\tmpv2h1z335.txt, C, , Setup:AdaptivePass, "Original", "ohm", "nH", "fF", "mSie", 5000000000, Maxwell, 3, False
INFO 09:32AM [get_matrix]: Exporting matrix data to (C:\Temp\tmp0cuysu42.txt, C, , Setup:AdaptivePass, "Original", "ohm", "nH", "fF", "mSie", 5000000000, Maxwell, 4, False
INFO 09:32AM [get_matrix]: Exporting matrix data to (C:\Temp\tmpxnx4dazy.txt, C, , Setup:AdaptivePass, "Original", "ohm", "nH", "fF", "mSie", 5000000000, Maxwell, 5, False
INFO 09:32AM [get_matrix]: Exporting matrix data to (C:\Temp\tmpx6ds_mq3.txt, C, , Setup:AdaptivePass, "Original", "ohm", "nH", "fF", "mSie", 5000000000, Maxwell, 6, False
INFO 09:32AM [get_matrix]: Exporting matrix data to (C:\Temp\tmpms7chozp.txt, C, , Setup:AdaptivePass, "Original", "ohm", "nH", "fF", "mSie", 5000000000, Maxwell, 7, False
INFO 09:32AM [get_matrix]: Exporting matrix data to (C:\Temp\tmp1a6a4p1r.txt, C, , Setup:AdaptivePass, "Original", "ohm", "nH", "fF", "mSie", 5000000000, Maxwell, 8, False
INFO 09:32AM [get_matrix]: Exporting matrix data to (C:\Temp\tmpu63veyi5.txt, C, , Setup:AdaptivePass, "Original", "ohm", "nH", "fF", "mSie", 5000000000, Maxwell, 9, False
INFO 09:32AM [get_matrix]: Exporting matrix data to (C:\Temp\tmpzkorf9kt.txt, C, , Setup:AdaptivePass, "Original", "ohm", "nH", "fF", "mSie", 5000000000, Maxwell, 10, False
[30]:
ground_main_plane | pad_bot_Q1 | pad_top_Q1 | readout_connector_pad_Q1 | |
---|---|---|---|---|
ground_main_plane | 177.78538 | -44.74611 | -38.34722 | -37.03041 |
pad_bot_Q1 | -44.74611 | 82.84141 | -32.48515 | -2.30760 |
pad_top_Q1 | -38.34722 | -32.48515 | 93.38943 | -19.67329 |
readout_connector_pad_Q1 | -37.03041 | -2.30760 | -19.67329 | 60.14998 |
Now we provide the junction lumped element values, and complete the analysis by plotting the convergence. This is the same steps used in the suggested
flow from tutorial 4.1.
[31]:
c2.setup.junctions=Dict(Lj=12.31, Cj=2)
c2.setup.freq_readout = 7.0
c2.setup.freq_bus = []
c2.run_lom()
c2.lumped_oscillator_all
[1, 2] [3]
Predicted Values
Transmon Properties
f_Q 5.492369 [GHz]
EC 320.340887 [MHz]
EJ 13.273404 [GHz]
alpha -374.552102 [MHz]
dispersion 58.767574 [KHz]
Lq 12.305036 [nH]
Cq 60.467548 [fF]
T1 47.110126 [us]
**Coupling Properties**
tCqbus1 -7.535751 [fF]
gbus1_in_MHz -119.111599 [MHz]
χ_bus1 -3.815566 [MHz]
1/T1bus1 3378.359561 [Hz]
T1bus1 47.110126 [us]
Bus-Bus Couplings
[31]:
fQ | EC | EJ | alpha | dispersion | gbus | chi_in_MHz | χr MHz | gr MHz | |
---|---|---|---|---|---|---|---|---|---|
1 | 5.848645 | 366.675723 | 13.273404 | -435.120535 | 183.838223 | [-120.91915969031888] | [-7.045838787793941] | 7.045839 | 120.919160 |
2 | 5.800484 | 360.198673 | 13.273404 | -426.554207 | 158.894188 | [-112.57027192270645] | [-5.610759520303708] | 5.610760 | 112.570272 |
3 | 5.728978 | 350.706154 | 13.273404 | -414.05886 | 127.373567 | [-114.4721344200509] | [-5.135837723457538] | 5.135838 | 114.472134 |
4 | 5.645726 | 339.839946 | 13.273404 | -399.840701 | 97.757395 | [-113.75236108111946] | [-4.422671613573481] | 4.422672 | 113.752361 |
5 | 5.574615 | 330.715418 | 13.273404 | -387.971176 | 77.483483 | [-115.42485160814473] | [-4.067027529550902] | 4.067028 | 115.424852 |
6 | 5.552051 | 327.850119 | 13.273404 | -384.256913 | 71.883362 | [-116.90656488361248] | [-4.027920633490058] | 4.027921 | 116.906565 |
7 | 5.522295 | 324.093652 | 13.273404 | -379.396816 | 65.050231 | [-118.53068129631139] | [-3.9548493935622147] | 3.954849 | 118.530681 |
8 | 5.508895 | 322.410099 | 13.273404 | -377.222089 | 62.166575 | [-118.93049750280109] | [-3.9007913880708722] | 3.900791 | 118.930498 |
9 | 5.492369 | 320.340887 | 13.273404 | -374.552102 | 58.767574 | [-119.11159900747404] | [-3.8155660691691082] | 3.815566 | 119.111599 |
And plot the convergence.
[32]:
c2.plot_convergence();
c2.plot_convergence_chi()
Design "TransmonResonator_q3d" info:
# eigenmodes 0
# variations 1
INFO 09:32AM [hfss_report_full_convergence]: Creating report for variation 0
Release the simulator and close the analysis.
[33]:
c2.sim.close()
(optional) close the GUI.
[34]:
# gui.main_window.close()
For more information, review the Introduction to Quantum Computing and Quantum Hardware lectures below
|
Lecture Video | Lecture Notes | Lab |
|
Lecture Video | Lecture Notes | Lab |
|
Lecture Video | Lecture Notes | Lab |
|
Lecture Video | Lecture Notes | Lab |
|
Lecture Video | Lecture Notes | Lab |
|
Lecture Video | Lecture Notes | Lab |