Build, edit, and inspect quantum circuits¶
The steps to build your quantum circuits are:
Open Circuit Composer¶
If you are not currently signed in to IBM Quantum Experience, select the Sign in button in the upper right corner. Then, you can either sign in or Create an IBMid account.
Open Circuit Composer by selecting the circuit icon on the left-hand navigation of IBM Quantum Experience.
Select the New Circuit button.
Name your experiment by clicking on the words Untitled Experiment, deleting them, and typing in your own title. Save the name by pressing return, or by selecting the pencil icon.
Build your circuit with drag-and-drop¶
Drag and drop instructions from the quantum instruction palette onto the quantum and classical wires.
Once instructions are on the quantum circuit, you can continue to drag and drop them to new positions.
To delete an instruction from a wire, select the instruction, and an x will appear. Select the x to delete the instruction.
To add more quantum or classical wires, select the Settings tab (gear icon) along the left side of Circuit Composer.
Build your circuit with OpenQASM code¶
To open the Circuit Editor, select the code icon tab (</>) along the left side of Circuit Composer.
See the Instruction glossary for OpenQASM references to quantum operations.
For more information on using the OpenQASM language, including example lines of code, see the original research paper, Open Quantum Assembly Language.
Inspect your circuit, step-by-step¶
The Circuit Inspector de-mystifies the inner workings of the circuits you create. It provides a customizable step-by-step view of a simulation of your circuit, so that you can see the state of the qubits as the computation evolves.
Select the visualizations tab to the left of the editor (labeled with a histogram).
To move step-by-step through visualizations of your circuit’s components, select Inspect in the upper left corner to access the Circuit Inspector. (Note that you cannot select Inspect until you have added at least one instruction to Circuit Composer.) Control the movement of the inspector using the forward and rewind buttons.
With breakpoints, you can define groups of operations to inspect, by selecting one or more instructions in your circuit to mark a breakpoint. A colored overlay on an instruction indicates that a breakpoint is set. Once breakpoints are defined, you can select the play button to observe the steps in sequence. To remove a breakpoint, re-select the instruction, and the colored overlay disappears.
To learn more about interpreting the visualizations, see Visualizations.
To close the Inspector and return to editing your circuit, select the x in the upper right corner.
Randomness in the simulator
Each time you open the Circuit Inspector, the simulator creates randomness by generating results based on a seed. The seed is the initial value introduced into the algorithm that generates pseudorandom numbers. Because the seed is fixed during your Circuit Inspector session, your results will be repeatable. However, when you close the Inspector and re-open it, the seed will have a new value, so you may see a different result.