rigetti / qiskit-rigetti

Qiskit provider serving Rigetti hardware & simulator backends.
Apache License 2.0
7 stars 7 forks source link

Unable to use delay instruction in quantum circuit #36

Open pranavm1502 opened 2 years ago

pranavm1502 commented 2 years ago

I want to add a delay instruction in the Qiskit circuit as shown in the code below adapted from the tutorial. However I get the following error -

RPCError: Unhandled error in host program:
Found unknown gate application 'delay'.

Code to be run:

from qiskit import (
    QuantumCircuit,
    QuantumRegister,
    ClassicalRegister,
    execute
)
from qiskit_rigetti import RigettiQCSProvider

provider = RigettiQCSProvider()
backend = provider.get_simulator(num_qubits=2, noisy=True)  # or provider.get_backend(name="Aspen-9") when running via QCS

circuit = QuantumCircuit(QuantumRegister(2, "q"), ClassicalRegister(2, "ro"))
circuit.h(0)
circuit.cx(0, 1)
circuit.delay(16,qarg=0)
circuit.measure([0, 1], [0, 1])
circuit.draw()

job = execute(circuit, backend, shots=1000)
result = job.result()
counts = result.get_counts()
print("Counts for experiment:", counts)

~IIUC, I think this is being caused because QUIL uses WAIT instead of DELAY.~ Maybe this could be fixed by using string replacement in the QASM string. What do you think?

dbanty commented 2 years ago

I think we'd probably want to solve this in quilc which is where the QASM -> Quil translation is happening. What do you think @notmgsk?