HartreeFockAnsatz

class HartreeFockAnsatz[source]

Bases: Ansatz

Hartree-Fock-based ansatz for quantum chemistry.

This ansatz prepares the Hartree-Fock reference state and applies parameterized single and double excitation gates. It’s a simplified alternative to UCCSD, often used as a starting point for VQE calculations.

Methods Summary

build(params, n_qubits, n_layers, **kwargs)

Builds the ansatz circuit and returns a list of operations.

n_params_per_layer(n_qubits, **kwargs)

len(singles) + len(doubles) from qp.qchem.excitations for the given n_electrons (required kwarg).

Methods Documentation

build(params, n_qubits, n_layers, **kwargs)[source]

Builds the ansatz circuit and returns a list of operations.

Parameters:
  • params – Parameter array for the ansatz.

  • n_qubits (int) – Number of qubits in the circuit.

  • n_layers (int) – Number of ansatz layers.

  • **kwargs – Additional arguments specific to the ansatz.

Returns:

The ansatz circuit on n_qubits qubits.

Return type:

QuantumCircuit

static n_params_per_layer(n_qubits, **kwargs)[source]

len(singles) + len(doubles) from qp.qchem.excitations for the given n_electrons (required kwarg).

Return type:

int