class UCC(qubit_converter=None, num_particles=None, num_spin_orbitals=None, excitations=None, alpha_spin=True, beta_spin=True, max_spin_excitation=None, generalized=False, preserve_spin=True, reps=1, initial_state=None)[source]

Bases: qiskit.circuit.library.evolved_operator_ansatz.EvolvedOperatorAnsatz

The Unitary Coupled-Cluster Ansatz. For more information, see [1].

This Ansatz is an EvolvedOperatorAnsatz given by \(e^{T - T^{\dagger}}\) where \(T\) is the cluster operator. This cluster operator generally consists of excitation operators which are generated by generate_fermionic_excitations(). You can also use a custom excitation generator method by passing a callable to excitations.

A utility class UCCSD exists, which is equivalent to:

uccsd = UCC(excitations='sd', alpha_spin=True, beta_spin=True, max_spin_excitation=None)

If you want to use a tailored Ansatz, you have multiple options to do so. Below, we provide some examples:

# pure single excitations (equivalent options):
uccs = UCC(excitations='s')
uccs = UCC(excitations=1)
uccs = UCC(excitations=[1])

# pure double excitations (equivalent options):
uccd = UCC(excitations='d')
uccd = UCC(excitations=2)
uccd = UCC(excitations=[2])

# combinations of excitations:
custom_ucc_sd = UCC(excitations='sd')  # see also the convenience sub-class UCCSD
custom_ucc_sd = UCC(excitations=[1, 2])  # see also the convenience sub-class UCCSD
custom_ucc_sdt = UCC(excitations='sdt')
custom_ucc_sdt = UCC(excitations=[1, 2, 3])
custom_ucc_st = UCC(excitations='st')
custom_ucc_st = UCC(excitations=[1, 3])

# you can even define a fully custom list of excitations:

def custom_excitation_list(num_spin_orbitals: int,
                           num_particles: Tuple[int, int]
                           ) -> List[Tuple[Tuple[Any, ...], ...]]:
    # generate your list of excitations...
    my_excitation_list = [...]
    # For more information about the required format of the return statement, please take a
    # look at the documentation of
    # `qiskit_nature.circuit.library.ansatzes.utils.fermionic_excitation_generator`
    return my_excitation_list

my_custom_ucc = UCC(excitations=custom_excitation_list)

Keep in mind, that in all of the examples above we have not set any of the following keyword arguments, which must be specified before the Ansatz becomes usable: - qubit_converter - num_particles - num_spin_orbitals

If you are using this Ansatz with a Qiskit Nature algorithm, these arguments will be set for you, depending on the rest of the stack.


[1] https://arxiv.org/abs/1805.04340

  • qubit_converter (Optional[QubitConverter]) – the QubitConverter instance which takes care of mapping a SecondQuantizedOp to a PauliSumOp as well as performing all configured symmetry reductions on it.

  • num_particles (Optional[Tuple[int, int]]) – the tuple of the number of alpha- and beta-spin particles.

  • num_spin_orbitals (Optional[int]) – the number of spin orbitals.

  • excitations (Union[str, int, List[int], Callable[[int, Tuple[int, int]], List[Tuple[Tuple[int, …], Tuple[int, …]]]], None]) –

    this can be any of the following types:


    which contains the types of excitations. Allowed characters are + s for singles + d for doubles + t for triples + q for quadruples


    a single, positive integer which denotes the number of excitations (1 == s, etc.)


    a list of positive integers generalizing the above


    a function which is used to generate the excitations. The callable must take the __keyword__ arguments num_spin_orbitals and num_particles (with identical types to those explained above) and must return a List[Tuple[Tuple[int, …], Tuple[int, …]]]. For more information on how to write such a callable refer to the default method generate_fermionic_excitations().

  • alpha_spin (bool) – boolean flag whether to include alpha-spin excitations.

  • beta_spin (bool) – boolean flag whether to include beta-spin excitations.

  • max_spin_excitation (Optional[int]) – the largest number of excitations within a spin. E.g. you can set this to 1 and num_excitations to 2 in order to obtain only mixed-spin double excitations (alpha,beta) but no pure-spin double excitations (alpha,alpha or beta,beta).

  • generalized (bool) – boolean flag whether or not to use generalized excitations, which ignore the occupation of the spin orbitals. As such, the set of generalized excitations is only determined from the number of spin orbitals and independent from the number of particles.

  • preserve_spin (bool) – boolean flag whether or not to preserve the particle spins.

  • reps (int) – The number of times to repeat the evolved operators.

  • initial_state (Optional[QuantumCircuit]) – A QuantumCircuit object to prepend to the circuit.




The excitations.


The number of particles.


The number of spin orbitals.


The qubit operator converter.



Parses the excitations and generates the list of operators.