# The Full Quantum Computing Stack

All classical computers on the planet, from desktop calculators to the most powerful supercomputers, operate under the same rules, those of classical physics. Quantum computers operate on fundamentally different rules and can solve certain problems faster by exploiting quantum effects. In this post, we explain the process of solving a problem in computational chemistry, how we get from the problem to the transformations on the physical qubits.

An area in which the speed-up of quantum computers over classical methods is uncontroversial, is that of performing chemical calculations or directly simulating a quantum system. Problems of this type have classical difficulty that thwarts our attempts to understand even modestly large systems due to the exponential growth of their complexity with increasing molecular size. Intuitively, chemical systems are efficiently simulable on quantum computers as they are, themselves, quantum systems. Whereas, it takes classical computers an exponentially growing amount of resources to act like a quantum system of increasing size, a quantum computer only has to be about as big as the quantum system it mimics.

## Nitrogen Fixation

Nitrogen Fixation is a process by which nitrogen is taken from the atmosphere—in which it is abundant—and converted into forms that can be utilized by living organisms. The Haber-Bosch process was developed in the first half of the twentieth century and is the main industrial procedure used for artificial nitrogen fixation. The artificial production of fertilizers by the Haber-Bosch process has facilitated a period of unprecedented growth in human population but at significant cost, fertilizer production worldwide uses up to 2% of global energy and up to 5% of the world’s natural gas. The Haber-Bosch process is about 61% efficient and requires temperatures of 450°C alongside 200 atmospheres of pressure. Nature, however, somehow fixates nitrogen at close 100% efficiency, at room temperature and atmospheric pressure. It therefore must be possible to find some combination of catalysts and conditions providing vastly better efficiencies and saving huge quantities of energy. Quantum computers will provide a critical tool in the identification of new processes for artificial nitrogen fixation.

(Image from http://www.pnas.org/content/pnas/114/29/7555.full.pdf)

Nature’s catalyst for carrying out nitrogen fixation is the enzyme group nitrogenase, in which there are active sites containing the molecule FeMoco. We know that some reaction involving this fairly small molecule is important in room temperature fixation but the exact mechanism is unknown. Cutting edge computational chemistry techniques fall short of accurately describing its reactions. A quantum algorithm called the Variational Quantum Eigensolver (VQE) is expected to be able to find the energy levels of FeMoco with approximately 100 qubits.

Above: hydrogen is simple enough that we can calculate parts of its energy landscape. If we knew the equivalent landscape of FeMoco then more efficient reaction pathways for nitrogen fixation could be found.

## Software

**The Variational Quantum Eigensolver** (VQE ) is a quantum algorithm that could be used to compute the energy landscape of FeMoco. It is a variational algorithm in which a classical computer optimizes parameters of a quantum computation. In the setup of the problem we take the known structure of a molecule and construct a **Hamiltonian **for the system. The Hamiltonian of a system provides a description of how that system evolves in time and we want to find its **ground state**. Chemical Hamiltonians tend to have the useful property of being expressible in a small number of ‘terms’. Each term requires one run of a quantum computer per optimization step and it is critical for the algorithm that the number of terms in the Hamiltonian does not grow too fast as the size of the molecule grows.

Above: VQE consists of an optimization loop. A state is prepared based on a set of parameters, then the energy expectation (Hamiltonian) of the state is measured in parallel. A classical optimizer then finds better parameters and restarts the loop.

**We code the problem **in a high level quantum programming language. The research community has not yet settled on a singular framework quantum programming. Various high level languages exist and are under development, such as ETH’s **Project Q**, IBM’s **QISkit** and Rigetti’s **Forest**.

High level languages exist so that subroutines such as the quantum Fourier transform or quantum phase estimation can be carried out without needing the user to think about composing operations on the level of individual rotations on qubits. These languages are analogous to languages such as **Python **or **Haskell**. The variational quantum eigensolver, written in Project Q code looks something like the following code. Here a two-qubit wavefunction is specified and a Hamiltonian causes time evolution before measurement.

from** projectq** import** MainEngine**

from** projectq.ops **import **All, Measure, QubitOperator, TimeEvolution**

**eng** =** MainEngine**()

**wavefunction** =** eng**.**allocate_qureg**(2)

# Specify a Hamiltonian in terms of Pauli operators:

**hamiltonian** =** QubitOperator**(“**X0 X1**“) + 0.5 *** QubitOperator**(“**Y0 Y1**“)

# Apply exp(-i * Hamiltonian * time) (without Trotter error)

**TimeEvolution**(**time****=**1, **hamiltonian=****hamiltonian**) |** wavefunction**

# Measure the expection value using the simulator shortcut:

**eng**.**flush**()

**value =**** eng**.**backend.get_expectation_value**(**hamiltonian**, **wavefunction**)

# Last operation in any program should be measuring all qubits

**All**(**Measure**) |** qureg**

**eng.flush**()

**The compilation to quantum gates **is carried out by the high level quantum programming language such as **Project Q**. Their compilers take code written at the the highest level of extraction, then break those instructions down to simple gates. This function is analogous to a **C** compiler producing machine level code from a program, such that hardware instructions at the level of individual bits and transistors can be carried out by a CPU. Examples of low level quantum programming languages include **OpenQASM** (Open quantum assembly language) and **QUIL **(Quantum instruction language).

The application of a Hamiltonian seen in the Project Q code block compiles down to basic gates. The subroutine of the type seen below is part of the state preparation procedure and would feature in this compilation. Finding good initial states is the most challenging stage in the implementation of the eigensolver.

Above: Part of a state preparation circuit for a VQE implementation (from https://arxiv.org/pdf/1807.02467.pdf).

This **circuit model** is a natural way to represent operations on a quantum computer and is the prevalent way of representing algorithms and computations in the literature. **QASM **can be interpreted as a text-based description of a quantum circuit, less intuitive to people but more computer parsable. Below is the code in the form that a compiler would produce from its high level language. Note each instruction corresponds to a gate in the circuit model representation.

OPENQASM 2.0; //

include “qelib1.inc“;

qreg q[3]; //Create register with 4 qubits

Rx(pi/2) q[0]; //Apply x rotation to first qubit

h q[1]; h q[2]; h q[3]; //Hadamard gate other three qubits

cx q[0],q[1]; cx q[1],q[2]; cx q[2],q[3]; //Apply three c-not gates

Rz(theta) q[3]; //Apply phase rotation

cx q[2],q[3]; cx q[1],q[2]; cx q[0],q[1]; //Apply three cnot gates

Rx(-pi/2) q[0]; //Apply x rotation to first qubit

h q[1]; h q[2]; h q[3]; //Hadamard other three qubits

## Hardware

**To translate to the hardware** we need some qubits. Currently, the leading qubits are **superconducting** and **trapped ion** based. We aim to answer the question of how the low level gate instructions are converted to the physical systems on which the computations occur.

Above: A flowchart showing the progression from the highest level of abstraction down to the physical transformations on a quantum system.

The basic operations that can be carried out on a quantum computing architecture might not be the same set of basic gates in which the machine level code is written, so the received code must be converted to device specific instructions. For single qubit gates this process is trivial, but for two-qubit gates the process can be more involved. In general, converting to the native operations is simply a matter of applying single qubit operations before and after the interaction. However, certain native two-qubit operations in superconducting qubits carry out an operation, but also swap the information on the two qubits. Thus we must not only correct with single qubit rotations, but keep track of the locations of qubits, since they swap position with every operation. The native gate sequence is then passed to a field programmable gate array (FPGA).

Above: FPGAs are integrated circuits that can be configured by a user after manufacturing. Quantum computing control systems must be able to feedback or feedforward information within a fraction of the coherence time of a device, meaning sub-microsecond latencies must be available. (image from https://software.intel.com/en-us/iot/hardware/fpga/de10-nano)

FPGAs generate the correct control sequences and send them to lasers or microwave generators. The lasers or microwave generators irradiate the qubits in specific sequences to apply the desired transformation on the physical system.

## Quantum Hardware

**Superconducting qubits**

Superconducting qubits exploit some of the most exotic physical phenomenon known. These occur in **superconductors**—macro-scale objects demonstrating quantum effects at fairly high temperature. Because superconductors demonstrate quantum effects at distance scales normally solidly in the classical regime, they are prime candidates for use as qubits. Current qubit designs can be up to a millimeter in size, facilitating the use of engineering techniques borrowed from the semiconductor industry. Key ingredients needed to create superconducting qubits are Josephson junctions, SQUID loops and couplers.

Above: An IBM seven-qubit superconducting device. The device must be cooled in a dilution refrigerator to tens of millikelvins to reduce the thermal noise to controllable levels.

A main challenge in producing superconducting qubits is creating **nonlinearity **in the energy levels. You can use a capacitor to get a **linear** oscillator, but a Josephson junction must be added to produce non-linearity. This nonlinearity allows two energy levels to be isolated for use as a qubit. To produce this nonlinearity, **Josephson junctions** are used.

Above: A harmonic oscillator has every energy level separated by the same spacing. The anharmonicity induced by the Josephson junction breaks this degeneracy, allowing control over individual transitions and the engineering of high-fidelity qubits.

**Charge qubits** use the number of **Cooper pairs** on an ‘island’ for the two levels. Cooper pairs are pairs of loosely bound electrons and are thought to cause the remakable properties of superconductors. The most basic charge qubit possible simply needs one **capacitor **and one **Josephson junction**, but modern charge qubits- **Transmons** add an additional high capacitance capacitor. Transmons yield low sensitivity to charge noise and alongside their similar counterpart **Xmon** qubits are the qubit of choice for IBM, Google and Rigetti.

Above: Charge coupled transmon qubits consist of an island in which a Josephson junction and a capacitor are combined. The Capacitor produces harmonic energy levels and the Josephson junction causes anharmonicity.

**The Josephson junction**, the building block of superconducting qubits, is created by gluing two superconductors together with a thin barrier in-between. We use Aluminium because we can make one layer, let it oxidise to produce the right size barrier, then put down a second layer. This is done using lithography in which vaporised aluminium is deposited on a surface. Linking two Josephson junctions in a loop allows us to form a **SQUID loop**.

Above: Josephson junctions can be made with two strips of Aluminium with an oxide layer between them. When a voltage is applied at the junction, the resulting current does not behave as it would classically, we use the theory of superconductivity to describe this. Here, applied voltage V causes current I which would not be expected classically.

**A SQUID** or superconducting quantum interference device is a loop with two or more Josephson junctions. They can be used to make the most sensitive possible magnetic field detectors and importantly are used as readout devices for superconducting qubits.

Above: A SQUID device consists of a loop containing magnetic flux Φ with two or more Josephson junctions. Note the wires must also be superconducting in this setup. If the current across the device is kept constant then the voltage varies with respect to the magnetic flux through the loop. This allows miniscule changes in magnetic field to be detected.

**Operations on superconducting qubits **are performed with microwaves, shone on the charge qubit resonant with the energy gap. This causes **Rabi flopping **to occur between the two energy levels. The time for which the microwave is applied must be controlled to high precision to produce the desired change in the system. Applying a resonant pulse for different time periods and phases allows any single qubit operation to be performed. To carry out two-qubit operations some coupling element must be placed between the qubits. This coupling can take many forms, for example, a third tunable qubit could be placed in-between facilitating swap-like operations. In this case the FPGA controls the coupling of the mediation qubits to apply two-qubit operations and the single qubit rotation controls, with microwave generators.

**Trapped ion qubits**

Trapped ion qubits have the longest coherence times of any variety. A few decades ago it was discovered that individual charged atoms can be cooled to near absolute zero and can be suspended with magnets and lasers. The energy level of an electron in of these extremely cold trapped ions can then be used to encode the |0⟩ and |1⟩ states of a qubit in such a way that environmental noise doesn’t immediately corrupt the information. Charged atoms (Isotopes of Calcium can be used) are arranged in a string.

**Paul traps **allow ions to be suspended in magnetic fields if they are sufficiently cold. AC magnetic fields must be used to keep the ions stable as it is impossible to suspend a charged particle with stationary fields.

Above: A single fluorescing ion pictured in an NQIT ion trap. Photo by David Nadlinger.

**Operating on single qubits **entails driving a transition between two states. One shines light resonant with the transition (the energy of the photons is equal to the energy difference between the |0⟩ and |1⟩ states). However, for ion traps, this would necessitate microwave lasers (MASERS). Because microwaves can’t be focused to less than a few centimeters (their wavelength), meaning individual ions can’t be addressed, two optical lasers are used with a frequency difference equal to that of the relevant transition. This is called a stimulated Raman transition.

Above: Single qubit operations involve a combination of two frequencies of light with a difference corresponding to the energy difference of the |0⟩ and |1⟩ states. This allows a single ion to be addressed.

**Operations on Multiple Qubits** exploit additional degrees of freedom of the trapped ion string. Rather than acting like single ions, the motion of multiple ions in a trap takes collective modes. These collective modes of ‘motion’ are used to interact the qubits with one another. First, information is transferred from an ion to the collective motion ‘bus’, then an operation is carried out between the bus and the target qubit. There is no limit to how many qubits can be simultaneously interacted in a trap with this method, but in experimental settings, the crowding of the spectrum with lots of different energy transitions makes operations on large numbers of qubits difficult to engineer. Current ion trap experiments typically aim to have interaction zones in which only two qubits interact at a time, making use of ion shuttling to move ions into and out of interaction zones in traps.

Above: Multiple qubit operations exploit the motional state of the ions. The red shading represents the locality of the multi-qubit motional state. The purple laser is set at a frequency

**Measuring trapped ion qubits’ **quantum state with high fidelity is generally difficult. For trapped ions, a technique called electron shelving is used, in which light is shone on a qubit such that if the qubit is in the |1⟩ state, a transition to a higher state will occur. We select this transition such that the atom will fluoresce when it is driven, and we measure the resulting photons.

Above: Readout is carried out by exciting the upper qubit level |1⟩ to an excited state |e⟩ whilst leaving the |0⟩ state untouched.

## Outlook

There is currently development at every level of the quantum computing stack. Companies such as Google, Rigetti and IBM are working to create bigger, lower error devices, while companies like River Lane aim to reduce the system requirements of known algorithms. A few years ago, cloud-based devices of tens of qubits nearing threshold error rates did not exist. If the recent rates of development continue in both algorithmic and hardware development, the useful applications of quantum computers might arrive sooner than we expect.