qrunch.chemistry.creators.calculator
Functionality for creating ground state problem calculators.
Functions
Create a calculator for molecular ground state or reaction path problems. |
Classes
Builder for creating a basic quantum phase estimation-based ground state energy calculator. |
|
Builder for creating a Bayesian quantum phase estimation-based ground state energy calculator. |
|
Builder for creating BEAST accelerated ground state energy calculator. |
|
Builder for creating a basic integral ground state energy calculator. |
|
Builder for creating ground state problem builder. |
|
Mixin to add initial ansatz builder selection to a creator. |
|
Builder for creating full CI problem calculator. |
|
Creator for a standard CI ground state problem calculator. |
|
Builder for creating coupled cluster (CC) problem calculators. |
|
Creator for a coupled cluster ground state problem calculator. |
|
|
Builder for creating a custom quantum-selected configuration interaction-based ground state energy calculator. |
Builder for creating a basic integral ground state energy calculator. |
|
Builder for creating an iterative VQE ground state energy calculator. |
|
Creator for a second-order Møller-Plesset (MP2) ground state problem calculator. |
|
|
Builder for creating a basic integral ground state energy calculator. |
Builder for iterative VQE ground state calculator with orbital optimization. |
|
|
Creator for a paired-electron CI ground state problem calculator. |
|
Builder for creating a basic integral ground state energy calculator. |
|
Builder for creating an OO-FAST-VQE ground state energy calculator. |
Creator for a paired-electron CI ground state problem calculator. |
|
Builder for creating a basic integral ground state energy calculator. |
|
Builder for creating a quantum phase estimation-based ground state energy calculator. |
|
|
Builder for creating a quantum-selected configuration interaction-based ground state energy calculator. |
Builder for creating a SHARP-qDRIFT-based ground state energy calculator. |
|
Builder for creating a SqDRIFT-based ground state energy calculator. |
|
Builder for creating a basic integral ground state energy calculator. |
|
Creator for a Trimmed CI ground state problem calculator. |
|
Builder for creating VQE based ground state energy calculators. |
|
Mixin to add second order corrector options to a creator that owns a vqe_creator. |
- class BasicQuantumPhaseEstimationGroundStateCalculatorCreator
Bases:
objectBuilder for creating a basic quantum phase estimation-based ground state energy calculator.
- __init__() None
Initialize builder for the basic quantum phase estimation-based ground state energy calculator.
- Return type:
None
- create() BasicQuantumPhaseEstimationGroundStateCalculator
Create the basic quantum phase estimation-based ground state energy calculator.
- Return type:
- with_hamiltonian_encoder(hamiltonian_encoder: HamiltonianEncoder) Self
Set the Hamiltonian encoder used for the quantum phase estimation.
- Parameters:
hamiltonian_encoder (HamiltonianEncoder)
- Return type:
Self
- with_options(options: BasicQuantumPhaseEstimationOptions) Self
Set the options for the quantum phase estimation.
- Parameters:
options (BasicQuantumPhaseEstimationOptions)
- Return type:
Self
- with_sampler(sampler: Sampler) Self
Set the sampler to be used for the quantum phase estimation.
- Parameters:
sampler (Sampler)
- Return type:
Self
- with_sampler_shots(shots: int) Self
Set the number of shots to be used for the sampler.
- Parameters:
shots (int)
- Return type:
Self
- class BayesianQuantumPhaseEstimationGroundStateCalculatorCreator
Bases:
objectBuilder for creating a Bayesian quantum phase estimation-based ground state energy calculator.
- __init__() None
Initialize builder for the Bayesian quantum phase estimation-based ground state energy calculator.
- Return type:
None
- create() BayesianQuantumPhaseEstimationGroundStateCalculator
Create the Bayesian quantum phase estimation-based ground state energy calculator.
- Return type:
- with_estimator(estimator: Estimator) Self
Set the estimator to be used for the quantum phase estimation.
- Parameters:
estimator (Estimator)
- Return type:
Self
- with_hamiltonian_encoder(hamiltonian_encoder: TrotterizationHamiltonianEncoder) Self
Set the Hamiltonian encoder used for the quantum phase estimation.
- Parameters:
hamiltonian_encoder (TrotterizationHamiltonianEncoder)
- Return type:
Self
- with_options(options: BayesianQuantumPhaseEstimationOptions) Self
Set the options for the quantum phase estimation.
- Parameters:
options (BayesianQuantumPhaseEstimationOptions)
- Return type:
Self
- with_total_estimator_shots(shots: int | None) Self
Set the total number of shots to be used for each estimator call.
- Parameters:
shots (int | None)
- Return type:
Self
- class BeastAcceleratedAdaptiveVqeGroundStateCalculatorCreator
Bases:
objectBuilder 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:
- 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()orbeast_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],VqeSecondOrderCorrectorMixin[BeastSecondQuantizationAdaptiveVqeCreator],ChooseInitialAnsatzBuilderMixinBuilder 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:
- choose_initial_ansatz_builder() InitialAnsatzBuilderSubCreator[Self]
Choose the initial ansatz builder for the VQE calculation.
The initial ansatz defines the starting quantum state for the adaptive VQE. By default, a Hartree-Fock initial state is used.
- Return type:
- 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:
- create() BeastVqeGroundStateCalculator
Create an instance of
BeastVqeGroundStateCalculator.- Return type:
- 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.
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.
This is the number of shots that will be used in each call to the quantum computer or simulator, and not necessarily the total number of shots. The total number of shots will in many cases be much higher.
- 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_second_order_corrector(estimator: Estimator | None = None, correction_mode: Literal['standard', 'singles', 'standard_and_singles'] = 'standard', options: BeastSecondOrderPerturbationCorrectorOptions | None = None) Self
Set the corrector to calculate the correction to the final energy.
- Parameters:
estimator (Estimator | None) – The estimator to be used for the second order correction. Can be created using the
estimator_creator()builder.correction_mode (Literal['standard', 'singles', 'standard_and_singles']) – The mode of second order correction to use.
options (BeastSecondOrderPerturbationCorrectorOptions | None) – Options for the second order perturbation corrector. If None, default options will be used.
- Return type:
Self
- with_total_estimator_shots(shots: int | None) Self
Set the total number of shots to use for each estimator call.
The total number of shots are then distributed across the different groups in the estimator according to the shots per group strategy of the estimator. This ensures better use of the shot budget, and therefore, better use of the quantum resources.
- 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 CalculatorCreator
Bases:
objectBuilder for creating ground state problem builder.
- static configuration_interaction() ConfigurationInteractionCreator
Narrow the calculator type to a classical (full) configuration interaction-based calculator.
- Return type:
- static coupled_cluster() CoupledClusterCreator
Narrow the calculator type to a classical coupled cluster (CC)-based calculator.
- Return type:
- static moller_plesset_2() MollerPlesset2GroundStateCalculatorCreator
Narrow the calculator type to a classical second-order Moller-Plesset (MP2)-based calculator.
- Return type:
- static vqe() VqeGroundStateCalculatorCreator
Narrow the calculator type to a variational quantum eigensolver (VQE) algorithm-based calculator.
- Return type:
- class ChooseInitialAnsatzBuilderMixin
Bases:
objectMixin to add initial ansatz builder selection to a creator.
- Classes using this mixin must initialize the following attribute in their __init__:
_initial_ansatz_builder: InitialAnsatzBuilder | None = None
- choose_initial_ansatz_builder() InitialAnsatzBuilderSubCreator[Self]
Choose the initial ansatz builder for the VQE calculation.
The initial ansatz defines the starting quantum state for the adaptive VQE. By default, a Hartree-Fock initial state is used.
- Return type:
- class ConfigurationInteractionCreator
Bases:
objectBuilder 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 ground_state_problem.
- static paired_trim() TrimCIGroundStateCalculatorCreator
Narrow the calculator to a paired-electron trimmed CI problem calculator.
This is a TrimCI variant where only paired alpha/beta excitations are used during expansion. This restricts the CI space to determinants reachable via simultaneous identical excitations in both spin channels.
- Return type:
- static paired_with_orbital_optimization() OrbitalOptimizedPairConfigurationInteractionGroundStateCalculatorCreator
Narrow the calculator to an orbital-optimized 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. 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 ground_state_problem.
- 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 ground_state_problem.
- Return type:
- static trim() TrimCIGroundStateCalculatorCreator
Narrow the calculator to a trimmed CI problem calculator.
- Return type:
- class ConfigurationInteractionGroundStateCalculatorCreator
Bases:
objectCreator for a standard CI ground state problem calculator.
- __init__() None
Initialize with no options set.
- 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:
- create() ConfigurationInteractionGroundStateCalculator
Create an instance of
ConfigurationInteractionGroundStateCalculator.- Return type:
- with_options(options: ConfigurationInteractionGroundStateProblemCalculatorOptions) Self
Set the options for the CI problem calculator.
- Parameters:
options (ConfigurationInteractionGroundStateProblemCalculatorOptions) – The options to use.
- Return type:
Self
- class CoupledClusterCreator
Bases:
objectBuilder for creating coupled cluster (CC) problem calculators.
- static ccsd() CoupledClusterGroundStateCalculatorCreator
Narrow the calculator to a coupled cluster singles and doubles (CCSD) calculation.
This is a standard CCSD calculation in the sense that all single and double excitation cluster amplitudes within the provided orbital space are included in the calculation, i.e., the ground_state_problem may restrict the orbital space. In case of a restricted orbital space the inactive energy contribution is included in the ground_state_problem.
- Return type:
- static ccsd_t() CoupledClusterGroundStateCalculatorCreator
Narrow the calculator to a coupled cluster singles, doubles, and perturbative triples (CCSD(T)) calculation.
The CCSD(T) method augments CCSD with a non-iterative perturbative triples correction. This is a standard CCSD(T) calculation within the provided orbital space, i.e., the ground_state_problem may restrict the orbital space. In case of a restricted orbital space the inactive energy contribution is included in the ground_state_problem.
- Return type:
- class CoupledClusterGroundStateCalculatorCreator
Bases:
objectCreator for a coupled cluster ground state problem calculator.
- __init__(method: Literal['ccsd', 'ccsd_t']) None
Initialize with no options set.
- Parameters:
method (Literal['ccsd', 'ccsd_t'])
- Return type:
None
- create() CoupledClusterGroundStateCalculator
Create the configured coupled cluster calculator.
- Return type:
- with_options(options: CoupledClusterGroundStateProblemCalculatorOptions) Self
Set the options for the coupled cluster (CC) problem calculator.
- Parameters:
options (CoupledClusterGroundStateProblemCalculatorOptions) – The options to use.
- Return type:
Self
- class CustomQuantumSelectedConfigurationInteractionGroundStateCalculatorCreator
Bases:
objectBuilder for creating a custom quantum-selected configuration interaction-based ground state energy calculator.
- __init__() None
Initialize builder for the quantum-selected configuration interaction-based ground state energy calculator.
- Return type:
None
- choose_subspace_state_generator() SubspaceStateGeneratorSubCreator[Self]
Start the process of building a subspace state generator for the quantum-selected configuration interaction.
- Return type:
- create() QuantumSelectedConfigurationInteractionGroundStateCalculator
Create the calculator.
- with_sampler(sampler: Sampler) Self
Set the sampler to be used when sampling for the quantum-selected configuration interaction.
- Parameters:
sampler (Sampler)
- Return type:
Self
- with_shots_per_circuit(shots: int) Self
Set the number of shots per circuit used when sampling for the quantum-selected configuration interaction.
The total number of shots will be the number of circuits times the number of shots per circuit. The number of circuits depends on the
SubSpaceStateGeneratorused, see the descriptions inchoose_subspace_state_generator()method.- Parameters:
shots (int) – The number of shots per circuit to be used for the sampler. Defaults to 100. Must be a positive integer.
- 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:
- 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.
This is the number of shots that will be used in each call to the quantum computer or simulator, and not necessarily the total number of shots. The total number of shots will in many cases be much higher.
- 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_total_estimator_shots(shots: int | None) Self
Set the total number of shots to use for each estimator call.
The total number of shots are then distributed across the different groups in the estimator according to the shots per group strategy of the estimator. This ensures better use of the shot budget, and therefore, better use of the quantum resources.
- 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:
objectBuilder 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 an iterative VQE together with a paired-electron approximation and bosonic encoding, thereby the name ‘BEAST’ (Bosonic Encoding Adaptive Sampling Theory).
- Return type:
- static paired_electron_approximation() PairedIterativeVqeGroundStateCalculatorCreator
Narrow to a paired-electron iterative VQE ground state energy calculator.
- Return type:
- static paired_electron_approximation_accelerated_standard() BeastAcceleratedAdaptiveVqeGroundStateCalculatorCreator
Narrow the calculator to a paired-electron-accelerated adaptive ground state energy calculator.
This calculator uses a combination of a paired-electron and an iterative VQE to accelerate convergence to the ground state.
First, it runs a first-converging paired-electron 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.
- 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:
- class MollerPlesset2GroundStateCalculatorCreator
Bases:
objectCreator for a second-order Møller-Plesset (MP2) ground state problem calculator.
This is a standard MP2 calculation in the sense that all possible double excitations within the provided orbital space are included in the calculation, i.e., the ground_state_problem may restrict the orbital space. In case of a restricted orbital space the inactive energy contribution associated with the active space is included in the ground_state_problem.
- __init__() None
Initialize with no options set.
- Return type:
None
- create() MollerPlesset2GroundStateCalculator
Create the configured MP2 calculator.
- Return type:
- with_options(options: MollerPlesset2GroundStateProblemCalculatorOptions) Self
Set the options for the second-order Møller-Plesset (MP2) problem calculator.
- Parameters:
options (MollerPlesset2GroundStateProblemCalculatorOptions) – The options to use.
- Return type:
Self
- class OrbitalOptimizedBeastIterativeVqeGroundStateCalculatorCreator
Bases:
VqeCreatorEstimatorMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorMinimizerMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorReminimizerMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorOptionsMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorStoppingCriterionMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorGateSelectorSamplerMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorDataPersisterManagerMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorOrbitalOptimizerMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorFinalOrbitalOptimizerMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorAnalyticalBeastVqeMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorOrbitalOptimizationStoppingCriterionMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeSecondOrderCorrectorMixin[BeastSecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],ChooseInitialAnsatzBuilderMixinBuilder 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:
- choose_initial_ansatz_builder() InitialAnsatzBuilderSubCreator[Self]
Choose the initial ansatz builder for the VQE calculation.
The initial ansatz defines the starting quantum state for the adaptive VQE. By default, a Hartree-Fock initial state is used.
- Return type:
- 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.
Deprecated since version ``choose_orbital_optimizer_stopping_criterion``: is deprecated and will be removed in a future release. Use
with_intermittent_orbital_optimizer_options()instead.- Return type:
- 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:
- create() BeastVqeGroundStateCalculator
Create an instance of
BeastVqeGroundStateCalculator.- Return type:
- 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.
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.
This is the number of shots that will be used in each call to the quantum computer or simulator, and not necessarily the total number of shots. The total number of shots will in many cases be much higher.
- 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_final_orbital_optimizer(final_orbital_optimizer: OrbitalOptimizerAlgorithm | None) Self
Configure the final orbital optimizer in adaptive orbital optimization VQE.
- Parameters:
final_orbital_optimizer (OrbitalOptimizerAlgorithm | None)
- 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_intermittent_orbital_optimizer_options(options: IntermittentOrbitalOptimizerAlgorithmOptions) Self
Configure options for the intermittent orbital optimizer.
- Parameters:
- 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
Configure the intermittent orbital optimizer in adaptive orbital optimization VQE.
- Parameters:
orbital_optimizer (OrbitalOptimizerAlgorithm)
- Return type:
Self
- with_orbital_optimizer_estimator(estimator: Estimator) Self
Configure the estimator of the intermittent orbital optimizer in adaptive orbital optimization VQE.
- Parameters:
estimator (Estimator)
- Return type:
Self
- with_orbital_optimizer_shots(shots: int | None) Self
Configure the estimator shots of the intermittent orbital optimizer in adaptive orbital optimization VQE.
- Parameters:
shots (int | None)
- Return type:
Self
- with_second_order_corrector(estimator: Estimator | None = None, correction_mode: Literal['standard', 'singles', 'standard_and_singles'] = 'standard', options: BeastSecondOrderPerturbationCorrectorOptions | None = None) Self
Set the corrector to calculate the correction to the final energy.
- Parameters:
estimator (Estimator | None) – The estimator to be used for the second order correction. Can be created using the
estimator_creator()builder.correction_mode (Literal['standard', 'singles', 'standard_and_singles']) – The mode of second order correction to use.
options (BeastSecondOrderPerturbationCorrectorOptions | None) – Options for the second order perturbation corrector. If None, default options will be used.
- Return type:
Self
- with_total_estimator_shots(shots: int | None) Self
Set the total number of shots to use for each estimator call.
The total number of shots are then distributed across the different groups in the estimator according to the shots per group strategy of the estimator. This ensures better use of the shot budget, and therefore, better use of the quantum resources.
- 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 OrbitalOptimizedIterativeVqeGroundStateCalculatorCreator
Bases:
objectBuilder 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 an iterative VQE (grows the ansatz during the optimization, by selecting gates from a pool), that is specific to bosonic encoding of paired electrons in molecular ground state energy problems.
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.
- static paired_electron_approximation() OrbitalOptimizedPairedIterativeVqeGroundStateCalculatorCreator
Narrow to an orbital optimized paired-electron ground state energy calculator with orbital optimization.
This is an iterative VQE (grows the ansatz during the optimization, by selecting gates from a pool), that is specifically uses paired electrons in molecular ground state energy problems.
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.
- 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().
- class OrbitalOptimizedPairConfigurationInteractionGroundStateCalculatorCreator
Bases:
objectCreator for a paired-electron CI ground state problem calculator.
- __init__() None
Initialize with no options set.
- Return type:
None
- create() OrbitalOptimizedPairConfigurationInteractionGroundStateCalculator
Create the configured paired CI problem calculator.
- with_basin_hopping_options(basin_hopping_options: ConfigurationInteractionBasinHoppingOptions) Self
Set the options for the basinhopping global optimization.
- Parameters:
basin_hopping_options (ConfigurationInteractionBasinHoppingOptions) – 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],VqeCreatorFinalOrbitalOptimizerMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorAnalyticalBeastVqeMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorOrbitalOptimizationStoppingCriterionMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeSecondOrderCorrectorMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],ChooseInitialAnsatzBuilderMixinBuilder 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:
- choose_initial_ansatz_builder() InitialAnsatzBuilderSubCreator[Self]
Choose the initial ansatz builder for the VQE calculation.
The initial ansatz defines the starting quantum state for the adaptive VQE. By default, a Hartree-Fock initial state is used.
- Return type:
- 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.
Deprecated since version ``choose_orbital_optimizer_stopping_criterion``: is deprecated and will be removed in a future release. Use
with_intermittent_orbital_optimizer_options()instead.- Return type:
- 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:
- create() BeastVqeGroundStateCalculator
Create an instance of
BeastVqeGroundStateCalculator.- Return type:
- 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.
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.
This is the number of shots that will be used in each call to the quantum computer or simulator, and not necessarily the total number of shots. The total number of shots will in many cases be much higher.
- 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_final_orbital_optimizer(final_orbital_optimizer: OrbitalOptimizerAlgorithm | None) Self
Configure the final orbital optimizer in adaptive orbital optimization VQE.
- Parameters:
final_orbital_optimizer (OrbitalOptimizerAlgorithm | None)
- 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_intermittent_orbital_optimizer_options(options: IntermittentOrbitalOptimizerAlgorithmOptions) Self
Configure options for the intermittent orbital optimizer.
- Parameters:
- 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
Configure the intermittent orbital optimizer in adaptive orbital optimization VQE.
- Parameters:
orbital_optimizer (OrbitalOptimizerAlgorithm)
- Return type:
Self
- with_orbital_optimizer_estimator(estimator: Estimator) Self
Configure the estimator of the intermittent orbital optimizer in adaptive orbital optimization VQE.
- Parameters:
estimator (Estimator)
- Return type:
Self
- with_orbital_optimizer_shots(shots: int | None) Self
Configure the estimator shots of the intermittent orbital optimizer in adaptive orbital optimization VQE.
- Parameters:
shots (int | None)
- Return type:
Self
- with_second_order_corrector(estimator: Estimator | None = None, correction_mode: Literal['standard', 'singles', 'standard_and_singles'] = 'standard', options: BeastSecondOrderPerturbationCorrectorOptions | None = None) Self
Set the corrector to calculate the correction to the final energy.
- Parameters:
estimator (Estimator | None) – The estimator to be used for the second order correction. Can be created using the
estimator_creator()builder.correction_mode (Literal['standard', 'singles', 'standard_and_singles']) – The mode of second order correction to use.
options (BeastSecondOrderPerturbationCorrectorOptions | None) – Options for the second order perturbation corrector. If None, default options will be used.
- Return type:
Self
- with_total_estimator_shots(shots: int | None) Self
Set the total number of shots to use for each estimator call.
The total number of shots are then distributed across the different groups in the estimator according to the shots per group strategy of the estimator. This ensures better use of the shot budget, and therefore, better use of the quantum resources.
- 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 OrbitalOptimizedStandardIterativeVqeGroundStateCalculatorCreator
Bases:
VqeCreatorEstimatorMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorMinimizerMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorReminimizerMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorOptionsMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorStoppingCriterionMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorGateSelectorMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorDataPersisterManagerMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorOrbitalOptimizerMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorFinalOrbitalOptimizerMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],VqeCreatorOrbitalOptimizationStoppingCriterionMixin[SecondQuantizationAdaptiveOrbitalOptimizationVqeCreator],ChooseInitialAnsatzBuilderMixinBuilder for creating an 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:
- choose_initial_ansatz_builder() InitialAnsatzBuilderSubCreator[Self]
Choose the initial ansatz builder for the VQE calculation.
The initial ansatz defines the starting quantum state for the adaptive VQE. By default, a Hartree-Fock initial state is used.
- Return type:
- 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.
Deprecated since version ``choose_orbital_optimizer_stopping_criterion``: is deprecated and will be removed in a future release. Use
with_intermittent_orbital_optimizer_options()instead.- Return type:
- 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:
- create() AdaptiveVqeGroundStateCalculator
Create an instance of
AdaptiveVqeGroundStateCalculator.- Return type:
- 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.
This is the number of shots that will be used in each call to the quantum computer or simulator, and not necessarily the total number of shots. The total number of shots will in many cases be much higher.
- 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_excitation_gate_pool_options(options: ExcitationGatePoolOptions) Self
Include/Exclude double excitations in the gate pool.
- Parameters:
options (ExcitationGatePoolOptions)
- Return type:
Self
- with_final_orbital_optimizer(final_orbital_optimizer: OrbitalOptimizerAlgorithm | None) Self
Configure the final orbital optimizer in adaptive orbital optimization VQE.
- Parameters:
final_orbital_optimizer (OrbitalOptimizerAlgorithm | None)
- 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_intermittent_orbital_optimizer_options(options: IntermittentOrbitalOptimizerAlgorithmOptions) Self
Configure options for the intermittent orbital optimizer.
- Parameters:
- 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
Configure the intermittent orbital optimizer in adaptive orbital optimization VQE.
- Parameters:
orbital_optimizer (OrbitalOptimizerAlgorithm)
- Return type:
Self
- with_orbital_optimizer_estimator(estimator: Estimator) Self
Configure the estimator of the intermittent orbital optimizer in adaptive orbital optimization VQE.
- Parameters:
estimator (Estimator)
- Return type:
Self
- with_orbital_optimizer_shots(shots: int | None) Self
Configure the estimator shots of the intermittent orbital optimizer in adaptive orbital optimization VQE.
- Parameters:
shots (int | None)
- Return type:
Self
- with_single_excitations(include: bool) Self
Include/Exclude single excitations in the gate pool.
- Parameters:
include (bool)
- Return type:
Self
- with_total_estimator_shots(shots: int | None) Self
Set the total number of shots to use for each estimator call.
The total number of shots are then distributed across the different groups in the estimator according to the shots per group strategy of the estimator. This ensures better use of the shot budget, and therefore, better use of the quantum resources.
- 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 PairConfigurationInteractionGroundStateCalculatorCreator
Bases:
objectCreator for a paired-electron CI ground state problem calculator.
- create() PairConfigurationInteractionGroundStateCalculator
Create the configured paired CI problem calculator.
- Return type:
- class PairedIterativeVqeGroundStateCalculatorCreator
Bases:
VqeCreatorEstimatorMixin[SecondQuantizationAdaptiveVqeCreator],VqeCreatorMinimizerMixin[SecondQuantizationAdaptiveVqeCreator],VqeCreatorReminimizerMixin[SecondQuantizationAdaptiveVqeCreator],VqeCreatorOptionsMixin[SecondQuantizationAdaptiveVqeCreator],VqeCreatorStoppingCriterionMixin[SecondQuantizationAdaptiveVqeCreator],VqeCreatorGateSelectorMixin[SecondQuantizationAdaptiveVqeCreator],VqeCreatorAnalyticalBeastVqeMixin[SecondQuantizationAdaptiveVqeCreator],VqeCreatorDataPersisterManagerMixin[SecondQuantizationAdaptiveVqeCreator],VqeSecondOrderCorrectorMixin[SecondQuantizationAdaptiveVqeCreator],ChooseInitialAnsatzBuilderMixinBuilder 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:
- choose_initial_ansatz_builder() InitialAnsatzBuilderSubCreator[Self]
Choose the initial ansatz builder for the VQE calculation.
The initial ansatz defines the starting quantum state for the adaptive VQE. By default, a Hartree-Fock initial state is used.
- Return type:
- 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:
- create() BeastVqeGroundStateCalculator
Create an instance of
BeastVqeGroundStateCalculator.- Return type:
- 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.
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.
This is the number of shots that will be used in each call to the quantum computer or simulator, and not necessarily the total number of shots. The total number of shots will in many cases be much higher.
- 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_second_order_corrector(estimator: Estimator | None = None, correction_mode: Literal['standard', 'singles', 'standard_and_singles'] = 'standard', options: BeastSecondOrderPerturbationCorrectorOptions | None = None) Self
Set the corrector to calculate the correction to the final energy.
- Parameters:
estimator (Estimator | None) – The estimator to be used for the second order correction. Can be created using the
estimator_creator()builder.correction_mode (Literal['standard', 'singles', 'standard_and_singles']) – The mode of second order correction to use.
options (BeastSecondOrderPerturbationCorrectorOptions | None) – Options for the second order perturbation corrector. If None, default options will be used.
- Return type:
Self
- with_total_estimator_shots(shots: int | None) Self
Set the total number of shots to use for each estimator call.
The total number of shots are then distributed across the different groups in the estimator according to the shots per group strategy of the estimator. This ensures better use of the shot budget, and therefore, better use of the quantum resources.
- 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 QuantumPhaseEstimationGroundStateCalculatorCreator
Bases:
objectBuilder for creating a quantum phase estimation-based ground state energy calculator.
- static basic() BasicQuantumPhaseEstimationGroundStateCalculatorCreator
Narrow the calculator type to a basic quantum phase estimation-based calculator.
- static bayesian() BayesianQuantumPhaseEstimationGroundStateCalculatorCreator
Narrow the calculator type to a Bayesian quantum phase estimation-based calculator.
- class QuantumSelectedConfigurationInteractionGroundStateCalculatorCreator
Bases:
objectBuilder for creating a quantum-selected configuration interaction-based ground state energy calculator.
- static custom() CustomQuantumSelectedConfigurationInteractionGroundStateCalculatorCreator
Narrow the calculator type to a custom quantum-selected configuration interaction-based calculator.
- static sharp_sqdrift() SharpSqDriftGroundStateCalculatorCreator
Narrow the calculator type to a SHARP-qDRIFT-based calculator.
SHARP-qDRIFT is SqDRIFT with the qDRIFT term-sampling distribution refreshed mid-run from the determinants discovered so far, by an Epstein-Nesbet reweighter. The circuit path and gate budget are unchanged; only the sampled terms differ.
- Return type:
- static sqdrift() SqDriftGroundStateCalculatorCreator
Narrow the calculator type to an SqDrift-based calculator.
SqDRIFT is a promising near-term quantum algorithm based on quantum-selected configuration interaction (QSCI or SQD) where the diagonalization subspace is spanned by Krylov states (SKQD), which are in turn prepared with qDRIFT-compiled time evolution. see https://arxiv.org/pdf/2508.02578 for details.
- Return type:
- class SharpSqDriftGroundStateCalculatorCreator
Bases:
objectBuilder for creating a SHARP-qDRIFT-based ground state energy calculator.
- __init__() None
Initialize builder for the SHARP-qDRIFT-based ground state energy calculator.
- Return type:
None
- create() SharpSqDriftGroundStateCalculator
Create the calculator.
- Return type:
- disable_state_encoding() Self
Disable encoding of the ground state wavefunction from the sampled subspace in the reference state.
Disabling state encoding will result in a reference state that is always the Hartree-Fock state, regardless of the determinants found so far. This will result in a shorter circuit depth, but may also result in a less accurate ground state energy estimate.
- Return type:
Self
- with_iterations(iterations: int) Self
Set the number of passes over the Krylov sequence.
- Parameters:
iterations (int) – Number of passes. Defaults to 1. Must be a positive integer.
- Return type:
Self
- with_minimum_determinant_weight(minimum_determinant_weight: float) Self
Set the determinant-weight threshold below which determinants are left out of the Epstein-Nesbet scores.
- Parameters:
minimum_determinant_weight (float) – Determinants carrying a weight \(c_d^2\) below this are not scored;
0.0scores every determinant found so far. Defaults to 0.0.- Return type:
Self
- with_options(options: SqDriftOptions) Self
Set the SqDRIFT options controlling the Krylov subspace and qDRIFT compilation.
- Parameters:
options (SqDriftOptions)
- Return type:
Self
- with_sampler(sampler: Sampler) Self
Set the sampler to be used when sampling for the quantum-selected configuration interaction.
- Parameters:
sampler (Sampler)
- Return type:
Self
- with_shots_per_circuit(shots: int) Self
Set the number of shots per circuit used when sampling for the quantum-selected configuration interaction.
The total number of shots will be the number of circuits times the number of shots per circuit. The number of circuits will be determined by the
SqDriftOptionsused.- Parameters:
shots (int) – The number of shots per circuit to be used for the sampler. Defaults to 100. Must be a positive integer.
- Return type:
Self
- with_state_encoding_options(beam_search_options: FixedParticleNumberStatePrepBeamSearchOptions, minimum_encoding_coefficient: float = 0.0001) Self
Enable encoding of the ground state wavefunction from the sampled subspace in the reference state, with the given options.
The state encoding procedure encodes the ground state wavefunction from the sampled subspace in the reference state, which is then used to prepare the next Krylov state. This results in increased accuracy of the ground state energy estimate, but also increases the circuit depth.
- Parameters:
beam_search_options (FixedParticleNumberStatePrepBeamSearchOptions) – Options for the beam search approximating the subspace configuration-interaction wavefunction.
minimum_encoding_coefficient (float) – Determinants whose configuration-interaction coefficient \(|c_d|\) falls below this are left out of the state-preparation target.
- Return type:
Self
- with_update_frequency(update_frequency: int) Self
Set the number of circuits sampled between successive updates of the sampling strategy.
An update refreshes everything learned from the determinants found so far: the qDRIFT term-sampling distribution, and the reference state when state preparation is enabled.
- Parameters:
update_frequency (int) – Number of circuits between updates. Defaults to 10. Must be a positive integer.
- Return type:
Self
- class SqDriftGroundStateCalculatorCreator
Bases:
objectBuilder for creating a SqDRIFT-based ground state energy calculator.
- __init__() None
Initialize builder for the SqDRIFT-based ground state energy calculator.
- Return type:
None
- create() SqDriftGroundStateCalculator
Create the calculator.
- Return type:
- with_options(options: SqDriftOptions) Self
Start the process of building a subspace state generator for the quantum-selected configuration interaction.
- Parameters:
options (SqDriftOptions)
- Return type:
Self
- with_sampler(sampler: Sampler) Self
Set the sampler to be used when sampling for the quantum-selected configuration interaction.
- Parameters:
sampler (Sampler)
- Return type:
Self
- with_shots_per_circuit(shots: int) Self
Set the number of shots per circuit used when sampling for the quantum-selected configuration interaction.
The total number of shots will be the number of circuits times the number of shots per circuit. The number of circuits will be determined by the
SqDriftOptionsused.- Parameters:
shots (int) – The number of shots per circuit to be used for the sampler. Defaults to 100. Must be a positive integer.
- Return type:
Self
- class StandardIterativeVqeGroundStateCalculatorCreator
Bases:
VqeCreatorEstimatorMixin[SecondQuantizationAdaptiveVqeCreator],VqeCreatorMinimizerMixin[SecondQuantizationAdaptiveVqeCreator],VqeCreatorReminimizerMixin[SecondQuantizationAdaptiveVqeCreator],VqeCreatorOptionsMixin[SecondQuantizationAdaptiveVqeCreator],VqeCreatorStoppingCriterionMixin[SecondQuantizationAdaptiveVqeCreator],VqeCreatorGateSelectorMixin[SecondQuantizationAdaptiveVqeCreator],VqeCreatorDataPersisterManagerMixin[SecondQuantizationAdaptiveVqeCreator],ChooseInitialAnsatzBuilderMixinBuilder 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:
- choose_initial_ansatz_builder() InitialAnsatzBuilderSubCreator[Self]
Choose the initial ansatz builder for the VQE calculation.
The initial ansatz defines the starting quantum state for the adaptive VQE. By default, a Hartree-Fock initial state is used.
- Return type:
- 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:
- create() AdaptiveVqeGroundStateCalculator
Create an instance of
AdaptiveVqeGroundStateCalculator.- Return type:
- 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.
This is the number of shots that will be used in each call to the quantum computer or simulator, and not necessarily the total number of shots. The total number of shots will in many cases be much higher.
- 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_excitation_gate_pool_options(options: ExcitationGatePoolOptions) Self
Include/Exclude double excitations in the gate pool.
- Parameters:
options (ExcitationGatePoolOptions)
- 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
- with_total_estimator_shots(shots: int | None) Self
Set the total number of shots to use for each estimator call.
The total number of shots are then distributed across the different groups in the estimator according to the shots per group strategy of the estimator. This ensures better use of the shot budget, and therefore, better use of the quantum resources.
- 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 TrimCIGroundStateCalculatorCreator
Bases:
objectCreator for a Trimmed CI ground state problem calculator.
- __init__(*, paired_electron_approximation: bool = False) None
Initialize with no options set.
- Parameters:
paired_electron_approximation (bool) – If
True, only paired alpha/beta excitations are used during expansion.- Return type:
None
- create() TrimConfigurationInteractionGroundStateCalculator
Create an instance of
TrimConfigurationInteractionGroundStateCalculator.- Return type:
- with_options(options: TrimCIOptions) Self
Set the options for the CI problem calculator.
- Parameters:
options (TrimCIOptions) – The options to use.
- Return type:
Self
- class VqeGroundStateCalculatorCreator
Bases:
objectBuilder 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:
- 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:
- 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().
- class VqeSecondOrderCorrectorMixin
Bases:
Generic[VqeCreatorWithEstimatorT],ABCMixin to add second order corrector options to a creator that owns a vqe_creator.
- Classes using this mixin must initialize the following attributes in their __init__:
_include_second_order_corrector: bool
_second_order_corrector_estimator: Estimator | None
_second_order_correction_mode: BeastCorrectionModeLiteral | str
- with_second_order_corrector(estimator: Estimator | None = None, correction_mode: Literal['standard', 'singles', 'standard_and_singles'] = 'standard', options: BeastSecondOrderPerturbationCorrectorOptions | None = None) Self
Set the corrector to calculate the correction to the final energy.
- Parameters:
estimator (Estimator | None) – The estimator to be used for the second order correction. Can be created using the
estimator_creator()builder.correction_mode (Literal['standard', 'singles', 'standard_and_singles']) – The mode of second order correction to use.
options (BeastSecondOrderPerturbationCorrectorOptions | None) – Options for the second order perturbation corrector. If None, default options will be used.
- Return type:
Self
- 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: