# How do I draw a multi control cz gate or do I have to make my own gate?

I want to build a diffuser and an oracle so that's why I wanted a multi control cz gate but I looked everywhere I didn't get any

• Welcome to QCSE. The question is how to add a CCCCZ to your circuit or on how graphically make it appear? Commented Sep 12, 2022 at 10:04

You have to make your own gate.If you want to adda $$\underbrace{\mathrm{C}\cdots\mathrm{C}}_{n-1}\mathrm{Z}$$-gate to a circuit, first you have to create it. You can do so using:

from qiskit import QuantumCircuit
from qiskit.circuit.library import MCMT
n=3
c3z= MCMT('cz',n-1,1)
c3z.draw()


Here I use $$n=3$$ for CCZ, $$n=4$$ for CCCZ and so on (select $$n=9$$ to reproduce the picture you added). The result is

q_0: ─■─
│
q_1: ─■─
│
q_2: ─■─


Now you can create a circuit and add it using .compose method indicating where do you want the qubits. Here is an example:

qc=QuantumCircuit(4)
qc.h(0)
qc.compose(c3z,qubits=[0,1,3],inplace=True)
qc.draw()


Output

     ┌───┐
q_0: ┤ H ├─■─
└───┘ │
q_1: ──────■─
│
q_2: ──────┼─
│
q_3: ──────■─


Another option would be to log into your IBMQ account and access the Composer. There the drag and drop interface allows you to add additional controls with drag and drop or a right click. It also generates the code for the circuit that you have built on the right hand side.

I have not yet tried to integrate the code generated by the Composer in a Jupyter Notebook, but if a direct copy-paste does not work I know that you can click the button that says 'open in quantum-lab' and this will take the circuit and transfer it to the Compiler where after running the code it provides you with a widget to continue to manipulate your circuit. At the bottom of the widget is a button, 'create a cell and syncronize the circuit qiskit code output', which will turn your circuit directly into the code that you need.