Skip to content

Unitary Coupled Cluster (UCC) Ansatz

The Unitary Coupled Cluster (UCC) is a commonly used chemistry-inspired ansatz, which is a unitary version of the classical coupled cluster (CC) method [1] .


Function: UCC


  • gs_problem [GroundStateProblem]: GroundStateProblem object describing the molecule
  • max_depth [int]: constraint on the maximal depth of the UCC function.
  • excitations Union[List[int], List[str]]: list of the desired excitations.
  • use_naive_evolution [bool]: defines whether to evolve the operator naively.

Allowed excitations:

  • 1 or 's' for singles
  • 2 or 'd' for doubles
  • 3 or 't' for triples
  • 4 or 'q' for quadruples


First the circuit is initialized to the Hartree-Fock state, then the UCC function is applied to generate the desired excitations, here chosen to be single and double, making it a UCCSD ansatz.

    "ground_state_problem": {
        "molecule": {
            "atoms": [["H", [0, 0, 0]], ["H", [0, 0, 0.735]]]
        "basis": "sto3g",
        "mapping": "jordan_wigner"
    "model": {
      "logic_flow": [
          "function": "HartreeFock",
          "function_params": {
            "gs_problem": "ground_state_problem"
          "outputs": "hf_out"
          "function": "UCC",
          "function_params": {
            "gs_problem": "ground_state_problem",
            "excitations": [
            "max_depth": 100
          "inputs": "hf_out"

Synthesizing the ansatz circuit using the textual interface is done by opening the Command Palette (Ctrl+Shift+P / Command+Shift+P on Windows/Mac, respectively) and choosing the "Generate Ansatz" command.

from classiq import ModelDesigner
from classiq.builtin_functions import HartreeFock, UCC
from classiq.interface.chemistry.molecule import Molecule
from classiq.interface.chemistry.ground_state_problem import GroundStateProblem

molecule = Molecule(
    atoms=[("H", (0.0, 0.0, 0.0)), ("H", (0.0, 0.0, 0.735))],
gs_problem = GroundStateProblem(

model_designer = ModelDesigner()

hf_params = HartreeFock(gs_problem=gs_problem)
output_dict = model_designer.HartreeFock(params=hf_params)
hf_output = output_dict["OUT"]

ucc_params = UCC(gs_problem=gs_problem, excitations=[1, 2], max_depth=100)

model_designer.UCC(params=ucc_params, in_wires={"IN": hf_output})
generation_result = model_designer.synthesize()

The output Circuit is: alt text

[1] Panagiotis Kl. Barkoutsos, Jerome F. Gonthier, Igor Sokolov, Nikolaj Moll, Gian Salis, Andreas Fuhrer, Marc Ganzhorn, Daniel J. Egger, Matthias Troyer, Antonio Mezzacapo, Stefan Filipp, and Ivano Tavernelli Quantum algorithms for electronic structure calculations: Particle-hole Hamiltonian and optimized wave-function expansions Phys. Rev. A 98, 022322 (2018)