3
$\begingroup$

My Quantum circuit contains "Wait" Gate. When I try to execute it (qasm_simulator or unitary-simulator), it throws an error . NotImplementedError: ('No decomposition rules defined for ', 'wait').

Question 1.How to resolve the error? 2.What is the unit of t specified in "wait" gate arguments?

Dev Env

Anaconda (python 3.6) qiskit 0.7.3 qiskit-aer 0.1.1 qiskit-terra 0.7.0

OS Mac v10.14

Qiskit installation by pip install qiskit

Minimal Example

from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
from qiskit.extensions.standard import RXGate, RYGate, RZGate, U3Gate
from qiskit.extensions.simulator import wait


from qiskit import execute, BasicAer, Aer

qubit = QuantumRegister(1, 'qubit')
circuit = QuantumCircuit(qubit)

circuit.x(qubit)
circuit.wait(1e-6, qubit)
circuit.rx(3.1416, qubit)

backend = Aer.get_backend('statevector_simulator')
job = execute(circuit, backend)
result = job.result()
outputstate = result.get_statevector(circuit, decimals=3)
print(outputstate)

If I comment the line circuit.wait(...) it runs fine. I tried the qasm_simulator with counts/measurements (same error)

$\endgroup$
  • $\begingroup$ Thanks for the question. Could you post a minimal example of the problem? Also, are you trying to execute it or Aer of BasicAer? $\endgroup$ – James Wootton Feb 26 at 21:34
  • $\begingroup$ @JamesWootton - minimal example added to original question. To answer your question, I tried BasicAer too - with same result. $\endgroup$ – Rajib Chakravorty Feb 27 at 0:45
1
$\begingroup$

The wait command has now been deprecated, which is probably why it's causing you problems.

Instead you can use the identity gate iden. You should also use barriers either side so that the compiler doesn't remove it.

circuit.x(qubit)
circuit.barrier(qubit)
circuit.iden(qubit)
circuit.barrier(qubit)
circuit.rx(3.1416, qubit)

This causes a delay for a the same time as a single u2 gate, which is the time needed for a single $\pi/2$-pulse (see here).

$\endgroup$
  • $\begingroup$ Well, the documentation and the stable code still show wait as available. I am accepting your answer because it seems there is no other reason and master branch does not seem to have that function anymore and I have to switch to the solution you showed anyway. Thanks $\endgroup$ – Rajib Chakravorty Feb 28 at 1:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.