qrunch.chemistry.hamiltonian_reweighting.sharp_reweighter

Epstein-Nesbet importance for reweighting Hamiltonian term-sampling probabilities.

class SharpReweighter

Bases: SecondQuantizedHamiltonianReweighter

Reweight term-sampling probabilities by the Epstein-Nesbet importance of the determinants they reach.

The current determinant subspace is diagonalized, and Hamiltonian terms are scored by the importance of the external determinants they connect to its ground state. This favors terms that discover important new determinants as the subspace grows. A determinant’s importance is the energy lowering from mixing it into the ground state; one with a lower diagonal energy than the ground state counts even when its couplings cancel, since it lowers the energy on its own.

The scores are mixed with the original qDRIFT sampling probabilities. At each rescoring, the mixing weight is chosen to maximize the importance expected to be captured within sample_budget term draws, balancing concentration on important terms against repeated draws of the same terms. maximum_blending caps the score-based fraction; 0.0 keeps the original distribution. At full weight, terms that reach no new determinant, such as number operators, are no longer sampled.

__init__(subspace_diagonalizer: SubspaceDiagonalizer, *, sample_budget: int, maximum_blending: float = 1.0, minimum_determinant_weight: float = 0.0) → None

Initialize the SHARP reweighter.

Parameters:
  • subspace_diagonalizer (SubspaceDiagonalizer) – Supplies the subspace ground state the terms are scored against. It must be kept in the same orbital basis as this reweighter.

  • sample_budget (int) – The number of terms drawn from a reweighted Hamiltonian before the next reweighting, which sets how far the blend can be pushed towards the scores before the extra concentration only buys repeats.

  • maximum_blending (float) – The largest weight \(\alpha \in [0, 1]\) the scores may be given; 0.0 reproduces the unweighted qDRIFT distribution and 1.0 leaves the choice entirely to the capture criterion.

  • minimum_determinant_weight (float) – Subspace determinants carrying a weight \(c_d^2\) below this are left out of the scores; 0.0 expands every determinant without coefficient screening.

Return type:

None

reweight(hamiltonian: SecondQuantizedHamiltonian, determinants: list[int]) → SecondQuantizedHamiltonian

Rescale the term coefficients by the Epstein-Nesbet importance of the determinants they reach.

The Hamiltonian is returned unchanged when no external determinant is reachable, which happens for a subspace that is already closed under the Hamiltonian.

Successive calls share a cached term index, so every call between two update_hamiltonian() calls must be given a Hamiltonian with the same terms in the same order.

Parameters:
  • hamiltonian (SecondQuantizedHamiltonian) – The original second-quantized Hamiltonian; passing back a previous result would compound the blending.

  • determinants (list[int]) – Determinants discovered so far, as computational-basis bitstring integers.

Return type:

SecondQuantizedHamiltonian

update_hamiltonian(hamiltonian: FermionHermitianSum | PairedHardcoreBosonHermitianSum) → None

Adopt the integrals of the current orbital basis and drop everything derived from the previous one.

Parameters:

hamiltonian (FermionHermitianSum | PairedHardcoreBosonHermitianSum) – The second-quantized Hermitian sum in the current orbital basis.

Return type:

None