# Implementing block of gates at different times in a same qiskit program

I am implementing an Ising chain over 8 qubits. It involves pair-wise CNOT between all the qubits. In the first time step, I am doing CNOTs between qubits 0 and 1, 2 and 3, 4 and 5, and 6 and 7. In the second time step, I would do CNOTs between qubits 1 and 2, 3 and 4, and 5 and 6. I have written the code as follows:

# Block A for the first time step
qp.cx(q0,q1)
qp.cx(q2,q3)
qp.cx(q4,q5)
qp.cx(q6,q7)

# Block B for the second time step
qp.cx(q1,q2)
qp.cx(q3,q4)
qp.cx(q5,q6)


I would like the gates in Block A to be applied simultaneously. Then, in the next step, gates in Block B should be applied simultaneously. How to convey to the compiler that I do not want the above written code to be compiled sequentially, rather I want it to be applied block-wise.

• Why does not suit barrier between the blocks? Aug 22 '20 at 17:19

Did you try to put a barrier between your two blocks? You can do this by writing this qp.barrier() right after your first block, then Qiskit will transpile separately the two blocks. Is this what you were searching for?

• Thanks, this was really helpful. Aug 26 '20 at 14:37
• @SHASHANKRANU happy to see so, could you maybe accept the answer? Thanks :)
– Lena
Aug 27 '20 at 7:52