Building workflows with the IBM Circuit function
Building workflows with the IBM Circuit function
Estimated QPU usage: 26 minutes (tested on IBM Brisbane)
In this notebook, we will walk through an example of building and running a workflow using the IBM Circuit function. This function takes Primitive Unified Blocs (PUBs) as inputs and returns error-mitigated expectation values as outputs. It provides an automated and customized pipeline to optimize circuits and execute on quantum hardware so that researchers can focus on algorithm and application discovery.
Visit the documentation for an introduction to Qiskit Functions and learn how to get started with the IBM Circuit function.
Requirements
Before starting this tutorial, be sure you have the following installed:
- Qiskit SDK 1.2 or later (
pip install qiskit ) - Qiskit Runtime 0.28 or later (
pip install qiskit-ibm-runtime ) - IBM Qiskit Functions Catalog client 0.0.0 or later (
pip install qiskit-ibm-catalog ) - Qiskit Aer 0.15.0 or later (
pip install qiskit-aer )
Build the Qiskit pattern
We implement the example workflow using the Qiskit pattern as a guide. For this tutorial, we consider a general hardware-efficient Trotterized time evolution circuit for the 2D tranverse-field Ising model and compute the global magnetization. Such a circuit is useful in different application domains such as condensed matter physics, chemistry, machine learning etc. For more information on the structure of this model, refer to Nature 618, 500–505 (2023).
The IBM Circuit function combines capabilities from the Qiskit transpiler service and Qiskit Runtime Estimator to provide a simplified interface for running circuits. The function performs transpilation, error suppresion, error mitigation, and circuit execution within a single managed service so that we can focus on mapping the problem to circuits rather than building out each step of the pattern ourselves.
Step 1. Map classical inputs to a quantum problem
- Input: Parameters to create the quantum circuit
- Output: Abstract circuit and observables
Construct the circuit
The circuit we will create is a hardware-efficient, Trotterized time evolution circuit for the 2D transverse-field Ising model. We start with selecting a backend. Properties of this backend (i.e., its coupling map) will be used to define the quantum problem and ensure it is hardware-efficient.
No output produced
Next, we get the coupling map from the backend.
No output produced
We want to be careful in how we design the layers of our circuit. We will do this by coloring the edges of the coupling map (i.e., grouping the disjoint edges) and use that coloring to more efficiently place gates in the circuit. This will lead to a shallower circuit with layers of gates that can be executed simultaneously on the hardware.
No output produced
Next, we write a simple helper function that implements the hardware-efficient, Trotterized time evolution circuit for the 2D transverse-field Ising model using the edge coloring obtained above.
No output produced
We will choose the number of qubits and trotter steps and then construct the circuit.
Output: