# Applying a projector to a qubit in a qiskit circuit

I'd like to be able to apply $$|0 \rangle \langle 0|$$ to project a qubit to the state $$|0 \rangle$$ in the middle of qiskit circuit (see, for example, the attached circuit).

I wonder if, in general, one can customize those orange boxes in some way and if that works in the real hardware.

I hope this is what you are looking for.

Within IBM hardware, there is a new option called "reset" that allows you to reset a certain qubit back to the state $$|0\rangle$$. For instance,

from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
qreg_q = QuantumRegister(3, 'q')
creg_c = ClassicalRegister(3, 'c')
circuit = QuantumCircuit(qreg_q, creg_c)
circuit.x(qreg_q[0])
circuit.h(qreg_q[2])
circuit.cswap(qreg_q[2], qreg_q[0], qreg_q[1])
circuit.h(qreg_q[2])
circuit.reset(qreg_q[1])


Within the circuit composer, you can find the reset method as well with the $$|0\rangle$$ symbol:

• Yes, that's exactly what I'm looking for, thanks!. Is it possible to customize operators in the middle of the circuits? what about if instead I want to get $| 1 \rangle$ ? – danuzco Feb 5 at 22:06
• I believe you can only reset it to the state $|0\rangle$. To get $|1\rangle$ you would have to apply the $X$ gate after the reset. – KAJ226 Feb 5 at 22:07
• Oh, you're right, applying $X$. Thanks again. – danuzco Feb 5 at 22:10
• No problem!!! :) – KAJ226 Feb 5 at 22:11