Simulate Trapped Ion Noise Model

I am trying to simulate the ionq noise model using Pennylane. I can run with without the noise model, but when passing it in it appears to not be supported. Is there a workaround to simulate the noise model of an IONQ device (I believe this capability is supported using Qiskit).

import pennylane as qml
from pennylane_ionq import ops

dev = qml.device(name = "ionq.simulator", noise_model = "harmony", shots=10, api_key ="xx", wires=2)

@qml.qnode(dev)
def circuit(x, y, z):
    qml.RX(x, wires=0)
    ops.YY(y, wires=[0,1])
    ops.ZZ(z, wires=[0,1])
    return qml.expval(qml.PauliZ(0))
TypeError                                 Traceback (most recent call last)
Cell In[38], line 4
      1 import pennylane as qml
      2 from pennylane_ionq import ops
----> 4 dev = qml.device(name = "ionq.simulator", noise_model = "harmony", shots=10, api_key ="xx", wires=2)
      6 @qml.qnode(dev)
      7 def circuit(x, y, z):
      8     qml.RX(x, wires=0)

File ~/anaconda3/envs/Braket/lib/python3.10/site-packages/pennylane/__init__.py:370, in device(name, *args, **kwargs)
    364     raise DeviceError(
    365         f"The {name} plugin requires PennyLane versions {plugin_device_class.pennylane_requires}, "
    366         f"however PennyLane version {__version__} is installed."
    367     )
    369 # Construct the device
--> 370 dev = plugin_device_class(*args, **options)
    372 # Once the device is constructed, we set its custom expansion function if
    373 # any custom decompositions were specified.
    374 if custom_decomps is not None:

TypeError: SimulatorDevice.__init__() got an unexpected keyword argument 'noise_model'

Name: PennyLane
Version: 0.34.0
Summary: PennyLane is a Python quantum machine learning library by Xanadu Inc.
Home-page: GitHub - PennyLaneAI/pennylane: PennyLane is a cross-platform Python library for differentiable programming of quantum computers. Train a quantum computer the same way as a neural network.
Author:
Author-email:
License: Apache License 2.0
Location: /home/ec2-user/anaconda3/envs/Braket/lib/python3.10/site-packages
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, pennylane-lightning, requests, rustworkx, scipy, semantic-version, toml, typing-extensions
Required-by: amazon-braket-algorithm-library, amazon-braket-pennylane-plugin, PennyLane-IonQ, PennyLane-Lightning

Platform info: Linux-5.10.192-183.736.amzn2.x86_64-x86_64-with-glibc2.26
Python version: 3.10.13
Numpy version: 1.25.2
Scipy version: 1.12.0
Installed devices:

  • lightning.qubit (PennyLane-Lightning-0.34.0)
  • default.gaussian (PennyLane-0.34.0)
  • default.mixed (PennyLane-0.34.0)
  • default.qubit (PennyLane-0.34.0)
  • default.qubit.autograd (PennyLane-0.34.0)
  • default.qubit.jax (PennyLane-0.34.0)
  • default.qubit.legacy (PennyLane-0.34.0)
  • default.qubit.tf (PennyLane-0.34.0)
  • default.qubit.torch (PennyLane-0.34.0)
  • default.qutrit (PennyLane-0.34.0)
  • null.qubit (PennyLane-0.34.0)
  • braket.aws.ahs (amazon-braket-pennylane-plugin-1.23.0)
  • braket.aws.qubit (amazon-braket-pennylane-plugin-1.23.0)
  • braket.local.ahs (amazon-braket-pennylane-plugin-1.23.0)
  • braket.local.qubit (amazon-braket-pennylane-plugin-1.23.0)
  • ionq.qpu (PennyLane-IonQ-0.34.0)
  • ionq.simulator (PennyLane-IonQ-0.34.0)

Hey @Daniel_Silver, welcome to the forum! :rocket:

The ionq.simulator device provides an ideal noiseless trapped-ion simulation; it doesn’t support adding noise, unfortunately. I suggest that if you want to simulate noise on a quantum circuit that you use default.mixed (qml.devices.default_mixed.DefaultMixed — PennyLane 0.34.0 documentation).

There are a few demos worth checking out as well:

Let me know if this helps!

Hi Isaac, thank you for the suggestions! I have been using the qiskit aer simulator to simulate noise models of superconducting machines, I was specifically hoping for a way to simulate the noise of trapped-ion machines, do you know if there is any workaround to simulate my Pennylane circuits on a noisy trapped-ion simulator?

That’s a great question! I’ll get back to you on that. Will talk to some people internally.

@Daniel_Silver unfortunately you’d be looking at a custom implementation here (which might be fun to do if you’ve ever wanted to contribute to an open source project!). Although it’s not trapped ions, you can use default.mixed and simulate noise :slight_smile:.