qrunch.chemistry.calculators.quantum_selected_configuration_interaction.quantum_selected_configuration_interaction_calculator

Lowest states calculator using quantum-selected configuration interaction (QSCI) with a chosen subspace state generator.

Classes

QuantumSelectedConfigurationInteractionLowestStatesCalculator

Calculate the lowest energy states, the ground state included, with quantum-selected configuration interaction.

class QuantumSelectedConfigurationInteractionLowestStatesCalculator

Bases: object

Calculate the lowest energy states, the ground state included, with quantum-selected configuration interaction.

__init__(generator: SubspaceStateGenerator, sampler: Sampler, *, shots_per_circuit: int, paired_electron_approximation: bool, seed: int | None = None) → None

Initialize the QSCI lowest states calculator.

Parameters:
  • generator (SubspaceStateGenerator) – Strategy producing the circuits whose samples define the diagonalization subspace.

  • sampler (Sampler) – Sampler used to draw computational-basis samples from each circuit.

  • shots_per_circuit (int) – Number of samples to draw from each circuit.

  • paired_electron_approximation (bool) – Whether to use the paired-electron approximation.

  • seed (int | None) – Optional seed for iterative eigensolver probes. (default = None). Does not seed the generator or sampler.

Return type:

None

calculate(problem: RestrictedGroundStateProblem | LazyRestrictedGroundStateProblem | UnrestrictedGroundStateProblem | LazyUnrestrictedGroundStateProblem, initial_vqe_result: AdaptiveVqeGroundStateProblemCalculatorResult | None = None, *, n_lowest: int, callback: SamplingProgressCallback | None = None) → QuantumSelectedConfigurationInteractionLowestStatesResult
calculate(problem: RestrictedReactionPathProblem | UnrestrictedReactionPathProblem, initial_vqe_result: AdaptiveVqeReactionPathProblemCalculatorResult | None = None, *, n_lowest: int, callback: SamplingProgressCallback | None = None) → ReactionPathLowestStatesResult
calculate(problem: RestrictedGroundStateProblem | LazyRestrictedGroundStateProblem | UnrestrictedGroundStateProblem | LazyUnrestrictedGroundStateProblem, initial_vqe_result: AdaptiveVqeGroundStateProblemCalculatorResult | None = None, *, n_lowest: None = None, callback: SamplingProgressCallback | None = None) → QuantumSelectedConfigurationInteractionGroundStateProblemCalculatorResult
calculate(problem: RestrictedReactionPathProblem | UnrestrictedReactionPathProblem, initial_vqe_result: AdaptiveVqeReactionPathProblemCalculatorResult | None = None, *, n_lowest: None = None, callback: SamplingProgressCallback | None = None) → ReactionPathProblemCalculatorResult

Calculate the energies of the lowest states of the given molecule or of every geometry of a reaction.

To follow sampling progress, pass a plain object. Name the metrics you need and accept any remaining metrics with **_other_metrics:

class PrintProgress:
    def record_circuit_sampled(self, *, number_of_circuits: int, **_other_metrics: object) -> None:
        print(f"{number_of_circuits} circuits sampled")

result = calculator.calculate(problem, n_lowest=2, callback=PrintProgress())

See Follow the progress of a run for the full list of keyword arguments. No Qrunch imports or subclassing are needed.

Parameters:
Return type:

QuantumSelectedConfigurationInteractionGroundStateProblemCalculatorResult | ReactionPathProblemCalculatorResult | QuantumSelectedConfigurationInteractionLowestStatesResult | ReactionPathLowestStatesResult