Runtime integration for streamlined access to IonQ simulators and QPUs.
qbraid.runtime.IonQProvider
provides support for IonQ’s trapped-ion systems. This means that you can write quantum circuits in
Qiskit, Cirq, Amazon Braket, Pennylane, PyTKET, or any other library compatible with OpenQASM (version 2 or 3),
and run them on IonQ’s simulators and trapped-ion quantum computers, all from within the qBraid Runtime framework.
ionq
extra from PyPI using pip:
python --version
from the command line.IONQ_API_KEY
, so if you’ve already followed IonQ’s guide on
setting up and managing your API keys, qBraid will automatically find it.
Alternatively, you can set a “temporary” environment variable from your command line:
IONQ_API_KEY
, or if you are working from a Python environment
where accessing environment variables is not straightforward. You can import your key explicitly or load it from a file, and pass it into
the IonQProvider()
object directly:
IonQProvider()
initialized with no arguments and assume that qBraid will automatically find your API key,
but you can always use this approach instead.
IonQProvider
to list all of the devices to which you have access:
result.data.get_probabilities()
.
You can return histogram data in decimal format for either of these result.data
methods using argument decimal=True
.
ONLINE
:
device.run()
method with the preflight=True
option to obtain a cost estimate for the anticipated job
without actually executing the program on a QPU.
error_mitigation
parameter in the preflight submission to ensure it is accounted for in the cost estimate:
preflight=False
, or don’t specify any preflight
value.
Optionally include job tags or other metadata for your convenience, specifying up to 10 key-value pairs.
COMPLETED
, you can retrieve the results:
qasm2
or qasm3
format.
In this example, we’ll install the qiskit
and cirq
extras,
device.run()
method. However, you can also perform
this “transpile” step manually, if needed (e.g. to inspect the ultimate OpenQASM submission format). This can be done as follows:
plot_histogram
, or display the probability distribution with plot_distribution
.
decimal=True
when retrieving measurement
counts with get_counts()
. If decimal=False
or left unspecified, the default quantum state labels in hexadecimal will be used.
See Plot Experimental Results for more.
IonQDevice
. For example:
qbraid[ionq]
runtime integration.
qBraid supports the following IonQ native gates:
gpi(phi)
gpi2(phi)
ms(phi0, phi1, theta=0.25)
for Aria systemszz(theta)
for Forte systemsqbraid[ionq]
runtime integration does not currently support automatic transpilation from abstract to native gates, but we may add this
capability in the future. For now, we recommend following this general procedure (also described in IonQ’s main native gates guide)
or using a different SDK.