<jupyter_start><jupyter_text>Impedence (Z) Analysis PrerequisiteYou must have a working local installation of Ansys.<jupyter_code>%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<jupyter_output><empty_output><jupyter_text>Create the design in MetalSet up a design of a given dimension. Dimensions will be respected in the design rendering. Note that the design will be centered in the origin, will thus equally extend in all quadrants.<jupyter_code>design = designs.DesignPlanar({}, True)
design.chips.main.size['size_x'] = '2mm'
design.chips.main.size['size_y'] = '2mm'
hfss = design.renderers.hfss

gui = MetalGUI(design)<jupyter_output><empty_output><jupyter_text>Create a single transmon with one readout resonator. It will show in the center of the previously defined chip.<jupyter_code>from qiskit_metal.qlibrary.qubits.transmon_pocket import TransmonPocket

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')
    )))

gui.rebuild()
gui.autoscale()<jupyter_output><empty_output><jupyter_text>Connect to AnsysOpen a new Ansys window (wait for it to open before you execute any other cell). Skip this cell if you already have it open<jupyter_code>hfss.open_ansys()<jupyter_output><empty_output><jupyter_text>After Ansys opens, connect to it and add a driven modal design called SingleTransmon. The design will appear in the active project.<jupyter_code>hfss.connect_ansys()
hfss.add_drivenmodal_design("SingleTransmon")<jupyter_output><empty_output><jupyter_text>Setup Ansys to run the Analysis on the SingleTransmon designHere, pin Q1_a is converted into a lumped port with an impedance of 70 Ohms. Meanwhile, the central junction Q1_rect_jj is rendered as both a port and an inductor with an impedance of 50 Ohms and an inductance of 10 nH, respectively.Here for reference the list of arguments to renderer_design():* First parameter: List of components to render (empty list if rendering whole Metal design)* Second parameter: List of pins (qcomp, pin) with open endcaps* Third parameter: List of pins (qcomp, pin, impedance) to render as lumped ports* Fourth parameter: List of junctions (qcomp, elt, impedance, draw_ind) to render as lumped ports* Fifth parameter: List of junctions (qcomp, elt) to omit altogether during rendering* Sixth parameter: Whether to render chip via box plus buffer or fixed chip size<jupyter_code>hfss.render_design([], [], [('Q1', 'readout', 70)], [('Q1', 'rect_jj', 50, True)], [], box_plus_buffer=False)
hfss.save_screenshot()<jupyter_output><empty_output><jupyter_text>Add a new driven modal simulation setup called NewSetup to the SingleTransmon design.Here for reference all the customizable parameters and their default values in add_drivenmodal_setup():* freq_ghz=5 (simulation frequency)* name="Setup" (setup name)* max_delta_s=0.1 (absolute value of maximum difference in scattering parameter S)* max_passes=10 (maximum number of passes)* min_passes=1 (minimum number of passes)* min_converged=1 (minimum number of converged passes)* pct_refinement=30 (percent refinement)* basis_order=1 (basis order)<jupyter_code>hfss.add_drivenmodal_setup(name="NewSetup", max_passes=30)<jupyter_output><empty_output><jupyter_text>Verify that the currently active project, design, and setup names are correct.<jupyter_code>print(f"""
project_name = {hfss.pinfo.project_name}
design_name  = {hfss.pinfo.design_name}
setup_name   = {hfss.pinfo.setup_name}
""")<jupyter_output><empty_output><jupyter_text>Next, add a frequency sweep called NewSweep to the NewSetup setup.Here for reference all the customizable parameters and their default values in add_sweep():* setup_name="Setup" (name of setup)* start_ghz=2.0 (starting frequency)* stop_ghz=8.0 (stopping frequency)* count=101 (total number of frequencies)* step_ghz=None (frequency step size)* name="Sweep" (name of sweep)* type="Fast" (type of sweep)* save_fields=False (whether or not to save fields)<jupyter_code>hfss.add_sweep(setup_name="NewSetup", name="NewSweep", stop_ghz=13)<jupyter_output><empty_output><jupyter_text>Execute the analysis and plot the results<jupyter_code>hfss.analyze_sweep('NewSweep', 'NewSetup')<jupyter_output><empty_output><jupyter_text>Plot the various parameters<jupyter_code>hfss.plot_params(['Z11', 'Z21']);
hfss.plot_params(['Y11', 'Y21']);
hfss.plot_params(['S11', 'S21', 'S22']);<jupyter_output><empty_output><jupyter_text>Finally, disconnect from Ansys<jupyter_code>hfss.disconnect_ansys()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09719586759434956, 'fraction_numerical': 0.013704406493780307, 'mean_word_length': 7.352112676056338, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '12', 'dir': 'jupyter-structured-clean-dedup', 'id': '177646', 'license': 'Apache-2.0', 'n_tokens_mistral': 1558, 'n_tokens_neox': 1487, 'n_words': 468, 'path': 'tutorials/4 Analysis/A. Core - EM and quantization/4.3 Impedance.ipynb', 'repo_name': 'sarafs1926/qiskit-metal', 'size': '4743'}