Learn · Simulate

The Workbench

Simulate the circuits inside a quantum computer: first here in your browser, then in Python with QuTiP and scqubits.

Superconducting quantum computers are built from a few kinds of circuit: a loop with a Josephson junction (the transmon, the fluxonium), a resonator that reads it, and a neighbour it talks to. Two free programs are what researchers commonly reach for to compute what such a circuit does. scqubits finds the energy levels of the circuit. QuTiP follows how its state changes in time, with losses. This page puts nineteen explorers in one place: seventeen of that physics, and two of the circuits people write on top of it in Qiskit and Cirq. Each is checked number for number against the real programs, and each sends you to the lesson that explains it and the Python that reproduces it.

Nothing here is a video: every curve is computed in your browser as you move a slider. The Workbench course (topics 24 to 41 of The Machinery) starts from nothing but vectors and matrices, fits a chip to a measurement, and ends with circuits in Qiskit and Cirq, compiled for a chip and run with noise.

How to use this page, in thirty seconds

  1. Pick an explorer. The pills below the next section choose one at a time. The first is the simplest; they go roughly from a qubit in a field to a whole workflow.
  2. Move a slider. Drag it, or click it and use the arrow keys. The picture and the numbers under it change at once.
  3. Read the strip. The boxes under each picture are the numbers a lab would ask for: a frequency, an anharmonicity, a shift. The lesson says what each one means.
  4. Copy the code. The sweep and experiment explorers write the Python for exactly what you see. Paste it into a notebook and you will get the same curve.
  5. Follow the link. Each explorer names the lesson that explains it. Start at topic 33 if you want to install the programs first.

The two programs: what they are and what to expect

QuTiP (Quantum Toolbox in Python)

A free, open-source Python package for the dynamics of quantum systems. It holds states and operators as objects, joins systems with tensor products, and solves how they change in time, with or without loss (sesolve, mesolve, mcsolve).

Expect a Rabi oscillation, a T1 decay or a pulse to be a few lines each, and the units (GHz against radians per nanosecond) and the cutoff of every oscillator to be your job to get right.

Lesson 34: Qobj · Lesson 35: solvers · documentation · QuTiP 5 paper

scqubits (superconducting qubits)

A free, open-source Python package that knows the Hamiltonians of the common superconducting circuits (transmon, tunable transmon, fluxonium and others) and returns their energy levels, wavefunctions, matrix elements and coherence estimates, alone or coupled to a resonator, with parameter sweeps.

Expect to go from EJ and EC to a qubit frequency and an anharmonicity in five lines, and to hand the result to QuTiP for time evolution. It does not draw the chip: it starts from the circuit’s energies.

Lesson 36: qubits · Lesson 37: coupled systems · documentation · paper (Quantum 5, 583)

The explorers

How many numbers does a qubit state need?

Build a three-qubit state from gates and watch the eight amplitudes; then see what each extra qubit does to the memory. Lesson 24.

A qubit in a field

The Schrödinger equation for one qubit: set a field and watch the Bloch vector turn. Lesson 25.

An oscillator, and how many levels to keep

A computer keeps a finite ladder of levels. Move the cutoff until the answer stops changing. Lesson 26.

The Rabi chevron

The first experiment on a new qubit: pulse length against drive frequency. Click the picture to slice it. Lesson 27.

When does the rotating-frame picture stop being true?

The exact lab-frame answer against the rotating-wave one. Lesson 27.

T1, T2 and the two experiments that measure them

Set the two clocks and run a T1 and a Ramsey experiment on the Lindblad equation. Lesson 28.

Design a transmon

Choose EJ, EC and the offset charge; read off the levels, the anharmonicity and the charge sensitivity. Lesson 29.

Sweep the flux through a fluxonium

The spectrum, the potential and the two lowest wavefunctions; find the sweet spot at half a flux quantum. Lesson 30.

Tune a qubit past its resonator

The avoided crossing and the dispersive shift that reads a qubit out. Lesson 31.

Two qubits: where they collide, and the ZZ shift

Place two transmons and watch the ZZ coupling and the frequency collisions. Lesson 32.

Install both programs: a checklist, and a map of the documentation

Six steps with a copy button on each, and a search box that points to the right page of each program’s own documentation. Lesson 33.

Look inside some QuTiP objects

A line of QuTiP in, the matrix and its properties out. Lesson 34.

Run an experiment and get the Python for it

Rabi, T1, Ramsey or echo, with the code that gives the same curve. Lesson 35.

Sweep a parameter and get the line of scqubits

Choose a qubit and a parameter; see the levels or the wavefunctions; copy the code. Lesson 36.

Tune a transmon through a resonator

The avoided crossing from a ParameterSweep, with the size of the gap read off. Lesson 37.

Which tool for which job?

From a chip layout to a number, and the other open tools in the field. Lesson 38.

Fit a chip to three measured numbers

The inverse problem, as a game with a hidden answer. Lesson 39.

One circuit, written in Qiskit and in Cirq

Build a three-qubit circuit and get the code for it in both toolkits; see why the same state has two names. Lesson 40.

What noise does to a Bell pair

Errors after each gate, idling with T1 and T2, and readout error; the fidelity, and the line below which it no longer proves entanglement. Lesson 41.

Cheat sheet: the calls you will use most

You wantQuTiPscqubits
A qubit state, an operatorbasis(2, 0), sigmax(), destroy(N)
Two systems joinedtensor(A, B), rho.ptrace(0)HilbertSpace([sys1, sys2]) with add_interaction
The levels of a circuitH.eigenenergies()Transmon(EJ, EC, ng, ncut).eigenvals()
How a state changes in timesesolve, mesolve, mcsolvehs.hamiltonian() hands a QuTiP object to them
Add T1 and T2c_ops: sqrt(1/T1)*destroy(2), sqrt(gphi/2)*sigmaz()qubit.t1_capacitive(...) estimates T1 from a loss model
A sweep of a parametera loop over sesolvequbit.plot_evals_vs_paramvals(...), ParameterSweep
Check a resultrun at two cutoffs and two tolerancesraise ncut or cutoff and see that it does not move

Units everywhere on this site: energies and frequencies in GHz, times in ns; a solver wants rad per ns, so multiply a frequency by 2π.

The course behind this page

These are topics 24 to 41 of The Machinery, eighteen lessons in six groups. Each has a picture, the intuition, the mathematics with a worked Python example, and where it is used; every number in them was produced by QuTiP, scqubits, Qiskit or Cirq and is re-checked when the site is built.

24Vectors, matrices and Kronecker productsThe arrays under every simulation, and why each qubit doubles the bill. 25The Hamiltonian and time evolutionOne equation, and the units trap that bites everyone once. 26The oscillator and the Fock spaceThe other building block, and how many levels to keep. 27A driven qubitRabi oscillations, the rotating frame and where it fails. 28Decay and dephasingT1, T2 and the Lindblad equation. 29The transmonFrom EJ and EC to a qubit. 30The fluxoniumThe other qubit, and its sweet spot. 31A qubit and a resonatorCircuit QED and how a qubit is read. 32Two qubits, ZZ and collisionsWhy a pair is a different problem. 33Set up your benchInstall, first run and where to click. 34QuTiP, quantum objects firstThe dozen calls and the traps. 35QuTiP, how a state changessesolve, mesolve, mcsolve and pulses. 36scqubits, a qubit in five linesLevels, matrix elements, wavefunctions, a T1 estimate. 37scqubits, coupled systems and sweepsHilbertSpace, ParameterSweep and the bridge to QuTiP. 38From a chip layout to a numberWhere EJ and EC come from, and the other tools in the field. 39Fit a chip to a measurementThe inverse problem, as a game. 40Circuits in code: Qiskit and CirqThe same circuits in both toolkits, and the bit-order trap. 41From circuit to chipNative gates, compilation, routing and noise.

What this page is, and is not