Skip to content

Getting Started

This guide provides a basic walkthrough of creating a simple quantum circuit — the Hello World of quantum computing: a Bell state preparation circuit.

Tutorial: Creating Your First Quantum Circuit

Creating a New Circuit

  • Open Circuit Designer ⧉ and navigate to your project
  • Click New Circuit Create Circuit
  • An empty canvas will appear with a space ready for you to create your first circuit! Create Circuit

Sign In

You need to be signed into Circuit Designer to edit diagrams. You do not need to be signed in to view.

Update the Title

Every circuit diagram should have a clear, descriptive title so readers immediately understand its purpose.

To add or update the circuit title:

  • Click on an empty area of the canvas so no circuit elements are selected
  • In the Properties panel on the right, locate the Title field and type a Bell State Pairs

Set Title

Note that the circuit properties tab also lets you add a copyright, adjust document properties, and enable Debug features.

Adding your First Register

Registers are at the core of quantum circuit diagrams. They are the horizontal lines that represent how one or more quantum bits evolve with time (left to right). In Circuit Designer, you can freely add, reorder, and name any number of registers. Additionally, registers can be split into components, called rails, which represent individual qubits, or other components of the register.

One register is automatically added after creating a new circuit. Follow these steps to customize it:

  • Click on the r1 register
  • In the Element Properties panel that appears on the right hand side of the screen:
    • Type \ket{a} in the Label field
    • Select Custom from the Rail Labels radio buttons
    • Type 1,2,...,n in the Custom field to create n qubits (a.k.a. rails) in the register. Add Register

Duplicating Registers

  • Select the a register by clicking on it.
    • Press ⌘C (or ctrl + C) to copy it. You can also copy by clicking Edit > Copy
    • Press ⌘V (or ctrl + V) to paste a copy. You can also paste by clicking Edit > Paste
  • We will relabel it to b in the Properties panel:
    • Type \ket{b} in the Label field Add Register

Adding Registers

You can also add registers by clicking Add> Register or by typing ⌘1, ctrl + 1 on Windows.

Adding a Hadamard Gate

Gates are the fundamental computation unit in quantum computing. We will begin by adding one Hadamard gate and one CNOT gate.

  • Select the a register by clicking on it.
  • Select Add > Gate from the menu, or type ⌘3.
  • The Hadamard gate appears on the a register (it will appear on the last selected register)
  • If the Hadamard gate does not appear on the a register, you can adjust the rails it is on by first selecting the gate then either:
    • Clicking and dragging the gate to the a register.
    • Nudging the gate to the a register by clicking ⌥↑ to move the gate up a single rail at a time.
    • Clicking spaceand click on the rails it should be on. Note that the click command will toggle between adding the gate, adding controls, and removing the gate.
    • Setting the Target Register to r1 in the Properties panel. Registers have both an ID and a Label. The ID is used to to assign gates to specific registers. We recommend using short IDs. The Label is field that accepts LaTeX text as input and is used to style the diagram.

Add Hadamard

Addressing Rails

You can address specific rails by labeling them within brackets. For example, if you only want to apply the Hadamard gate to rails 1 and 2, you can enter r1[1,2] into the Rail Names field. Enter * to assign the gate to all rails. Circuit Designer uses python list conventions for accessing specific rails. See Addressing Rails for more details.

Adding a CNOT Gate

  • Click on the b register
  • Select Add > Gate from the menu, or type ⌘3.
  • A second H gate should appear to the below the first one. If not, nudge it into place.
  • In the Properties panel:
    • Select CNOT as the Gate Type
    • Hold space and click on rails to toggle states. Ultimately, you want to have the target on the first rail of b, r2[0], and the control on the first rail of a, r1[0]. See Click to set Rails for more details.
    • Alternatively, set Target Rails and Control Rails manually in the Properties panel to r2[0] and r1[0]

Duplicate the CNOT Gate twice

Duplicating and Nudging circuit elements is often the fastest way to build a circuit diagram. Practice by following the following steps:

  • Click on the CNOT gate
  • Enter ⌘D to Duplicate the gate
  • Enter ⌥↓ to nudge the gate down one rail
  • Enter ⌘D to Duplicate the gate
  • Enter ⌥↓ to nudge the gate down two rails

Adding an ellipsis

Sometimes you want to add ellipsis to a circuit to indicate that an operation is repeated. We can do this by adding a Separator circuit element and adjusting the type to ellipsis.

  • Select Add > Separator
  • Nudge the separator once to the left by selecting the separator and entering ⌥←
  • In the Properties panel, set Type to ellipsis

Add ellipsis

Wrap in a Routine

Now that we have established our registers and added gates, we will want neatly organize the operations into higher level operations. In Circuit Designer, we can do this with Routines.

  • Hold Shift and Click all gates to select them. Note, you only need to click the first and last gates to select everything in between.
  • Click Add > Wrap in Routine in the top menu, or enter ⌘⇧G. All of the circuit elements will be added to a single Routine. Note, the Routine will expand and contract to fit all circuit elements within it.
  • We will rename it in the Properties panel:
    • Type \text{Bell Pairs} in the Label

Add a Label

Now we can label the end state of the quantum circuit.

  • Click Add > Label
  • Move the label to the end of the circuit
  • In the Properties panel:
    • Set Label Type to Register, choose Curly On Left from the dropdown
    • Enter \lvert\Psi\rangle = \bigotimes_{i=1}^n \frac{1}{\sqrt{2}} (\lvert 00 \rangle + \lvert 11 \rangle)_i in the Label field

Add Routine

Customize with Color

Finally, we can add color to our circuit diagram to give it some style!

  • Select the Bell Pairs routine
  • In the routine Properties:
    • Set the Background to Purple under Appearance
  • Continue to customize your circuit! Each circuit element can be customized.

Expand, Collapse, Save, and Download

Now we can export our circuit diagram.

  • Double-click the Bell Pairs routine label to expand and collapse it.
  • Double-click the a register to expand and collapse it.
  • Note that the space will expand and collapse the selected node.
  • Select the Bell Pairs routine
  • Click Save to save to your desktop
  • Click Expand All and Collapse All
  • Admire your Circuit!
  • Click Download button > Download as SVG to download an image of your circuit onto your computer.

Collapse and Download

Congratulations! You've created your first quantum circuit - a Bell Pairs state preparation circuit, a building block for FTQC applications.

Save Early and Often

Circuit Designer does not store your data, you have to save your circuit in order to keep your files. We recommend saving early and often.

Next Steps

Learn about the Circuit Designer's home page.