Introducing IonQ Forte, The First Software-Configurable Quantum Computer

Learn more about our latest system

Using Native Gates with Qiskit

We’ve expanded access to the IonQ hardware-native gate set — previously only available to select research partners and customers — to anyone using the IonQ Quantum Cloud via an IonQ-provided API token, including those who access IonQ hardware through Google Cloud Marketplace. To allow users to build confidence and understanding in this new interface before they run jobs on QPUs, we’ve also expanded our quantum simulator service to enable simulations using the same native gate set.

We’ve also rolled out support for native gates to several open-source quantum software development kits, including Qiskit. This guide explains how to use native gates with Qiskit with a basic example.

We recommend reading our main Getting Started with Native Gates guide and our Get Started With Qiskit on IonQ Hardware guide as prerequisites to this guide.

WARNING: This is an advanced-level feature. Using the hardware-native gate interface without a thorough understanding of quantum circuits is likely to result in less-optimal circuit structure and worse algorithmic performance overall than using our abstract gate interface.

Using Native Gates in Qiskit

Native gates are supported as of v0.3.1 of the Qiskit IonQ Provider.

You can install it with pip
pip install qiskit-ionq==0.3.1

The gates themselves are also provided as part of the provider package:

# import utils
from qiskit import QuantumCircuit
from qiskit_ionq import IonQProvider
# import gates
from qiskit_ionq import GPIGate, GPI2Gate, MSGate

To add them to a circuit, use Qiskit’s circuit.append method:

# initialize a quantum circuit
circuit = QuantumCircuit(2,2)
# add gates
circuit.append(MSGate(0, 0), [0, 1])
circuit.append(GPIGate(0), [0])
circuit.append(GPI2Gate(1), [1])
circuit.draw()
     ┌──────────┐ ┌────────┐
q_0: ┤0         ├─┤ Gpi(0) ├─
     │ Ms(0,0)  │┌┴────────┤
q_1: ┤1         ├┤ Gpi2(1) ├─
     └──────────┘└─────────┘
c: 2/════════════════════════

Note that qiskit.circuit.QuantumCircuit.ms is an arbitrary-angle MS, which takes a different parameter signature and is therefore not equivalent to the IonQ Native MS gate.

Running on A Backend

To run on a backend using native gates, you need to provide a gateset="native" kwarg to the backend as it’s initialized:

provider = IonQProvider("YOUR_API_KEY")
native_simulator = provider.get_backend("ionq_simulator", gateset="native")

To explicitly use the simulator or QPU with the abstract interface, the kwarg is gateset="qis". This is also the default if no gateset is provided, for backwards compatibility.

abstract_simulator = provider.get_backend("ionq_simulator")
# is the same as
abstract_simulator = provider.get_backend("ionq_simulator", gateset="qis")

Then, run as normal:

job = native_simulator.run(circuit)
job.get_probabilities()
{'00': 0.25, '01': 0.25, '10': 0.25, '11': 0.25}

Transpilation to Native Gates in Qiskit

Our native gate definitions are currently not structured in a way that allows you to automatically transpile a circuit into native gates with an appropriate CompilationTargetGatset — we plan to in the future.

Until this is enabled, we recommend transpilation using the method described in our Native Gates Guide.

Additional Resources

Be sure to read our main Getting Started with Native Gates guide and our Get Started With Qiskit on IonQ Hardware guide for more context on Native Gates and the Qiskit IonQ Provider, respectively.

Our native gate interface is also available in Cirq and PennyLane — see Using Native Gates With Cirq and Using Native Gates With PennyLane for more.