# How to find explicit gate decomposition of a circuit implementing a unitary using HamiltonianGate()?

I'm new to Qiskit. I am trying to construct a gate from HamiltonianGate(), available on Qiskit. The Hamiltonian in question is: $$H = - \pi\delta(Z_1 - Z_2) + 2\pi J ~ \mathbf{I}_1 \cdot \mathbf{I}_2$$ where $$\mathbf{I}_1$$ and $$\mathbf{I}_2$$ are Pauli vectors, each for system 1 and system 2, respectively.

Although I was able to do so by using HamiltonianGate(), when I try to see my circuit, I end up getting something like this:

I was hoping to find explicit gate decomposition of my unitary from HamiltonianGate(), but I'm unable to find a way to do so.

Please do let me know how I can proceed from here and obtain the explicit gate decompositions. If this is, for some reason, not possible, then please do let me know why it is so. Also, if given this scenario, any help in simulating the unitary associated with the above Hamiltonian via elementary gates would be very much appreciated!

• Hi. It could be worth trying QuantumCircuit.decompose(). You can repeatedly decompose your circuit to lower and lower levels of abstraction if need be. Oct 2, 2023 at 19:32
• Unfortunately, it did not change anything, at least visually. Oct 2, 2023 at 19:49
• If you define a new varible with new_qc = qc.decompose(reps=2) you should be able to see the difference with new_qc.draw('mpl'). Here qc is a QuantumCircuit object. Oct 2, 2023 at 20:16

As @Callum mentioned in the comments, you can use QuantumCircuit.decompose() to achieve this. However, you should be aware of the following two points:
• By default, it decomposes one level only (shallow decompose). For further decomposition you can use the parameter reps to set number of times the circuit should be decomposed.
As an example, this code snippet should draw the circuit circ after applying the decomposition pass two times:
circ.decompose(reps=2).draw('mpl')