tequilahub/tequila

A High-Level Abstraction Framework for Quantum Algorithms

Tequila – A Python framework for variational quantum algorithms

What it is

  • An open‑source Python library that lets you build, differentiate, and optimise quantum circuits for tasks such as the Variational Quantum Eigensolver (VQE) and other hybrid quantum‑classical algorithms.
  • It abstracts away the low‑level details of quantum back‑ends (simulators or real hardware) and provides a unified API for defining variables, gates, Hamiltonians, and expectation‑value objectives.

Key capabilities

  • Abstract data structures – circuits, Hamiltonians, and optimisation objectives are represented independently of the execution backend.
  • Automatic differentiation – gradients of expectation values can be obtained automatically, enabling gradient‑based optimisers like BFGS.
  • Backend agnostic – works with many simulators/hardware providers (Qulacs, Qibo, Qiskit, Cirq, PyQuil, Atos QLM) and will pick the best one that is installed.
  • Quantum chemistry integration – modules to translate molecular structures (via Psi4, PySCF, or the Madness library) into qubit Hamiltonians and generate chemistry‑specific ansätze (UCC, UpCCGSD, SPA, etc.).
  • Research‑grade features – supports custom ansätze, interval‑guaranteed measurements, explicit‑correlation corrections, and other techniques described in a long list of associated papers.

Typical workflow (Hello‑World)

  1. Define a symbolic variable a.
  2. Build a circuit, e.g. a single‑qubit rotation Ry.
  3. Specify a Hamiltonian (here a Pauli‑X operator).
  4. Create an ExpectationValue object linking the circuit and Hamiltonian.
  5. Call tq.minimize with an optimiser (e.g. BFGS) to find the variable values that minimise the energy.
  6. Inspect the resulting wavefunction and optimisation history.

Chemistry example

  • Load a molecule from a geometry string or an .xyz file.
  • Generate a qubit Hamiltonian via a chosen fermion‑to‑qubit mapping.
  • Choose a chemistry‑specific ansatz (e.g. SPA, UpCCGSD).
  • Optimise the energy with VQE and optionally compare to classical reference methods (CISD, FCI) using PySCF or Psi4.

Installation

  • Recommended: pip install tequila-basic (core library).
  • Add a fast simulator like Qulacs (pip install qulacs).
  • For chemistry, install optional back‑ends (Psi4, PySCF, Madness) via conda or pip as described.

Documentation & learning resources

Who might use it

  • Quantum‑computing researchers developing new variational algorithms or chemistry applications.
  • Students and developers who want a high‑level, backend‑agnostic way to prototype quantum circuits with automatic differentiation.
  • Anyone needing a bridge between classical quantum‑chemistry packages and quantum‑hardware execution.

Community

  • Open source on GitHub; contributions are welcomed via pull requests.
  • Issues can be filed directly on the repository, and the maintainers provide contact details for direct help.

All information above is taken directly from the project's README; no additional features have been inferred.

Related

  • Project
  • Project