{ "cells": [ { "cell_type": "markdown", "id": "15662415", "metadata": {}, "source": [ "## Qubit Coupled to a resonator\n", "\n", " The first structure we want to analyze is the transmon qubit coupled to a $\\lambda /2$ resonator, we'll consider the structure presented [**here**](https://qiskit-community.github.io/qiskit-metal/tut/4-Analysis/4.13-Analyze-transmon-and-resonator.html) and we'll compare the result obtained with QuLTRA and ANSYS\n", "\n", " **Note**: $\\lambda/2$ resonators have an open end. To model this aspect on QuLTRA we can both leave the node opne or terminated it on a very small capacitance\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "df8ac9fc", "metadata": {}, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2\n", "\n", "import qiskit_metal as metal\n", "from qiskit_metal import designs, draw\n", "from qiskit_metal import MetalGUI, Dict, Headings\n", "import pyEPR as epr" ] }, { "cell_type": "code", "execution_count": 2, "id": "48d7948a", "metadata": {}, "outputs": [], "source": [ "design = designs.DesignPlanar({}, True)\n", "design.chips.main.size['size_x'] = '2mm'\n", "design.chips.main.size['size_y'] = '2mm'\n", "\n", "\n", "gui = MetalGUI(design)" ] }, { "cell_type": "code", "execution_count": 3, "id": "dc77f2cc", "metadata": {}, "outputs": [], "source": [ "from qiskit_metal.qlibrary.qubits.transmon_pocket import TransmonPocket\n", "from qiskit_metal.qlibrary.terminations.open_to_ground import OpenToGround\n", "from qiskit_metal.qlibrary.tlines.meandered import RouteMeander\n", "\n", "design.delete_all_components()\n", "\n", "q1 = TransmonPocket(design, 'Q1', options = dict(\n", " pad_width = '425 um',\n", " pocket_height = '650um',\n", " hfss_inductance='12.31nH',\n", " connection_pads=dict(\n", " readout = dict(loc_W=+1,loc_H=+1, pad_width='200um')\n", " )))\n", "otg = OpenToGround(design, 'open_to_ground', options=dict(pos_x='1.75mm', pos_y='0um', orientation='0'))\n", "readout = RouteMeander(design, 'readout', Dict(\n", " total_length='6 mm',\n", " hfss_wire_bonds = True,\n", " fillet='90 um',\n", " lead = dict(start_straight='100um'),\n", " pin_inputs=Dict(\n", " start_pin=Dict(component='Q1', pin='readout'),\n", " end_pin=Dict(component='open_to_ground', pin='open')), ))\n", "\n", "gui.rebuild()\n", "gui.autoscale()" ] }, { "cell_type": "code", "execution_count": 14, "id": "58160f18", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO 07:42PM [connect_project]: Connecting to Ansys Desktop API...\n", "INFO 07:42PM [load_ansys_project]: \tOpened Ansys App\n", "INFO 07:42PM [load_ansys_project]: \tOpened Ansys Desktop v2022.2.0\n", "INFO 07:42PM [load_ansys_project]: \tOpened Ansys Project\n", "\tFolder: C:/Users/simona.zaccaria4/Documents/Ansoft/\n", "\tProject: Project38\n", "INFO 07:42PM [connect_design]: \tOpened active design\n", "\tDesign: Design_hfss [Solution type: Eigenmode]\n", "INFO 07:42PM [get_setup]: \tOpened setup `Setup` ()\n", "INFO 07:42PM [connect]: \tConnected to project \"Project38\" and design \"Design_hfss\" 😀 \n", "\n", "INFO 07:42PM [connect_design]: \tOpened active design\n", "\tDesign: Design_q3d [Solution type: Q3D]\n", "INFO 07:42PM [get_setup]: \tOpened setup `Setup` ()\n", "INFO 07:42PM [analyze]: Analyzing setup Setup\n", "INFO 07:43PM [get_matrix]: Exporting matrix data to (C:\\Users\\SIMONA~1.ZAC\\AppData\\Local\\Temp\\tmp1lq3b2uq.txt, C, , Setup:LastAdaptive, \"Original\", \"ohm\", \"nH\", \"fF\", \"mSie\", 5000000000, Maxwell, 1, False\n", "INFO 07:43PM [get_matrix]: Exporting matrix data to (C:\\Users\\SIMONA~1.ZAC\\AppData\\Local\\Temp\\tmp7re0czcr.txt, C, , Setup:AdaptivePass, \"Original\", \"ohm\", \"nH\", \"fF\", \"mSie\", 5000000000, Maxwell, 1, False\n", "INFO 07:43PM [get_matrix]: Exporting matrix data to (C:\\Users\\SIMONA~1.ZAC\\AppData\\Local\\Temp\\tmpixi_h1w5.txt, C, , Setup:AdaptivePass, \"Original\", \"ohm\", \"nH\", \"fF\", \"mSie\", 5000000000, Maxwell, 2, False\n", "INFO 07:43PM [get_matrix]: Exporting matrix data to (C:\\Users\\SIMONA~1.ZAC\\AppData\\Local\\Temp\\tmpjgt8d6lq.txt, C, , Setup:AdaptivePass, \"Original\", \"ohm\", \"nH\", \"fF\", \"mSie\", 5000000000, Maxwell, 3, False\n", "INFO 07:43PM [get_matrix]: Exporting matrix data to (C:\\Users\\SIMONA~1.ZAC\\AppData\\Local\\Temp\\tmply4eecdr.txt, C, , Setup:AdaptivePass, \"Original\", \"ohm\", \"nH\", \"fF\", \"mSie\", 5000000000, Maxwell, 4, False\n", "INFO 07:43PM [get_matrix]: Exporting matrix data to (C:\\Users\\SIMONA~1.ZAC\\AppData\\Local\\Temp\\tmpzoeu7eb3.txt, C, , Setup:AdaptivePass, \"Original\", \"ohm\", \"nH\", \"fF\", \"mSie\", 5000000000, Maxwell, 5, False\n", "INFO 07:43PM [get_matrix]: Exporting matrix data to (C:\\Users\\SIMONA~1.ZAC\\AppData\\Local\\Temp\\tmpldvmpus8.txt, C, , Setup:AdaptivePass, \"Original\", \"ohm\", \"nH\", \"fF\", \"mSie\", 5000000000, Maxwell, 6, False\n", "INFO 07:43PM [get_matrix]: Exporting matrix data to (C:\\Users\\SIMONA~1.ZAC\\AppData\\Local\\Temp\\tmpg9mvmnc1.txt, C, , Setup:AdaptivePass, \"Original\", \"ohm\", \"nH\", \"fF\", \"mSie\", 5000000000, Maxwell, 7, False\n", "INFO 07:43PM [get_matrix]: Exporting matrix data to (C:\\Users\\SIMONA~1.ZAC\\AppData\\Local\\Temp\\tmpymvsb8b5.txt, C, , Setup:AdaptivePass, \"Original\", \"ohm\", \"nH\", \"fF\", \"mSie\", 5000000000, Maxwell, 8, False\n", "INFO 07:43PM [get_matrix]: Exporting matrix data to (C:\\Users\\SIMONA~1.ZAC\\AppData\\Local\\Temp\\tmpkh447lai.txt, C, , Setup:AdaptivePass, \"Original\", \"ohm\", \"nH\", \"fF\", \"mSie\", 5000000000, Maxwell, 9, False\n", "INFO 07:43PM [get_matrix]: Exporting matrix data to (C:\\Users\\SIMONA~1.ZAC\\AppData\\Local\\Temp\\tmpftdn3uin.txt, C, , Setup:AdaptivePass, \"Original\", \"ohm\", \"nH\", \"fF\", \"mSie\", 5000000000, Maxwell, 10, False\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ground_main_planepad_bot_Q1pad_top_Q1readout_connector_pad_Q1
ground_main_plane177.78538-44.74611-38.34722-37.03041
pad_bot_Q1-44.7461182.84141-32.48515-2.30760
pad_top_Q1-38.34722-32.4851593.38943-19.67329
readout_connector_pad_Q1-37.03041-2.30760-19.6732960.14998
\n", "
" ], "text/plain": [ " ground_main_plane pad_bot_Q1 pad_top_Q1 \\\n", "ground_main_plane 177.78538 -44.74611 -38.34722 \n", "pad_bot_Q1 -44.74611 82.84141 -32.48515 \n", "pad_top_Q1 -38.34722 -32.48515 93.38943 \n", "readout_connector_pad_Q1 -37.03041 -2.30760 -19.67329 \n", "\n", " readout_connector_pad_Q1 \n", "ground_main_plane -37.03041 \n", "pad_bot_Q1 -2.30760 \n", "pad_top_Q1 -19.67329 \n", "readout_connector_pad_Q1 60.14998 " ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from qiskit_metal.analyses.quantization import LOManalysis\n", "c1=LOManalysis(design, \"q3d\")\n", "c1.sim.run(components=['Q1'], open_terminations=[('Q1','readout')])\n", "c1.sim.capacitance_matrix" ] }, { "cell_type": "code", "execution_count": 8, "id": "0532514e", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Warning! 6 COM references still alive\n", "Ansys will likely refuse to shut down\n" ] } ], "source": [ "c1.sim.close()" ] }, { "cell_type": "code", "execution_count": 3, "id": "e30599a6", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "+------+------------+----------+\n", "| Mode | Freq [GHz] | k [MHz] |\n", "+------+------------+----------+\n", "| 1 | 5.85e+00 | 0.00e+00 |\n", "| 2 | 9.34e+00 | 0.00e+00 |\n", "+------+------------+----------+\n", "Chi matrix [MHz]:\n", "+------+----------+----------+\n", "| Mode | 1 | 2 |\n", "+------+----------+----------+\n", "| 1 | 3.21e+02 | 1.93e+00 |\n", "| 2 | 1.93e+00 | 2.91e-03 |\n", "+------+----------+----------+\n" ] } ], "source": [ "import qultra as qu\n", "\n", "C_pad_bot=(82.84141-32.48515-2.30760)*1e-15 #capacitance of the bottom pad respect to ground\n", "C_pad_top=(93.38943-32.48515-19.67329)*1e-15 #capacitance of the top pad respect to ground\n", "C_pads=32.48515e-15 #capacitance between the two pads\n", "Cg_bot=2.30760e-15 #capacitance between the bottom pad and the coupling pad\n", "Cg_top=19.67329e-15 #capacitance between the top pad and the coupling pad\n", "Cg0=(60.14998-2.30760-19.67329)*1e-15 #capacitance between the coupling pad and ground\n", "Lj=12.31e-9 #inductance of the Josephson junction\n", "\n", "l=6e-3 #length of the CPW resonator\n", "\n", "net=[qu.C(0,1,C_pad_bot),qu.C(2,0,C_pad_top),qu.C(1,2,C_pads),qu.C(1,3,Cg_bot),qu.C(2,3,Cg_top),qu.C(3,0,Cg0),qu.J(1,2,Lj),qu.CPW(4,3,l)]#,qu.C(4,0,1e-25)]\n", "qubit_resonator=qu.QCircuit(net,5,10)\n", "\n", "qubit_resonator.show_all()" ] }, { "cell_type": "code", "execution_count": 9, "id": "2f4425f9", "metadata": {}, "outputs": [], "source": [ "from qiskit_metal.analyses.quantization import EPRanalysis\n", "eig_qb = EPRanalysis(design, \"hfss\")" ] }, { "cell_type": "code", "execution_count": 12, "id": "540786b4", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'name': 'Setup',\n", " 'reuse_selected_design': True,\n", " 'reuse_setup': True,\n", " 'min_freq_ghz': 1,\n", " 'n_modes': 2,\n", " 'max_delta_f': 0.1,\n", " 'max_passes': 12,\n", " 'min_passes': 1,\n", " 'min_converged': 1,\n", " 'pct_refinement': 30,\n", " 'basis_order': 1,\n", " 'vars': {'Lj': '12.31 nH', 'Cj': '0 fF'},\n", " 'run': {'name': None,\n", " 'components': ['Q1', 'readout'],\n", " 'open_terminations': [('readout', 'end')],\n", " 'port_list': [],\n", " 'jj_to_port': None,\n", " 'ignored_jjs': None,\n", " 'box_plus_buffer': True}}" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "eig_qb.sim.setup.max_passes = 12\n", "eig_qb.sim.setup.max_delta_f = 0.1\n", "eig_qb.sim.setup.min_freq_ghz=1\n", "eig_qb.sim.setup.n_modes = 2\n", "eig_qb.sim.setup.vars = Dict(Lj= '12.31 nH', Cj= '0 fF') \n", "\n", "eig_qb.sim.setup" ] }, { "cell_type": "code", "execution_count": 13, "id": "2d3c081b", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO 05:53PM [connect_design]: \tOpened active design\n", "\tDesign: Design_hfss [Solution type: Eigenmode]\n", "INFO 05:53PM [get_setup]: \tOpened setup `Setup` ()\n", "INFO 05:53PM [analyze]: Analyzing setup Setup\n", "05:56PM 54s INFO [get_f_convergence]: Saved convergences to c:\\Users\\simona.zaccaria4\\Desktop\\GitHub\\QuLTRA\\tutorial\\hfss_eig_f_convergence.csv\n" ] } ], "source": [ "eig_qb.sim.run(components=['Q1','readout'], open_terminations=[('readout','end')],port_list=[])" ] }, { "cell_type": "code", "execution_count": 12, "id": "610f8ba3", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'junctions': {'jj': {'rect': 'JJ_rect_Lj_Q1_rect_jj',\n", " 'line': 'JJ_Lj_Q1_rect_jj_',\n", " 'Lj_variable': 'Lj',\n", " 'Cj_variable': 'Cj'}},\n", " 'dissipatives': {'dielectrics_bulk': ['main']},\n", " 'cos_trunc': 8,\n", " 'fock_trunc': 7,\n", " 'sweep_variable': 'Lj'}" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "eig_qb.setup.junctions.jj = Dict(rect='JJ_rect_Lj_Q1_rect_jj', line='JJ_Lj_Q1_rect_jj_',\n", " Lj_variable='Lj', Cj_variable='Cj')\n", "eig_qb.setup" ] }, { "cell_type": "code", "execution_count": 13, "id": "e6d9a6f7", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Design \"Design_hfss\" info:\n", "\t# eigenmodes 2\n", "\t# variations 1\n", "Design \"Design_hfss\" info:\n", "\t# eigenmodes 2\n", "\t# variations 1\n", "\n", " energy_elec_all = 1.85420701261036e-24\n", " energy_elec_substrate = 1.69917553337127e-24\n", " EPR of substrate = 91.6%\n", "\n", " energy_mag = 1.85068391186877e-24\n", " energy_mag % of energy_elec_all = 99.8%\n", " \n", "\n", "Variation 0 [1/1]\n", "\n", " \u001b[1mMode 0 at 5.64 GHz [1/2]\u001b[0m\n", " Calculating â„°_magnetic,â„°_electric\n", " (â„°_E-â„°_H)/â„°_E â„°_E â„°_H\n", " 99.4% 2.139e-24 1.379e-26\n", "\n", " Calculating junction energy participation ration (EPR)\n", "\tmethod=`line_voltage`. First estimates:\n", "\tjunction EPR p_0j sign s_0j (p_capacitive)\n", "\t\tEnergy fraction (Lj over Lj&Cj)= 97.00%\n", "\tjj 0.992592 (+) 0.0307052\n", "\t\t(U_tot_cap-U_tot_ind)/mean=1.56%\n", "Calculating Qdielectric_main for mode 0 (0/1)\n", "p_dielectric_main_0 = 0.9194945926377162\n", "\n", " \u001b[1mMode 1 at 9.34 GHz [2/2]\u001b[0m\n", " Calculating â„°_magnetic,â„°_electric\n", " (â„°_E-â„°_H)/â„°_E â„°_E â„°_H\n", " 0.2% 9.271e-25 9.253e-25\n", "\n", " Calculating junction energy participation ration (EPR)\n", "\tmethod=`line_voltage`. First estimates:\n", "\tjunction EPR p_1j sign s_1j (p_capacitive)\n", "\t\tEnergy fraction (Lj over Lj&Cj)= 92.18%\n", "\tjj 0.00190362 (+) 0.000161566\n", "\t\t(U_tot_cap-U_tot_ind)/mean=0.01%\n", "Calculating Qdielectric_main for mode 1 (1/1)\n", "p_dielectric_main_1 = 0.9163893361503169\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "WARNING 04:41PM [__init__]:

Error:

\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "ANALYSIS DONE. Data saved to:\n", "\n", "C:\\data-pyEPR\\Project37\\Design_hfss\\2025-07-17 16-40-56.npz\n", "\n", "\n", "\t Differences in variations:\n", "\n", "\n", "\n", " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . \n", "Variation 0\n", "\n", "Starting the diagonalization\n", "Finished the diagonalization\n", "Pm_norm=\n", "modes\n", "0 1.031801\n", "1 1.041584\n", "dtype: float64\n", "\n", "Pm_norm idx =\n", " jj\n", "0 True\n", "1 False\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "WARNING:py.warnings:c:\\Users\\simona.zaccaria4\\.conda\\envs\\qiskit-metal\\Lib\\site-packages\\pyEPR\\core_quantum_analysis.py:711: FutureWarning: Support for multi-dimensional indexing (e.g. `obj[:, None]`) is deprecated and will be removed in a future version. Convert to a numpy array before indexing instead.\n", " result['Q_coupling'] = self.Qm_coupling[variation][self.Qm_coupling[variation].columns[junctions]][modes]#TODO change the columns to junctions\n", "\n", "WARNING:py.warnings:c:\\Users\\simona.zaccaria4\\.conda\\envs\\qiskit-metal\\Lib\\site-packages\\pyEPR\\core_quantum_analysis.py:716: FutureWarning: Support for multi-dimensional indexing (e.g. `obj[:, None]`) is deprecated and will be removed in a future version. Convert to a numpy array before indexing instead.\n", " result['Qs'] = self.Qs[variation][self.PM[variation].columns[junctions]][modes] #TODO change the columns to junctions\n", "\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "*** P (participation matrix, not normlz.)\n", " jj\n", "0 0.963022\n", "1 0.001903\n", "\n", "*** S (sign-bit matrix)\n", " s_jj\n", "0 1\n", "1 -1\n", "*** P (participation matrix, normalized.)\n", " 0.99\n", " 0.0019\n", "\n", "*** Chi matrix O1 PT (MHz)\n", " Diag is anharmonicity, off diag is full cross-Kerr.\n", " 296 1.88\n", " 1.88 0.00298\n", "\n", "*** Chi matrix ND (MHz) \n", " 333 1.69\n", " 1.69 0.00238\n", "\n", "*** Frequencies O1 PT (MHz)\n", "0 5344.782102\n", "1 9343.662915\n", "dtype: float64\n", "\n", "*** Frequencies ND (MHz)\n", "0 5326.965047\n", "1 9343.679300\n", "dtype: float64\n", "\n", "*** Q_coupling\n", "Empty DataFrame\n", "Columns: []\n", "Index: [0, 1]\n" ] }, { "data": { "text/markdown": [ "#### Mode frequencies (MHz)" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "###### Numerical diagonalization" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Lj12.31
05326.97
19343.68
\n", "
" ], "text/plain": [ "Lj 12.31\n", "0 5326.97\n", "1 9343.68" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "#### Kerr Non-linear coefficient table (MHz)" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [ "###### Numerical diagonalization" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
01
Lj
12.310332.931.69e+00
11.692.38e-03
\n", "
" ], "text/plain": [ " 0 1\n", "Lj \n", "12.31 0 332.93 1.69e+00\n", " 1 1.69 2.38e-03" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "eig_qb.run_epr()\n" ] }, { "cell_type": "code", "execution_count": null, "id": "7aa31bb6", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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", "version": "3.11.9" } }, "nbformat": 4, "nbformat_minor": 5 }