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] .

Syntax

Function: UCC

Parameters:

  • gs_problem: [MoleculeProblem] – MoleculeProblem 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.
  • parameter_prefix: str – Prefix for the generated parameters.

Allowed excitations:

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

Example

First the circuit is initialized to the Hartree-Fock state, then the UCC function is applied to generate the desired excitations. Here they are 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",
        "num_qubits": 4
    },
    "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": [
              1,
              2
            ],
            "max_depth": 100
          },
          "inputs": "hf_out"
        }
      ]
    }
}

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

from classiq import Model
from classiq.builtin_functions import HartreeFock, UCC
from classiq.applications.chemistry import Molecule, MoleculeProblem


molecule = Molecule(
    atoms=[("H", (0.0, 0.0, 0.0)), ("H", (0.0, 0.0, 0.735))],
)
gs_problem = MoleculeProblem(
    molecule=molecule,
    mapping="jordan_wigner",
)
gs_problem = gs_problem.update_problem()

model = Model()

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

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

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

The output circuit:

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).