Quantum Metal Documentation

repository·main·Indexed 19 days ago

https://github.com/qiskit-community/qiskit-metal

An open-source framework for designing and analyzing superconducting quantum devices. Formerly known as Qiskit Metal, version 0.8.0 provides tools for chip design, a component library, and integration with simulation solvers. It supports multiple viewing interfaces: a static matplotlib viewer for headless environments, a Qt-based desktop GUI (MetalGUI), and a Jupyter-native widget GUI for notebooks.

Tokens
32.9K
Snippets
105
Records
148
Agent score
61%

What's inside Quantum Metal

  1. What is Quantum Metal and its core vision

    main

    Quantum Metal is an open-source chip-design layer for superconducting quantum hardware. It is a Python library designed to build chips from QComponents, attach analyses, and export results to various solvers, fabrication tools, or orchestrators.

    Key Characteristics:

    • Solver-agnostic: The core library does not depend on a specific solver; instead, it uses renderers as integration layers for tools like GDS, HFSS, Q3D, gmsh, Elmer, and AWS Palace.
    • Lite-by-default: The base installation is minimal and dependency-light. It does not assume the presence of heavy dependencies like Qt, AEDT, gmsh, or Palace. These are treated as opt-in extras.
    • Orchestration-friendly: Designed for use in AI-driven design loops (e.g., LLMs or optimization agents). The API is intended to be predictable, scriptable, and minimal, avoiding GUI prompts or hidden states.
  2. Overview of the Open FEM stack research

    main

    Quantum Metal is researching an open Finite Element Method (FEM) stack to provide an alternative to the Ansys HFSS/Q3D bridge, which requires an AEDT license. The goal is to enable HFSS-free CI validation and provide academic users with a free path to full-field analysis.

    The stack components include:

    • gmsh: A mesher (renderer_gmsh/) used for mesh generation and boundary tagging.
    • Elmer: An eigenmode solver (renderer_elmer/) for electromagnetic analysis.
    • AWS Palace: An open-source Maxwell solver supporting eigenmode, driven, and electrostatic analysis. A renderer_palace/ module is planned to follow the QRendererAnalysis protocol.
    • OpenEMS: A lightweight FEM option that is easier to build than Palace but has more limited capabilities.
  3. Implement custom QLibrary components

    main

    To create a custom component for the QLibrary, you must extend the base qlibrary component and override specific attributes and the make method.

    Required Attributes:

    • default_options: Default drawing options.
    • component_metadata: Metadata associated with the component.
    • options: A dictionary containing the component-designer-defined options.

    Required Method:

    • make(): This method implements the logic to generate geometry (such as polygons or paths) from the self.options dictionary. It must add these geometries to the design using self.add_qgeometry(...), ensuring necessary metadata like layer or subtract are included.
  4. Run Quantum Metal in headless environments (Colab, CI, or Linux without DISPLAY)

    main

    Quantum Metal supports a 'lite-by-default' mode that allows it to run in environments without a GUI (like Google Colab, Binder, or CI/CD pipelines).

    When running in these environments, the qm.gui(design) factory automatically detects the environment and uses MetalGUIHeadless to render designs as inline matplotlib figures instead of attempting to open a Qt/PySide6 window.

    You can explicitly force headless mode by setting the environment variable: QISKIT_METAL_HEADLESS=1

    export QISKIT_METAL_HEADLESS=1
  5. Contribute an EM solver backend

    main
    If you maintain or work with an open-source electromagnetic (EM) solver and want to integrate it as a first-class target in Quantum Metal, you must implement the renderer protocol. Documentation for this protocol can be found in docs/architecture/renderer_protocol.md.
  6. Transition from Qiskit Metal to Quantum Metal

    main

    The project is rebranding from Qiskit Metal to Quantum Metal.

    Key changes:

    • Package Name: The PyPI package is now quantum-metal. The old qiskit-metal package remains archived at its pre-v0.5 state.
    • Import Path: The Python import path is planned to change from qiskit_metal to quantum_metal. Currently, import qiskit_metal works but emits a FutureWarning.
    • Installation: v0.7.0+ defaults to a 'Lite' installation strategy.
  7. Understand the Metal GUI API structure

    main

    The qm.gui(design) function returns a MetalGui object, which is a subclass of ipywidgets.VBox.

    API Design Note:

    • The widget is the API. Because it inherits from VBox, you can use display(gui) directly in Jupyter to render the interface.
    • The object provides high-level methods for interaction, such as .select(), .refresh(), and .close().
    • Users should interact with these methods rather than attempting to manipulate the underlying widget tree directly.
  8. Implement custom QRenderers

    main

    When extending the base QRenderer to support a new external tool, you must implement the following interface:

    Required Attributes:

    • name: The name of the renderer.
    • element_extensions: A dictionary for element extensions.
    • element_table_data: Data used for the element table.

    Required Methods:

    • render_chips(): Renders all chips in the design by calling render_chip for each.
    • render_chip(chip): Renders a specific chip.
    • render_components(selection=None): Renders all components, or a specific selection if provided.
    • render_component(component): Renders a specific component.
    • render_element(element): Renders a specific element.
    • render_element_path(path): Renders an element path.
    • render_element_poly(poly): Renders an element polygon.
  9. Compare Quantum Metal viewers

    main

    Quantum Metal provides three distinct ways to view designs, depending on your environment and installation:

    ViewerInstallContext
    qm.view(design)base (no extra)Static matplotlib figure — scripts, CI, headless
    qm.MetalGUIquantum-metal[gui]Qt desktop GUI — Windows/macOS with display
    qm.gui(design)quantum-metal[notebook]Jupyter widget — Colab, Binder, JupyterHub, local

    Choose qm.gui if you are working in a web-based notebook environment where you cannot run a Qt-based desktop application.

  10. Understand the Quantum Metal Ecosystem and Workflow

    main

    Quantum Metal serves as the open-source chip-design layer for superconducting quantum hardware. It provides the foundation (QComponent library, QDesign objects, and renderer protocols) that other specialized tools use for simulation, quantization, and fabrication.

    A typical design workflow follows these steps:

    1. Discover: Find a candidate design using tools like SQuADDS (database search/interpolation) or hand-design using Quantum Metal's QComponent library.
    2. Build: Create a QDesign in Quantum Metal by instantiating QComponents, placing/routing them, and setting options.
    3. Simulate: Use a renderer to drive a simulation backend. Options include:
      • Ansys HFSS / Q3D (via [ansys] extra)
      • Open-FEM (via [mesh] extra + Elmer)
      • AWS Palace (via SQDMetal or pypalace)
    4. Analyse: Convert simulation results (fields, S-parameters, capacitance) into qubit physics using libraries like pyEPR (EPR quantization), scqubits (spectra/Hamiltonians), QuTiP (dynamics), or LOManalysis.
    5. Export: Export to GDS via the built-in QGDSRenderer for viewing in KLayout or for fabrication. For end-to-end lithography pipelines, see Qiskit-Metal-to-Litho.

    Users can also employ ML inverse design (e.g., ML_qubit_design) to predict QDesign parameters from target properties, bypassing expensive EM simulations.

  11. Understand the Qiskit Metal Architecture

    main

    Qiskit Metal is organized into several modular layers that work together to enable quantum circuit design, analysis, and visualization:

    • Core: The foundation. It includes QDesign (the central framework), QComponent (the base class for all components), QLibrary Components (predefined elements like qubits), QRoute (connection management), and BaseQubit.
    • GUI: The interaction layer. MetalGUI provides the main interface, including windows for elements (ElementsWindow), netlists (NetListWindow), component details (ComponentWidget), and logging (QTextEditLogger).
    • Renderers: The export layer. Uses QRenderer as a base to bridge designs to external electromagnetic simulation tools (e.g., QAnsysRenderer, QHFSSRenderer, QPyaedt, QGmshRenderer).
    • Analyses: The simulation layer. Tools like Hamiltonian for parameter calculation and Sweep_Options for parametric optimization.
    • Utilities: Supporting tools for Parsing, Exceptions, Logging, and a general Toolbox.
  12. Choose the appropriate Quantum Metal GUI

    main

    Quantum Metal provides three independent ways to interact with a design, depending on your runtime environment. Installing one does not affect the others.

    Entry pointExtraDescription
    qm.view(design)(base)Static matplotlib figure. Fast and headless. Best for scripts, CI, and simple rendering. Requires no extra dependencies.
    qm.MetalGUI[gui]Full Qt desktop GUI. Native Windows/macOS experience. Requires a display; will not work in Colab or Binder.
    qm.gui(design)[notebook]Jupyter widget GUI. Uses ipywidgets and ipympl. Works in any Jupyter-compatible environment (Colab, Binder, VS Code, etc.).

    Note: Do not use qm.gui() as a replacement for qm.view() or MetalGUI; they are intended for different contexts.

    import qiskit_metal as qm
    # For static rendering in scripts/CI
    qm.view(design)
    
    # For interactive Jupyter widgets
    qm.gui(design)
    
    # For full desktop application
    gui = qm.MetalGUI(design)