qrunch.quantum.algorithms.second_quantization.orbital_optimizers.creators_impls

Module containing builders for orbital optimizers.

Classes

NewtonOrbitalOptimizerCreator

Builder for the orbital optimizer algorithm using Newton's method.

SimpleOrbitalOptimizerCreator

Creator for the orbital optimizer algorithm.

class NewtonOrbitalOptimizerCreator

Bases: object

Builder for the orbital optimizer algorithm using Newton’s method.

__init__() → None

Initialize builder for the orbital optimizer.

Return type:

None

choose_gradient_calculator() → GradientCalculatorSubCreator[Self]

Choose gradient calculator to use for the orbital optimizer.

Return type:

GradientCalculatorSubCreator[Self]

create() → NewtonOrbitalOptimizer

Create an instance of NewtonOrbitalOptimizer.

Return type:

NewtonOrbitalOptimizer

with_basin_hopping_options(basin_hopping_options: BasinHoppingOptions) → Self

Set the basin-hopping options for global optimization.

Parameters:

basin_hopping_options (BasinHoppingOptions) – Options controlling the basin-hopping wrapper.

Return type:

Self

with_options(options: NewtonMinimizerOptions) → Self

Set the options to use for the orbital optimizer.

Parameters:

options (NewtonMinimizerOptions) – Options to pass to the minimizer

Return type:

Self

with_shots(shots: int | None) → Self

Set the number of shots to use when calling the gradient_calculator to compute the energy, gradient, etc.

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 when calling the gradient_calculator to compute the energy, gradient, etc.

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 SimpleOrbitalOptimizerCreator

Bases: object

Creator for the orbital optimizer algorithm.

__init__() → None

Initialize builder for the orbital optimizer.

Return type:

None

choose_minimizer() → MinimizerSubCreator[Self]

Choose minimizer to use for the orbital optimizer.

Return type:

MinimizerSubCreator[Self]

create() → SimpleOrbitalOptimizer

Create an instance of SimpleOrbitalOptimizer.

Return type:

SimpleOrbitalOptimizer

with_estimator(estimator: Estimator) → SimpleOrbitalOptimizerCreator

Set the estimator to use for the orbital optimizer.

Parameters:

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

Return type:

SimpleOrbitalOptimizerCreator

with_shots(shots: int | None) → Self

Set the number of shots to use when calling 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 number of shots to use when calling the estimator.

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