qrunch.chemistry.calculators.quantum_selected_configuration_interaction.prime_sqdrift_calculator

PRIME-SqDRIFT ground state calculator with SHARP adaptive reweighting and other enhancements.

class PrimeSqDriftGroundStateCalculator

Bases: object

Ground state energy calculator using PRIME-SqDRIFT enhancements.

PRIME-SqDRIFT brings together Kvantify’s proprietary SqDRIFT functionality. PRIME is an acronym for for Progressive Refinement for Improved Measurement Efficiency.

__init__(sampler: Sampler, *, shots_per_circuit: int, time_step: float = 1.0, options: PrimeSqDriftOptions | None = None) → None

Initialize the ground state energy calculator with PRIME-SqDRIFT enhancements.

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

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

  • time_step (float) – Reference time step \(\tau\); the evolution time for order \(k\) is \(k \tau\).

  • options (PrimeSqDriftOptions | None) – Options for PRIME-SqDRIFT enhancements; if not provided, defaults are used.

Return type:

None

calculate(problem: RestrictedGroundStateProblem | LazyRestrictedGroundStateProblem | UnrestrictedGroundStateProblem | LazyUnrestrictedGroundStateProblem, initial_vqe_result: AdaptiveVqeGroundStateProblemCalculatorResult | None = None, *, callback: SubspaceUpdateCallback | None = None) → QuantumSelectedConfigurationInteractionGroundStateProblemCalculatorResult
calculate(problem: RestrictedReactionPathProblem | UnrestrictedReactionPathProblem, initial_vqe_result: AdaptiveVqeReactionPathProblemCalculatorResult | None = None, *, callback: SubspaceUpdateCallback | None = None) → ReactionPathProblemCalculatorResult

Calculate the expectation value of the ground state energy of the given molecule/reaction.

Pass a plain object implementing both record_circuit_sampled and record_subspace_update(...) to follow progress. See Follow the progress of a run for an example without Qrunch imports or subclassing. SubspaceUpdateCallback and SamplingRunSummary are available in qrunch.type_defs for optional annotations.

Parameters:
Return type:

QuantumSelectedConfigurationInteractionGroundStateProblemCalculatorResult | ReactionPathProblemCalculatorResult

class PrimeSqDriftOptions

Bases: SqDriftOptions

Options for PRIME-SqDRIFT enhancements.

All fields are immutable (frozen=True) so an instance can be safely reused.

Parameters:
  • subsequence_length – Number of Hamiltonian terms sampled into each qDRIFT time-evolution circuit, i.e. the length (gate count) of the qDRIFT subsequence. Larger means more precise.(default=10)

  • maximum_krylov_order – Largest Krylov order \(d\); circuits are generated for every order \(k = 1, \ldots, d\). Larger means more precise. (default=1)

  • number_of_randomizations – Number of qDRIFT circuits generated per Krylov order. More means a more precise estimate of the Krylov subspace, at the cost of more samples. (default=1)

  • seed – Optional seed for qDRIFT term sampling and iterative eigensolver probes. (default = None).

  • use_qeb_gates – Whether to use QEB excitation gates instead of exact fermionic time evolution. (default=True).

  • update_frequency – Number of circuits sampled between successive updates of the sampling strategy. Defaults to 10.

  • passes – Number of passes over the Krylov sequence. Defaults to 1.

  • maximum_blending – The maximum blending.

  • minimum_determinant_weight – The minimum determinant weight.

  • state_preparation_options – Options for the beam search re-preparing the Krylov reference state from the subspace wavefunction; None keeps the Hartree-Fock reference throughout. Defaults to None.

  • minimum_state_encoding_coefficient – Determinants whose configuration-interaction coefficient \(|c_d|\) falls below this are left out of the state encoding. Defaults to 0.0.

  • apply_natural_orbital_transformation – Whether to rotate the Hamiltonian and determinants to the natural orbital basis at each update step. Defaults to False.

  • natural_orbital_transformation_skip_threshold – Frobenius-norm distance threshold \(\|U - I\|_F\) below which orbital transformation is skipped. Defaults to 1e-3.

  • natural_orbital_coefficient_threshold – Threshold on the determinant expansion coefficient for keeping determinants in the rotated natural orbital basis. Defaults to 1e-4.

  • pruning_threshold – The pruning threshold.

  • pruning_strategy – The pruning strategy.

  • include_disconnected_reference – Encode a superposition with the lowest-diagonal-energy spin-conserving single excitation in a provably disconnected sector, if its diagonal energy is below Hartree-Fock. Adds one single-excitation gate. Does not apply to the paired-electron approximation, and is skipped when the reference is not a single determinant, e.g. when starting from a VQE result. Defaults to True.

__init__(*, subsequence_length: int = 10, maximum_krylov_order: int = 1, number_of_randomizations: int = 1, use_qeb_gates: bool = True, seed: int | None = None, update_frequency: int = 10, passes: int = 1, maximum_blending: float = 1.0, minimum_determinant_weight: float = 0.0, state_preparation_options: FixedParticleNumberStatePrepBeamSearchOptions | None = None, minimum_state_encoding_coefficient: float = 0.0, apply_natural_orbital_transformation: bool = False, natural_orbital_transformation_skip_threshold: float = 0.001, natural_orbital_coefficient_threshold: float = 0.0001, pruning_threshold: float = 4e-05, pruning_strategy: PruningStrategy = PruningStrategy.COEFFICIENT, include_disconnected_reference: bool = True) → None
Parameters:
  • subsequence_length (int)

  • maximum_krylov_order (int)

  • number_of_randomizations (int)

  • use_qeb_gates (bool)

  • seed (int | None)

  • update_frequency (int)

  • passes (int)

  • maximum_blending (float)

  • minimum_determinant_weight (float)

  • state_preparation_options (FixedParticleNumberStatePrepBeamSearchOptions | None)

  • minimum_state_encoding_coefficient (float)

  • apply_natural_orbital_transformation (bool)

  • natural_orbital_transformation_skip_threshold (float)

  • natural_orbital_coefficient_threshold (float)

  • pruning_threshold (float)

  • pruning_strategy (PruningStrategy)

  • include_disconnected_reference (bool)

Return type:

None

apply_natural_orbital_transformation: bool = False
include_disconnected_reference: bool = True
maximum_blending: float = 1.0
maximum_krylov_order: int = 1
minimum_determinant_weight: float = 0.0
minimum_state_encoding_coefficient: float = 0.0
natural_orbital_coefficient_threshold: float = 0.0001
natural_orbital_transformation_skip_threshold: float = 0.001
number_of_randomizations: int = 1
passes: int = 1
pruning_strategy: PruningStrategy = 'Coefficient'
pruning_threshold: float = 4e-05
seed: int | None = None
state_preparation_options: FixedParticleNumberStatePrepBeamSearchOptions | None = None
subsequence_length: int = 10
update_frequency: int = 10
use_qeb_gates: bool = True