The Quipper System

Safe HaskellNone




Authors: Alexander S. Green, Artur Scherer, Peter Selinger, Alexandr Virodov

An implementation of the Ground State Estimation algorithm. The purpose of this algorithm is to determine the ground state energy of a quantum molecular system. The algorithm depends on a table of one- and two-electron transition integrals, which must be separately pre-computed and supplied in a pair of data files. From this integral data, the molecular electronic Hamiltonian is derived using the Jordan-Wigner transformation. To simulate this Hamiltonian by a quantum circuit, it is first broken into small time steps using Trotterization. The second quantized local Hamiltonian interaction terms can be divided into a small number of cases (number operators, excitation operators, Coulomb and exchange operators, number-excitation operators, and double excitation operators). Each interaction term is synthesized into a piece of quantum circuit following one of a small number of patterns (called "circuit templates"). Finally, the quantum phase estimation algorithm is applied to the resulting circuit to obtain the ground state energy.

The algorithm is described in:

  • James D. Whitfield, Jacob Biamonte, and Alán Aspuru-Guzik. "Simulation of electronic structure Hamiltonians using quantum computers." Molecular Physics 109(5):735–750, 2011. See also

The present implementation is based on a detailed algorithm specification that was provided to us by the IARPA QCS program and written by Anargyros Papageorgiou, James Whitfield, Joseph Traub, and Alán Aspuru-Guzik.




This module provides a command line interface for the Ground State Estimation algorithm. This allows the user to set a number of parameters, such as b (the number of precision qubits), M (the number of spin orbitals), N (the number of occupied spin orbitals in the prepared approximate ground state), and Emin and Emax (the energy range). Command line options are also provided to specify the filenames for the Hamiltonian integral data, and to specify the output format and gate base.

Option processing

data WhatToShow Source #

An enumeration type for determining what the main function should do.



Show the whole circuit (default).

Template [Int]

Show a particular template.

data Options Source #

A data type to hold values set by command line options.




defaultOptions :: Options Source #

The default options.

showDefault :: Show a => (Options -> a) -> String Source #

Show the default value of an option.

options :: [OptDescr (Options -> IO Options)] Source #

The list of command line options, in the format required by getOpt.

dopts :: [String] -> IO Options Source #

Process argv-style command line options into an Options structure.

usage :: IO () Source #

Print usage message to stdout.

The GSE main function

main :: IO () Source #

Main function: read options, then execute the appropriate task.

main_circuit :: Options -> IO () Source #

Main function for outputting the GSE circuit.

main_template :: Options -> [Int] -> IO () Source #

Main function for outputting a particular template.