qrunch.chemistry.calculators.tools.vqe_inputs

Shared helpers for constructing the inputs to the VQE ground state calculators.

The module contains the Hamiltonian creation used by all VQE based ground state calculators, together with the gate pool and initial ansatz construction used by the adaptive variants.

Functions

create_fermion_adaptive_vqe_inputs(...)

Create the inputs to the adaptive vqe.

create_hamiltonian_from_problem(...[, ...])

Create a second quantized fermionic or hardcore bosonic Hamiltonian from the ground state problem.

create_paired_electron_adaptive_vqe_inputs(...)

Create the inputs to the adaptive vqe in the paired-electron approximation.

create_vqe_input_from_circuit(circuit)

Create a start VQE input from a fully specified (parameter-free) circuit.

Classes

AdaptiveVqeFermionInputs

The inputs to the adaptive VQE algorithm.

AdaptiveVqeHardcoreBosonInputs

The inputs to the adaptive VQE algorithm in the paired-electron approximation.

class AdaptiveVqeFermionInputs

Bases: object

The inputs to the adaptive VQE algorithm.

Parameters:
  • gate_pool – The pool of excitation gates to use.

  • initial_ansatz – The initial ansatz to use.

  • hamiltonian – The Hamiltonian to use.

__init__(gate_pool: ExcitationGatePool, initial_ansatz: InitialAnsatz, hamiltonian: FermionHermitianSum) None
Parameters:
Return type:

None

gate_pool: ExcitationGatePool
hamiltonian: FermionHermitianSum
initial_ansatz: InitialAnsatz
class AdaptiveVqeHardcoreBosonInputs

Bases: object

The inputs to the adaptive VQE algorithm in the paired-electron approximation.

Parameters:
  • gate_pool – The pool of excitation gates to use.

  • initial_ansatz – The initial ansatz to use.

  • hamiltonian – The Hamiltonian to use.

__init__(gate_pool: ExcitationGatePool, initial_ansatz: InitialAnsatz, hamiltonian: PairedHardcoreBosonHermitianSum) None
Parameters:
Return type:

None

gate_pool: ExcitationGatePool
hamiltonian: PairedHardcoreBosonHermitianSum
initial_ansatz: InitialAnsatz
create_fermion_adaptive_vqe_inputs(ground_state_problem: RestrictedGroundStateProblem | UnrestrictedGroundStateProblem, *, include_single_excitations: bool, include_double_excitations: bool, excitation_gate_pool_options: ExcitationGatePoolOptions, initial_ansatz_builder: InitialAnsatzBuilder) AdaptiveVqeFermionInputs

Create the inputs to the adaptive vqe.

Parameters:
  • ground_state_problem (RestrictedGroundStateProblem | UnrestrictedGroundStateProblem) – Ground state problem to create the inputs for.

  • include_single_excitations (bool) – Whether to include single-excitation gates in the gate pool.

  • include_double_excitations (bool) – Whether to include double-excitation gates in the gate pool.

  • excitation_gate_pool_options (ExcitationGatePoolOptions) – Options for the excitation gate pool.

  • initial_ansatz_builder (InitialAnsatzBuilder) – Builder for the initial ansatz.

Return type:

AdaptiveVqeFermionInputs

create_hamiltonian_from_problem(ground_state_problem: RestrictedGroundStateProblem | UnrestrictedGroundStateProblem, *, paired_electron_approximation: bool = False) PairedHardcoreBosonHermitianSum | FermionHermitianSum

Create a second quantized fermionic or hardcore bosonic Hamiltonian from the ground state problem.

Parameters:
  • ground_state_problem (RestrictedGroundStateProblem | UnrestrictedGroundStateProblem) – The ground state problem to create the Hamiltonian from.

  • paired_electron_approximation (bool) – Whether to use the paired-electron approximation. If True, a paired-electron Hamiltonian is created, which is a Hardcore-bosonic Hamiltonian that treats pairs of electrons as bosons. If False, a standard fermionic Hamiltonian is created (default=False).

Return type:

PairedHardcoreBosonHermitianSum | FermionHermitianSum

create_paired_electron_adaptive_vqe_inputs(ground_state_problem: RestrictedGroundStateProblem | UnrestrictedGroundStateProblem, electron_configuration: MolecularElectronPairConfiguration, *, include_single_excitations: bool, include_double_excitations: bool, excitation_gate_pool_options: ExcitationGatePoolOptions, initial_ansatz_builder: InitialAnsatzBuilder) AdaptiveVqeHardcoreBosonInputs

Create the inputs to the adaptive vqe in the paired-electron approximation.

Parameters:
Return type:

AdaptiveVqeHardcoreBosonInputs

create_vqe_input_from_circuit(circuit: Circuit) AdaptiveVqeGroundStateProblemCalculatorResult

Create a start VQE input from a fully specified (parameter-free) circuit.

This is useful when the circuit comes from an external source, and it should be used as the starting point for an adaptive VQE calculation.

Parameters:

circuit (Circuit) – A fully specified circuit with no unspecified parameters.

Return type:

AdaptiveVqeGroundStateProblemCalculatorResult