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
|
Calculate the lowest energy states, the ground state included, with quantum-selected configuration interaction. |
- class QuantumSelectedConfigurationInteractionLowestStatesCalculator
Bases:
objectCalculate 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:
problem (RestrictedGroundStateProblem | LazyRestrictedGroundStateProblem | UnrestrictedGroundStateProblem | LazyUnrestrictedGroundStateProblem | RestrictedReactionPathProblem | UnrestrictedReactionPathProblem) – Ground state problem or reaction path problem to calculate the energies for.
initial_vqe_result (AdaptiveVqeGroundStateProblemCalculatorResult | AdaptiveVqeReactionPathProblemCalculatorResult | None) – Optional VQE result to use as the starting point for the calculation. For a GeneralGroundStateProblem this must be an AdaptiveVqeGroundStateProblemCalculatorResult, and for a ReactionPathProblem an AdaptiveVqeReactionPathProblemCalculatorResult.
n_lowest (int | None) – Number of lowest states to calculate, the ground state included. When omitted, only the ground state is calculated and a ground-state result is returned.
callback (SamplingProgressCallback | None) – An optional object whose
record_circuit_sampledmethod receives metrics by keyword after every sampled circuit. A bare function is not accepted. The counts restart for each geometry along a reaction path.
- Return type:
QuantumSelectedConfigurationInteractionGroundStateProblemCalculatorResult | ReactionPathProblemCalculatorResult | QuantumSelectedConfigurationInteractionLowestStatesResult | ReactionPathLowestStatesResult