qrunch.chemistry.calculators.tools.initial_ansatz.state_prep

Module designed to generate an initial state circuit that corresponds to a MP2 wave function.

MP2 denotes Moller-Plesset perturbation theory to second order.

The MP2 wave function is the first order correction to the Hartree-Fock wave function. The resulting quantum circuit will have a number of qubits equal to the number of spin orbitals (twice the number of spatial orbitals).

The circuit is built via a greedy beam search that finds a sequence of single- and double-excitation gates approximating the normalised MP2 wavefunction expressed as a superposition of Slater determinants.

Classes

Excitation

A qubit excitation operator defined by source and target orbital indices.

FixedParticleNumberStatePrepBeamSearch

Beam search for finding a circuit that prepares a target wavefunction.

FixedParticleNumberStatePrepBeamSearchOptions

Options for the fixed-particle-number state preparation beam search.

class Excitation

Bases: object

A qubit excitation operator defined by source and target orbital indices.

Parameters:
  • from_orbitals – Orbital indices from which particles are removed (annihilation).

  • to_orbitals – Orbital indices to which particles are moved (creation).

__init__(from_orbitals: tuple[int, ...], to_orbitals: tuple[int, ...]) None
Parameters:
  • from_orbitals (tuple[int, ...])

  • to_orbitals (tuple[int, ...])

Return type:

None

from_orbitals: tuple[int, ...]
to_orbitals: tuple[int, ...]
class FixedParticleNumberStatePrepBeamSearch

Bases: object

Beam search for finding a circuit that prepares a target wavefunction.

Uses a greedy heuristic to find a sequence of excitation operators that best approximates the target wavefunction from a starting computational basis state.

__init__(target_wavefunction: dict[int, float], number_of_qubits: int, options: FixedParticleNumberStatePrepBeamSearchOptions | None = None, *, paired_electron_approximation: bool = False) None

Initialize the beam search.

Parameters:
  • target_wavefunction (dict[int, float]) – Dictionary mapping determinants to coefficients. All determinants must have the same particle number.

  • number_of_qubits (int) – Number of qubits in the system.

  • options (FixedParticleNumberStatePrepBeamSearchOptions | None) – Options controlling the beam search. None results in default options.

  • paired_electron_approximation (bool) – If True, restrict to single excitation gates only. Each qubit represents a spatial orbital that holds an electron pair. The target wavefunction determinants use one bit per spatial orbital.

Return type:

None

run() Circuit

Execute the beam search and return the best circuit.

The algorithm iteratively adds excitation operators, keeping the beam_width best circuits at each step.

Return type:

Circuit

class FixedParticleNumberStatePrepBeamSearchOptions

Bases: DataclassPublicAPI

Options for the fixed-particle-number state preparation beam search.

Parameters:
  • max_operators – Maximum number of excitation operators to use in the circuit. Must be a positive integer. (default=20)

  • beam_width – Number of best paths to keep at each iteration of the beam search. Must be a positive integer. (default=3)

  • convergence_threshold – Stop when loss improvement is below this value. Must be positive. (default=1e-10)

  • max_number_of_amplitudes – Maximum number of amplitudes the simulator may store when evaluating candidate circuits during the beam search. Must be a positive integer. (default=1000)

__init__(*, max_operators: int = 20, beam_width: int = 3, convergence_threshold: float = 1e-10, max_number_of_amplitudes: int = 1000) None
Parameters:
  • max_operators (int)

  • beam_width (int)

  • convergence_threshold (float)

  • max_number_of_amplitudes (int)

Return type:

None

beam_width: int = 3
convergence_threshold: float = 1e-10
max_number_of_amplitudes: int = 1000
max_operators: int = 20