# Composing teleportation circuit in Qiskit Circuit Composer

I'm trying to create the teleportation circuit in IBM Qiskit Circuit Composer.

OPENQASM 2.0;
include "qelib1.inc";

qreg q;
creg a;   // should be crz
creg b;   // should be crx

h q;
cx q,q;
barrier q; //;

cx q,q;
h q;
barrier q;

measure q -> a;
measure q -> b;
barrier q;



This gives me the following circuit till the 3rd measurement barrier. How do I add CRX and CRZ gates - to obtain the circuit as shown in the picture? Also, how to change the names of the classical registers from a3, b4 to crz and crx? crx and crz are classical register. The gates CRX or CRZ mean that you apply the X gate on qubit 2 if the measurement on the classical register crx is a 1, that is if qubit 1 (q1) is in the $$|1\rangle$$ state; and you will apply the Z gate on qubit 2 if the classical register crz is 1.

This can be done in qiskit with c_if operation. You can see example of the teleportation code in Qiskit here: https://qiskit.org/textbook/ch-algorithms/teleportation.html

Anyway, if you want to use OPENQASM, then you can do it as follow:

OPENQASM 2.0;
include "qelib1.inc";

qreg q;
creg crzz;   // since crz is already taken I use crzz instead
creg crxx;   // Again I use crxx instead of crx

h q;
cx q,q;
barrier q; //;

cx q,q;
h q;
barrier q;

measure q -> crzz;
measure q -> crxx;
barrier q;

if(crzz==1) z q;
if(crxx==1) x q;


Here is the image of the circuit when using Circuit_Composer option within IBMQ Experience environment. • thanks @KAJ226! Now, if I measure q2, I should get the same state as q0 right? Oct 25 '20 at 7:11
• Yes. The idea is the state of $q0$ has teleported to $q2$. If $q0$ was in the state $|1\rangle$ then measurement on $q2$ will only have value 1. Oct 25 '20 at 17:33
• But I also should point out that the condition operations we defined above is not executable on current hardware, as far as I know of. Therefore you can only do this on simulator. To run the teleportation on hardware, you need to make a little modification. See here: qiskit.org/textbook/ch-algorithms/teleportation.html#real_qc Oct 25 '20 at 17:36