qrunch.chemistry.builders.calculator

Functionality for creating ground state problem calculators.

Classes

BeastAcceleratedAdaptiveVqeGroundStateCalculatorCreator

Builder for creating BEAST accelerated ground state energy calculator.

BeastIterativeVqeGroundStateCalculatorCreator

Builder for creating a basic integral ground state energy calculator.

CalculatorCreator

Builder for creating ground state problem builder.

ConfigurationInteractionCreator

Builder for creating full CI problem calculator.

ConfigurationInteractionGroundStateCalculatorCreator

Creator for a standard CI ground state problem calculator.

FixedAnsatzVqeGroundStateCalculatorCreator

Builder for creating a basic integral ground state energy calculator.

IterativeVqeGroundStateCalculatorCreator

Builder for creating an iterative VQE ground state energy calculator.

OrbitalOptimizedBeastIterativeVqeGroundStateCalculatorCreator

Builder for creating a basic integral ground state energy calculator.

OrbitalOptimizedIterativeVqeGroundStateCalculatorCreator

Builder for iterative VQE ground state calculator with orbital optimization.

OrbitalOptimizedPairConfigurationInteractionGroundStateCalculatorCreator

Creator for a paired-electron CI ground state problem calculator.

OrbitalOptimizedPairedIterativeVqeGroundStateCalculatorCreator

Builder for creating a basic integral ground state energy calculator.

OrbitalOptimizedStandardIterativeVqeGroundStateCalculatorCreator

Builder for creating a OO-FAST-VQE ground state energy calculator.

PairConfigurationInteractionGroundStateCalculatorCreator

Creator for a paired-electron CI ground state problem calculator.

PairedIterativeVqeGroundStateCalculatorCreator

Builder for creating a basic integral ground state energy calculator.

SecondOrderCorrectedPairConfigurationInteractionGroundStateCalculatorCreator

Creator for a paired-electron CI ground state problem calculator.

StandardIterativeVqeGroundStateCalculatorCreator

Builder for creating a basic integral ground state energy calculator.

VqeGroundStateCalculatorCreator

Builder for creating VQE based ground state energy calculators.

class BeastAcceleratedAdaptiveVqeGroundStateCalculatorCreator

Bases: object

Builder for creating BEAST accelerated ground state energy calculator.

__init__() None

Initialize builder for the iterative BEAST accelerated standard VQE.

Return type:

None

create() BeastAcceleratedAdaptiveVqeGroundStateCalculator

Create an instance of BeastAcceleratedAdaptiveVqeGroundStateCalculator.

Return type:

BeastAcceleratedAdaptiveVqeGroundStateCalculator

with_beast_calculator(beast: BeastVqeGroundStateCalculator) Self

Set the BEAST-VQE ground state calculator.

Parameters:

beast (BeastVqeGroundStateCalculator) – The BEAST-VQE ground state calculator to be used. Can be created using the builder paths beast() or beast_with_orbital_optimization().

Return type:

Self

with_standard_calculator(adaptive: AdaptiveVqeGroundStateCalculator) Self

Set the adaptive VQE ground state calculator.

Parameters:

adaptive (AdaptiveVqeGroundStateCalculator) – The adaptive VQE ground state calculator to be used. Can be created using the builder path iterative().

Return type:

Self

class BeastIterativeVqeGroundStateCalculatorCreator

Bases: VqeCreatorEstimatorMixin[BeastSecondQuantizationAdaptiveVqeCreator], VqeCreatorMinimizerMixin[BeastSecondQuantizationAdaptiveVqeCreator], VqeCreatorReminimizerMixin[BeastSecondQuantizationAdaptiveVqeCreator], VqeCreatorOptionsMixin[BeastSecondQuantizationAdaptiveVqeCreator], VqeCreatorStoppingCriterionMixin[BeastSecondQuantizationAdaptiveVqeCreator], VqeCreatorGateSelectorSamplerMixin[BeastSecondQuantizationAdaptiveVqeCreator], VqeCreatorAnalyticalBeastVqeMixin[BeastSecondQuantizationAdaptiveVqeCreator], VqeCreatorDataPersisterManagerMixin[BeastSecondQuantizationAdaptiveVqeCreator]

Builder for creating a basic integral ground state energy calculator.

__init__() None

Initialize builder for the iterative BEAST VQE.

Return type:

None

choose_data_persister_manager() DataPersisterManagerSubCreator[Self]

Choose the data persister manager to use and whether to save and/or load the data.

Return type:

DataPersisterManagerSubCreator[Self]

choose_minimizer() MinimizerSubCreator[Self]

Choose minimizer to use for the VQE.

Return type:

MinimizerSubCreator[Self]

choose_reminimizer() ReMinimizerSubCreator[Self]

Choose reminimizer to use for the VQE.

Return type:

ReMinimizerSubCreator[Self]

choose_stopping_criterion() StoppingCriterionSubCreator[Self]

Choose stopping criterion to use for the VQE.

Return type:

StoppingCriterionSubCreator[Self]

create() BeastVqeGroundStateCalculator

Create an instance of BeastVqeGroundStateCalculator.

Return type:

BeastVqeGroundStateCalculator

with_analytical_beast_basic_vqe(*, active: bool = True) Self

Choose to use the analytical basic vqe inside each adaptive iteration, which only works for BEAST.

Instead of having the minimizer call the estimator directly, the estimator is first called to make an analytical expression for the energy as a function of the gate parameter. This expression is then passed to the minimizer, requiring no more measurements.

This results in the estimator being called only 4 times per adaptive iteration, instead of a minimum of 10 times for a normal basic-VQE with the FftMinimizer.

Note: This feature only works with BEAST with last parameter optimization.

If a reminimizer is chosen, it will be paired with the normal Basic vqe since, only it, supports multiple parameters at once.

Parameters:

active (bool) – Whether to use the analytical beast basic vqe or not.

Return type:

Self

with_estimator(estimator: Estimator) Self

Set the estimator to use for the VQE.

Parameters:

estimator (Estimator) – Estimator to use. Can be created using the estimator_creator() builder.

Return type:

Self

with_estimator_shots(shots: int | None) Self

Set the number of shots to use in the estimator.

Parameters:
  • shots (int | None) – Number of shots to use in the estimator. If None is given, the estimator is assumed to be exact

  • simulator). ((e.g. the excitation gate)

Return type:

Self

with_gate_selector_sampler(sampler: Sampler) Self

Set the sampler for the gate selector to use for the VQE.

Parameters:

sampler (Sampler) – The sampler to use. Can be created using the sampler_creator().

Return type:

Self

with_gate_selector_shots(shots: int | None) Self

Set the shots on the gate selector to use for the VQE.

Parameters:

shots (int | None) – The number of shots to use in the Gate selector.

Return type:

Self

with_options(options: IterativeVqeOptions) Self

Set the options to use for the VQE.

Parameters:

options (IterativeVqeOptions) – Options to use.

Return type:

Self

class CalculatorCreator

Bases: object

Builder for creating ground state problem builder.

static configuration_interaction() ConfigurationInteractionCreator

Narrow the calculator type to a classical (full) configuration interaction-based calculator.

Return type:

ConfigurationInteractionCreator

static vqe() VqeGroundStateCalculatorCreator

Narrow the calculator type to a variational quantum eigensolver (VQE) algorithm-based calculator.

Return type:

VqeGroundStateCalculatorCreator

class ConfigurationInteractionCreator

Bases: object

Builder for creating full CI problem calculator.

static paired_electron_approximation() PairConfigurationInteractionGroundStateCalculatorCreator

Narrow the calculator to a paired-electron CI ground state problem calculator.

The Pair Configuration Interaction (pCI) is a version of the configuration interaction (CI) where only electron pair excitations are included in the calculation.

This is a full configuration interaction (pFCI) calculation in the sense that all possible excitations within the provided orbital space are included in the calculation, though note that the ground_state_problem may restrict the orbital space - in which case this is not a full configuration interaction (pFCI) calculation but a pCASCI calculation. However, we consider this a pFCI calculation in the provided orbital space, and in case of a restricted orbital space the inactive energy contribution associated with the CAS is included in the energy_correction of the ground_state_problem.

Return type:

PairConfigurationInteractionGroundStateCalculatorCreator

static paired_with_orbital_optimization() OrbitalOptimizedPairConfigurationInteractionGroundStateCalculatorCreator

Narrow the calculator to an orbital-optimized paired-electron CI ground state problem calculator with an optional second order perturbation correction.

The Pair Configuration Interaction (pCI) is a version of the configuration interaction (CI) where only electron pair excitations are included in the calculation. The Orbital Optimized Pair Configuration Interaction (oo-pCI) (this) is the orbital optimized version, performing first an orbital optimization of the orbitals followed by the pCI calculation, repeating until convergence. Because of the risk of getting stuck in local minima, a basin-hopping algorithm is used to escape local minima.

This is a full configuration interaction (pFCI) calculation in the sense that all possible excitations within the provided orbital space are included in the calculation, though note that the ground_state_problem may restrict the orbital space - in which case this is not a full configuration interaction (oo-pFCI) calculation but a oo-pCASCI calculation. However, we consider this a FCI calculation in the provided orbital space, and in case of a restricted orbital space the inactive energy contribution associated with the CAS is included in the energy_correction of the ground_state_problem.

Return type:

OrbitalOptimizedPairConfigurationInteractionGroundStateCalculatorCreator

static standard() ConfigurationInteractionGroundStateCalculatorCreator

Narrow the calculator to a standard CI problem calculator in the non-paired version.

This is a full configuration interaction (FCI) calculation in the sense that all possible excitations within the provided orbital space are included in the calculation, though note that the ground_state_problem may restrict the orbital space - in which case this is not a full configuration interaction (FCI) calculation but a CASCI calculation. However, we consider this a FCI calculation in the provided orbital space, and in case of a restricted orbital space the inactive energy contribution associated with the CAS is included in the energy_correction of the ground_state_problem.

Return type:

ConfigurationInteractionGroundStateCalculatorCreator

class ConfigurationInteractionGroundStateCalculatorCreator

Bases: object

Creator for a standard CI ground state problem calculator.

__init__() None

Initialize with no options set.

Return type:

None

create() ConfigurationInteractionGroundStateCalculator

Create an instance of ConfigurationInteractionGroundStateCalculator.

Return type:

ConfigurationInteractionGroundStateCalculator

with_options(options: ConfigurationInteractionGroundStateProblemCalculatorOptions) Self

Set the options for the CI problem calculator.

Parameters:

options (ConfigurationInteractionGroundStateProblemCalculatorOptions) – The options to use.

Return type:

Self

class FixedAnsatzVqeGroundStateCalculatorCreator

Bases: VqeCreatorEstimatorMixin[SecondQuantizationBasicVqeCreator], VqeCreatorMinimizerMixin[SecondQuantizationBasicVqeCreator]

Builder for creating a basic integral ground state energy calculator.

__init__() None

Initialize builder for the fixed VQE.

Return type:

None

choose_minimizer() MinimizerSubCreator[Self]

Choose minimizer to use for the VQE.

Return type:

MinimizerSubCreator[Self]

create() BasicVqeGroundStateCalculator

Create an instance of BasicVqeGroundStateCalculator.

Return type:

BasicVqeGroundStateCalculator

with_estimator(estimator: Estimator) Self

Set the estimator to use for the VQE.

Parameters:

estimator (Estimator) – Estimator to use. Can be created using the estimator_creator() builder.

Return type:

Self

with_estimator_shots(shots: int | None) Self

Set the number of shots to use in the estimator.

Parameters:
  • shots (int | None) – Number of shots to use in the estimator. If None is given, the estimator is assumed to be exact

  • simulator). ((e.g. the excitation gate)

Return type:

Self

class IterativeVqeGroundStateCalculatorCreator

Bases: object

Builder for creating an iterative VQE ground state energy calculator.

static beast() BeastIterativeVqeGroundStateCalculatorCreator

Narrow to a BEAST-VQE ground state energy calculator.

The BEAST-VQE algorithm is a combination of FAST-VQE (https://doi.org/10.1103/PhysRevA.108.052422) together with a paired-electron approximation and bosonic encoding, thereby the name ‘BEAST’ (Bosonic Encoding Adaptive Sampling Theory).

BEAST-VQE grows the ansatz during the optimization, by selecting gates from a pool, and using the FAST gate selection strategy that is specific to bosonic encoding of paired electrons in molecular ground state energy problems.

This enables a specialized gate set (only singles, corresponding to paired-excitations, are needed), and a highly simplified Hamiltonian whose expectation value can be measured only using three distinct measurement bases.

Return type:

BeastIterativeVqeGroundStateCalculatorCreator

static paired_electron_approximation() PairedIterativeVqeGroundStateCalculatorCreator

Narrow to a BEAST-VQE ground state energy calculator.

The BEAST-VQE algorithm is a combination of FAST-VQE (https://doi.org/10.1103/PhysRevA.108.052422) together with a paired-electron approximation and bosonic encoding, thereby the name ‘BEAST’ (Bosonic Encoding Adaptive Sampling Theory).

BEAST-VQE grows the ansatz during the optimization, by selecting gates from a pool, and using the FAST gate selection strategy that is specific to bosonic encoding of paired electrons in molecular ground state energy problems.

This enables a specialized gate set (only singles, corresponding to paired-excitations, are needed), and a highly simplified Hamiltonian whose expectation value can be measured only using three distinct measurement bases.

Return type:

PairedIterativeVqeGroundStateCalculatorCreator

static paired_electron_approximation_accelerated_standard() BeastAcceleratedAdaptiveVqeGroundStateCalculatorCreator

Narrow the calculator to a beast-accelerated adaptive ground state energy calculator.

This calculator uses a combination of a BEAST-VQE and an iterative VQE to accelerate convergence to the ground state.

First, it runs a first-converging BEAST-VQE calculation to get a good initial state, then it refines this state using an iterative VQE calculation (Default to FAST-VQE).

NOTE: This is a work in progress and the best practices for using this calculator are still being investigated.

Return type:

BeastAcceleratedAdaptiveVqeGroundStateCalculatorCreator

static standard() StandardIterativeVqeGroundStateCalculatorCreator

Narrow to an iterative VQE, with chemistry default settings.

The default iterative VQE is Kvantify’s FAST-VQE (https://doi.org/10.1103/PhysRevA.108.052422).

An iterative VQE is a VQE that grows the ansatz during the optimization, by selecting gates from a pool. The difference between FAST-VQE and other adaptive schemes, such as ADAPT-VQE (https://arxiv.org/pdf/1812.11173) is the gate selection strategy. FAST-VQE uses a heuristic strategy to select gates (either a heuristic gradient or heuristic selected CI), while ADAPT-VQE uses the exact gradient.

To use ADAPT-VQE instead of FAST-VQE, use the with_gate_selector() method with a gate_selector created by following the adapt-path in the gate_selector_creator().

Return type:

StandardIterativeVqeGroundStateCalculatorCreator

class OrbitalOptimizedBeastIterativeVqeGroundStateCalculatorCreator

Bases: VqeCreatorEstimatorMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorMinimizerMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorReminimizerMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorOptionsMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorStoppingCriterionMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorGateSelectorSamplerMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorDataPersisterManagerMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorOrbitalOptimizerMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorAnalyticalBeastVqeMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorOrbitalOptimizationStoppingCriterionMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator]

Builder for creating a basic integral ground state energy calculator.

__init__() None

Initialize builder for the iterative BEAST VQE.

Return type:

None

choose_data_persister_manager() DataPersisterManagerSubCreator[Self]

Choose the data persister manager to use and whether to save and/or load the data.

Return type:

DataPersisterManagerSubCreator[Self]

choose_minimizer() MinimizerSubCreator[Self]

Choose minimizer to use for the VQE.

Return type:

MinimizerSubCreator[Self]

choose_orbital_optimizer_stopping_criterion() StoppingCriterionSubCreator[Self]

Choose an orbital rotation optimization stopping criterion.

Return type:

StoppingCriterionSubCreator[Self]

choose_reminimizer() ReMinimizerSubCreator[Self]

Choose reminimizer to use for the VQE.

Return type:

ReMinimizerSubCreator[Self]

choose_stopping_criterion() StoppingCriterionSubCreator[Self]

Choose stopping criterion to use for the VQE.

Return type:

StoppingCriterionSubCreator[Self]

create() BeastVqeGroundStateCalculator

Create an instance of BeastVqeGroundStateCalculator.

Return type:

BeastVqeGroundStateCalculator

with_analytical_beast_basic_vqe(*, active: bool = True) Self

Choose to use the analytical basic vqe inside each adaptive iteration, which only works for BEAST.

Instead of having the minimizer call the estimator directly, the estimator is first called to make an analytical expression for the energy as a function of the gate parameter. This expression is then passed to the minimizer, requiring no more measurements.

This results in the estimator being called only 4 times per adaptive iteration, instead of a minimum of 10 times for a normal basic-VQE with the FftMinimizer.

Note: This feature only works with BEAST with last parameter optimization.

If a reminimizer is chosen, it will be paired with the normal Basic vqe since, only it, supports multiple parameters at once.

Parameters:

active (bool) – Whether to use the analytical beast basic vqe or not.

Return type:

Self

with_estimator(estimator: Estimator) Self

Set the estimator to use for the VQE.

Parameters:

estimator (Estimator) – Estimator to use. Can be created using the estimator_creator() builder.

Return type:

Self

with_estimator_shots(shots: int | None) Self

Set the number of shots to use in the estimator.

Parameters:
  • shots (int | None) – Number of shots to use in the estimator. If None is given, the estimator is assumed to be exact

  • simulator). ((e.g. the excitation gate)

Return type:

Self

with_gate_selector_sampler(sampler: Sampler) Self

Set the sampler for the gate selector to use for the VQE.

Parameters:

sampler (Sampler) – The sampler to use. Can be created using the sampler_creator().

Return type:

Self

with_gate_selector_shots(shots: int | None) Self

Set the shots on the gate selector to use for the VQE.

Parameters:

shots (int | None) – The number of shots to use in the Gate selector.

Return type:

Self

with_options(options: IterativeVqeOptions) Self

Set the options to use for the VQE.

Parameters:

options (IterativeVqeOptions) – Options to use.

Return type:

Self

with_orbital_optimizer(orbital_optimizer: OrbitalOptimizerAlgorithm) Self

Choose minimizer to determine optimal orbital rotation parameters in adaptive orbital optimization VQE.

Parameters:

orbital_optimizer (OrbitalOptimizerAlgorithm)

Return type:

Self

class OrbitalOptimizedIterativeVqeGroundStateCalculatorCreator

Bases: object

Builder for iterative VQE ground state calculator with orbital optimization.

static beast() OrbitalOptimizedBeastIterativeVqeGroundStateCalculatorCreator

Narrow to an orbital optimized beast ground state energy calculator with orbital optimization.

BEAST-VQE is a FAST-VQE (grows the ansatz during the optimization, by selecting gates from a pool, and using the FAST gate selection strategy) that is specific to bosonic encoding of paired electrons in molecular ground state energy problems. This enables a specialized gate set (only singles, corresponding to paired-excitations, are needed), and a highly simplified Hamiltonian whose expectation value can be measured only using three distinct measurement bases.

In addition, the adaptive orbital optimization VQE also optimizes the molecular orbitals to find a better basis for the problem. This is particularly useful in the bosonic-encoding case, where the orbital optimization can significantly improve the accuracy of the results.

Return type:

OrbitalOptimizedBeastIterativeVqeGroundStateCalculatorCreator

static paired_electron_approximation() OrbitalOptimizedPairedIterativeVqeGroundStateCalculatorCreator

Narrow to an orbital optimized beast ground state energy calculator with orbital optimization.

BEAST-VQE is a FAST-VQE (grows the ansatz during the optimization, by selecting gates from a pool, and using the FAST gate selection strategy) that is specific to bosonic encoding of paired electrons in molecular ground state energy problems. This enables a specialized gate set (only singles, corresponding to paired-excitations, are needed), and a highly simplified Hamiltonian whose expectation value can be measured only using three distinct measurement bases.

In addition, the adaptive orbital optimization VQE also optimizes the molecular orbitals to find a better basis for the problem. This is particularly useful in the bosonic-encoding case, where the orbital optimization can significantly improve the accuracy of the results.

Return type:

OrbitalOptimizedPairedIterativeVqeGroundStateCalculatorCreator

static standard() OrbitalOptimizedStandardIterativeVqeGroundStateCalculatorCreator

Narrow to the standard iterative VQE ground state energy calculator with orbital optimization.

The default is OO-FAST-VQE. The FAST-VQE (https://doi.org/10.1103/PhysRevA.108.052422), coupled with orbital-optimization.

An iterative VQE is a VQE that grows the ansatz during the optimization, by selecting gates from a pool. The difference between FAST-VQE and other adaptive schemes, such as ADAPT-VQE (https://arxiv.org/pdf/1812.11173) is the gate selection strategy. FAST-VQE uses a heuristic strategy to select gates (either a heuristic gradient or heuristic selected CI), while ADAPT-VQE uses the exact gradient.

To use ADAPT-VQE instead of FAST-VQE, use the with_gate_selector() method with a gate_selector created by following the adapt-path in the gate_selector_creator().

Return type:

OrbitalOptimizedStandardIterativeVqeGroundStateCalculatorCreator

class OrbitalOptimizedPairConfigurationInteractionGroundStateCalculatorCreator

Bases: object

Creator for a paired-electron CI ground state problem calculator.

__init__() None

Initialize with no options set.

Return type:

None

create() OrbitalOptimizedPairConfigurationInteractionGroundStateCalculator | SecondOrderCorrectedPairConfigurationInteractionGroundStateCalculator

Create the configured paired CI problem calculator.

Return type:

OrbitalOptimizedPairConfigurationInteractionGroundStateCalculator | SecondOrderCorrectedPairConfigurationInteractionGroundStateCalculator

with_basin_hopping_options(basin_hopping_options: BasinHoppingOptions) Self

Set the options for the basinhopping global optimization.

Parameters:

basin_hopping_options (BasinHoppingOptions) – Options for the basin hopping algorithm.

Return type:

Self

with_options(options: OrbitalOptimizerOptions) Self

Set the options for the Orbital optimization calculation.

Parameters:

options (OrbitalOptimizerOptions) – Options for the orbital optimizer.

Return type:

Self

class OrbitalOptimizedPairedIterativeVqeGroundStateCalculatorCreator

Bases: VqeCreatorEstimatorMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorMinimizerMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorReminimizerMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorOptionsMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorStoppingCriterionMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorGateSelectorMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorDataPersisterManagerMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorOrbitalOptimizerMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorAnalyticalBeastVqeMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorOrbitalOptimizationStoppingCriterionMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator]

Builder for creating a basic integral ground state energy calculator.

__init__() None

Initialize builder for the iterative BEAST VQE.

Return type:

None

choose_data_persister_manager() DataPersisterManagerSubCreator[Self]

Choose the data persister manager to use and whether to save and/or load the data.

Return type:

DataPersisterManagerSubCreator[Self]

choose_minimizer() MinimizerSubCreator[Self]

Choose minimizer to use for the VQE.

Return type:

MinimizerSubCreator[Self]

choose_orbital_optimizer_stopping_criterion() StoppingCriterionSubCreator[Self]

Choose an orbital rotation optimization stopping criterion.

Return type:

StoppingCriterionSubCreator[Self]

choose_reminimizer() ReMinimizerSubCreator[Self]

Choose reminimizer to use for the VQE.

Return type:

ReMinimizerSubCreator[Self]

choose_stopping_criterion() StoppingCriterionSubCreator[Self]

Choose stopping criterion to use for the VQE.

Return type:

StoppingCriterionSubCreator[Self]

create() BeastVqeGroundStateCalculator

Create an instance of BeastVqeGroundStateCalculator.

Return type:

BeastVqeGroundStateCalculator

with_analytical_beast_basic_vqe(*, active: bool = True) Self

Choose to use the analytical basic vqe inside each adaptive iteration, which only works for BEAST.

Instead of having the minimizer call the estimator directly, the estimator is first called to make an analytical expression for the energy as a function of the gate parameter. This expression is then passed to the minimizer, requiring no more measurements.

This results in the estimator being called only 4 times per adaptive iteration, instead of a minimum of 10 times for a normal basic-VQE with the FftMinimizer.

Note: This feature only works with BEAST with last parameter optimization.

If a reminimizer is chosen, it will be paired with the normal Basic vqe since, only it, supports multiple parameters at once.

Parameters:

active (bool) – Whether to use the analytical beast basic vqe or not.

Return type:

Self

with_estimator(estimator: Estimator) Self

Set the estimator to use for the VQE.

Parameters:

estimator (Estimator) – Estimator to use. Can be created using the estimator_creator() builder.

Return type:

Self

with_estimator_shots(shots: int | None) Self

Set the number of shots to use in the estimator.

Parameters:
  • shots (int | None) – Number of shots to use in the estimator. If None is given, the estimator is assumed to be exact

  • simulator). ((e.g. the excitation gate)

Return type:

Self

with_gate_selector(gate_selector: GateSelector) Self

Choose the gate selector to use for the VQE.

Parameters:

gate_selector (GateSelector) – Gate selector to use. Can be created using the gate_selector_creator().

Return type:

Self

with_options(options: IterativeVqeOptions) Self

Set the options to use for the VQE.

Parameters:

options (IterativeVqeOptions) – Options to use.

Return type:

Self

with_orbital_optimizer(orbital_optimizer: OrbitalOptimizerAlgorithm) Self

Choose minimizer to determine optimal orbital rotation parameters in adaptive orbital optimization VQE.

Parameters:

orbital_optimizer (OrbitalOptimizerAlgorithm)

Return type:

Self

class OrbitalOptimizedStandardIterativeVqeGroundStateCalculatorCreator

Bases: VqeCreatorEstimatorMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorMinimizerMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorReminimizerMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorOptionsMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorStoppingCriterionMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorGateSelectorMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorDataPersisterManagerMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorOrbitalOptimizerMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator], VqeCreatorOrbitalOptimizationStoppingCriterionMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator]

Builder for creating a OO-FAST-VQE ground state energy calculator.

__init__() None

Initialize builder for the iterative OO-Iterative-VQE.

Return type:

None

choose_data_persister_manager() DataPersisterManagerSubCreator[Self]

Choose the data persister manager to use and whether to save and/or load the data.

Return type:

DataPersisterManagerSubCreator[Self]

choose_minimizer() MinimizerSubCreator[Self]

Choose minimizer to use for the VQE.

Return type:

MinimizerSubCreator[Self]

choose_orbital_optimizer_stopping_criterion() StoppingCriterionSubCreator[Self]

Choose an orbital rotation optimization stopping criterion.

Return type:

StoppingCriterionSubCreator[Self]

choose_reminimizer() ReMinimizerSubCreator[Self]

Choose reminimizer to use for the VQE.

Return type:

ReMinimizerSubCreator[Self]

choose_stopping_criterion() StoppingCriterionSubCreator[Self]

Choose stopping criterion to use for the VQE.

Return type:

StoppingCriterionSubCreator[Self]

create() AdaptiveVqeGroundStateCalculator

Create an instance of AdaptiveVqeGroundStateCalculator.

Return type:

AdaptiveVqeGroundStateCalculator

with_double_excitations(include: bool) Self

Include/Exclude double excitations in the gate pool.

Parameters:

include (bool)

Return type:

Self

with_estimator(estimator: Estimator) Self

Set the estimator to use for the VQE.

Parameters:

estimator (Estimator) – Estimator to use. Can be created using the estimator_creator() builder.

Return type:

Self

with_estimator_shots(shots: int | None) Self

Set the number of shots to use in the estimator.

Parameters:
  • shots (int | None) – Number of shots to use in the estimator. If None is given, the estimator is assumed to be exact

  • simulator). ((e.g. the excitation gate)

Return type:

Self

with_gate_selector(gate_selector: GateSelector) Self

Choose the gate selector to use for the VQE.

Parameters:

gate_selector (GateSelector) – Gate selector to use. Can be created using the gate_selector_creator().

Return type:

Self

with_options(options: IterativeVqeOptions) Self

Set the options to use for the VQE.

Parameters:

options (IterativeVqeOptions) – Options to use.

Return type:

Self

with_orbital_optimizer(orbital_optimizer: OrbitalOptimizerAlgorithm) Self

Choose minimizer to determine optimal orbital rotation parameters in adaptive orbital optimization VQE.

Parameters:

orbital_optimizer (OrbitalOptimizerAlgorithm)

Return type:

Self

with_single_excitations(include: bool) Self

Include/Exclude single excitations in the gate pool.

Parameters:

include (bool)

Return type:

Self

class PairConfigurationInteractionGroundStateCalculatorCreator

Bases: object

Creator for a paired-electron CI ground state problem calculator.

__init__() None

Initialize with no options set.

Return type:

None

create() PairConfigurationInteractionGroundStateCalculator | SecondOrderCorrectedPairConfigurationInteractionGroundStateCalculator

Create the configured paired CI problem calculator.

Return type:

PairConfigurationInteractionGroundStateCalculator | SecondOrderCorrectedPairConfigurationInteractionGroundStateCalculator

class PairedIterativeVqeGroundStateCalculatorCreator

Bases: VqeCreatorEstimatorMixin[SecondQuantizationAdaptiveVqeCreator], VqeCreatorMinimizerMixin[SecondQuantizationAdaptiveVqeCreator], VqeCreatorReminimizerMixin[SecondQuantizationAdaptiveVqeCreator], VqeCreatorOptionsMixin[SecondQuantizationAdaptiveVqeCreator], VqeCreatorStoppingCriterionMixin[SecondQuantizationAdaptiveVqeCreator], VqeCreatorGateSelectorMixin[SecondQuantizationAdaptiveVqeCreator], VqeCreatorAnalyticalBeastVqeMixin[SecondQuantizationAdaptiveVqeCreator], VqeCreatorDataPersisterManagerMixin[SecondQuantizationAdaptiveVqeCreator]

Builder for creating a basic integral ground state energy calculator.

__init__() None

Initialize builder for the iterative BEAST VQE.

Return type:

None

choose_data_persister_manager() DataPersisterManagerSubCreator[Self]

Choose the data persister manager to use and whether to save and/or load the data.

Return type:

DataPersisterManagerSubCreator[Self]

choose_minimizer() MinimizerSubCreator[Self]

Choose minimizer to use for the VQE.

Return type:

MinimizerSubCreator[Self]

choose_reminimizer() ReMinimizerSubCreator[Self]

Choose reminimizer to use for the VQE.

Return type:

ReMinimizerSubCreator[Self]

choose_stopping_criterion() StoppingCriterionSubCreator[Self]

Choose stopping criterion to use for the VQE.

Return type:

StoppingCriterionSubCreator[Self]

create() BeastVqeGroundStateCalculator

Create an instance of BeastVqeGroundStateCalculator.

Return type:

BeastVqeGroundStateCalculator

with_analytical_beast_basic_vqe(*, active: bool = True) Self

Choose to use the analytical basic vqe inside each adaptive iteration, which only works for BEAST.

Instead of having the minimizer call the estimator directly, the estimator is first called to make an analytical expression for the energy as a function of the gate parameter. This expression is then passed to the minimizer, requiring no more measurements.

This results in the estimator being called only 4 times per adaptive iteration, instead of a minimum of 10 times for a normal basic-VQE with the FftMinimizer.

Note: This feature only works with BEAST with last parameter optimization.

If a reminimizer is chosen, it will be paired with the normal Basic vqe since, only it, supports multiple parameters at once.

Parameters:

active (bool) – Whether to use the analytical beast basic vqe or not.

Return type:

Self

with_estimator(estimator: Estimator) Self

Set the estimator to use for the VQE.

Parameters:

estimator (Estimator) – Estimator to use. Can be created using the estimator_creator() builder.

Return type:

Self

with_estimator_shots(shots: int | None) Self

Set the number of shots to use in the estimator.

Parameters:
  • shots (int | None) – Number of shots to use in the estimator. If None is given, the estimator is assumed to be exact

  • simulator). ((e.g. the excitation gate)

Return type:

Self

with_gate_selector(gate_selector: GateSelector) Self

Choose the gate selector to use for the VQE.

Parameters:

gate_selector (GateSelector) – Gate selector to use. Can be created using the gate_selector_creator().

Return type:

Self

with_options(options: IterativeVqeOptions) Self

Set the options to use for the VQE.

Parameters:

options (IterativeVqeOptions) – Options to use.

Return type:

Self

class SecondOrderCorrectedPairConfigurationInteractionGroundStateCalculatorCreator

Bases: object

Creator for a paired-electron CI ground state problem calculator.

create() SecondOrderCorrectedPairConfigurationInteractionGroundStateCalculator

Create an instance of SecondOrderCorrectedPairConfigurationInteractionGroundStateCalculator.

Return type:

SecondOrderCorrectedPairConfigurationInteractionGroundStateCalculator

class StandardIterativeVqeGroundStateCalculatorCreator

Bases: VqeCreatorEstimatorMixin[SecondQuantizationAdaptiveVqeCreator], VqeCreatorMinimizerMixin[SecondQuantizationAdaptiveVqeCreator], VqeCreatorReminimizerMixin[SecondQuantizationAdaptiveVqeCreator], VqeCreatorOptionsMixin[SecondQuantizationAdaptiveVqeCreator], VqeCreatorStoppingCriterionMixin[SecondQuantizationAdaptiveVqeCreator], VqeCreatorGateSelectorMixin[SecondQuantizationAdaptiveVqeCreator], VqeCreatorDataPersisterManagerMixin[SecondQuantizationAdaptiveVqeCreator]

Builder for creating a basic integral ground state energy calculator.

__init__() None

Initialize builder for the standard iterative VQE.

Return type:

None

choose_data_persister_manager() DataPersisterManagerSubCreator[Self]

Choose the data persister manager to use and whether to save and/or load the data.

Return type:

DataPersisterManagerSubCreator[Self]

choose_minimizer() MinimizerSubCreator[Self]

Choose minimizer to use for the VQE.

Return type:

MinimizerSubCreator[Self]

choose_reminimizer() ReMinimizerSubCreator[Self]

Choose reminimizer to use for the VQE.

Return type:

ReMinimizerSubCreator[Self]

choose_stopping_criterion() StoppingCriterionSubCreator[Self]

Choose stopping criterion to use for the VQE.

Return type:

StoppingCriterionSubCreator[Self]

create() AdaptiveVqeGroundStateCalculator

Create an instance of AdaptiveVqeGroundStateCalculator.

Return type:

AdaptiveVqeGroundStateCalculator

with_double_excitations(include: bool) Self

Include/Exclude double excitations in the gate pool.

Parameters:

include (bool)

Return type:

Self

with_estimator(estimator: Estimator) Self

Set the estimator to use for the VQE.

Parameters:

estimator (Estimator) – Estimator to use. Can be created using the estimator_creator() builder.

Return type:

Self

with_estimator_shots(shots: int | None) Self

Set the number of shots to use in the estimator.

Parameters:
  • shots (int | None) – Number of shots to use in the estimator. If None is given, the estimator is assumed to be exact

  • simulator). ((e.g. the excitation gate)

Return type:

Self

with_gate_selector(gate_selector: GateSelector) Self

Choose the gate selector to use for the VQE.

Parameters:

gate_selector (GateSelector) – Gate selector to use. Can be created using the gate_selector_creator().

Return type:

Self

with_options(options: IterativeVqeOptions) Self

Set the options to use for the VQE.

Parameters:

options (IterativeVqeOptions) – Options to use.

Return type:

Self

with_single_excitations(include: bool) Self

Include/Exclude single excitations in the gate pool.

Parameters:

include (bool)

Return type:

Self

class VqeGroundStateCalculatorCreator

Bases: object

Builder for creating VQE based ground state energy calculators.

static fixed_ansatz() FixedAnsatzVqeGroundStateCalculatorCreator

Narrow the calculator to a fixed ansatz ground state energy calculator, with chemistry defaults.

This calculator uses a basic VQE that does not grow the ansatz, but uses a fixed ansatz provided by the user.

Return type:

FixedAnsatzVqeGroundStateCalculatorCreator

static iterative() IterativeVqeGroundStateCalculatorCreator

Narrow the calculator to an iterative VQE, with chemistry default settings.

The default iterative VQE is Kvantify’s FAST-VQE (https://doi.org/10.1103/PhysRevA.108.052422).

An iterative VQE is a VQE that grows the ansatz during the optimization, by selecting gates from a pool. The difference between FAST-VQE and other adaptive schemes, such as ADAPT-VQE (https://arxiv.org/pdf/1812.11173) is the gate selection strategy. FAST-VQE uses a heuristic strategy to select gates (either a heuristic gradient or heuristic selected CI), while ADAPT-VQE uses the exact gradient.

To use ADAPT-VQE instead of FAST-VQE, use the with_gate_selector() method with a gate_selector created by following the adapt-path in the gate_selector_creator().

Return type:

IterativeVqeGroundStateCalculatorCreator

static iterative_with_orbital_optimization() OrbitalOptimizedIterativeVqeGroundStateCalculatorCreator

Narrow the calculator to an iterative VQE, with orbital optimization.

The default iterative VQE is OO-FAST-VQE the orbital optimization version of Kvantify’s FAST-VQE (https://doi.org/10.1103/PhysRevA.108.052422).

An iterative VQE is a VQE that grows the ansatz during the optimization, by selecting gates from a pool. The difference between FAST-VQE and other adaptive schemes, such as ADAPT-VQE (https://arxiv.org/pdf/1812.11173) is the gate selection strategy. FAST-VQE uses a heuristic strategy to select gates (either a heuristic gradient or heuristic selected CI), while ADAPT-VQE uses the exact gradient.

Orbital optimization reparameterizes the one-electron basis functions (orbitals) used to describe the wavefunction, seeking an orbital rotation that minimizes the total VQE energy. This allows the algorithm to partially recover correlation effects that would otherwise require a much larger ansatz, thereby improving accuracy and convergence stability. The optimized orbitals effectively adapt the mean-field reference to better suit the chosen active space and ansatz form.

Accuracy and cost trade-off:

  • Improves accuracy - often reaching better quality with fewer gates.

  • Reduces dependence on the initial Hartree-Fock or MP2 natural orbitals.

  • Increases classical computational cost, since orbital gradients and rotations must be evaluated iteratively during the optimization loop.

  • Typically results in longer time-to-solution compared to non-optimized variants, but provides systematically improved energies and smoother convergence.

To use ADAPT-VQE instead of FAST-VQE, use the with_gate_selector() method with a gate_selector created by following the adapt-path in the gate_selector_creator().

Return type:

OrbitalOptimizedIterativeVqeGroundStateCalculatorCreator

calculator_creator() CalculatorCreator

Create a calculator for molecular ground state or reaction path problems.

This is the intended starting point for creating any type of problem calculator. See https://qrunch.docs.kvantify.net/docs/explanations/builder_pattern.html for more information on using the builder pattern.

Return type:

CalculatorCreator