qrunch.chemistry.hamiltonian_reweighting.hamiltonian_reweighter_protocols
Protocol for strategies rescaling the term coefficients of a second-quantized Hamiltonian.
Classes
Protocol for strategies rescaling the Hermitian term coefficients of a second-quantized Hamiltonian. |
- class SecondQuantizedHamiltonianReweighter
Bases:
ProtocolProtocol for strategies rescaling the Hermitian term coefficients of a second-quantized Hamiltonian.
Randomized compilers such as qDRIFT sample term \(j\) with probability \(|c_j| / \lVert H \rVert_1\), so rescaling the coefficients steers which terms are compiled. A reweighter derives such a rescaling from the determinants discovered so far.
The reweighted operator is deliberately not the original Hamiltonian, and a circuit compiled from it does not approximate \(e^{-iHt}\). In quantum-selected configuration interaction that is harmless: the circuits only generate determinants, and the energy comes from an exact diagonalization in their span, so steering changes which subspace is diagonalized but never biases the variational estimate.
Implementations are expected to preserve the \(\ell_1\) norm and the sign of every coefficient, so that the compiled circuits keep the gate count and rotation angles of the unweighted run.
- __init__(*args, **kwargs)
- reweight(hamiltonian: SecondQuantizedHamiltonian, determinants: list[int]) SecondQuantizedHamiltonian
Rescale the term coefficients of the Hamiltonian using the determinants found so far.
- Parameters:
hamiltonian (SecondQuantizedHamiltonian) – The second-quantized Hamiltonian to rescale. Callers must always pass the original Hamiltonian rather than the result of a previous call, otherwise the rescaling compounds.
determinants (list[int]) – Determinants discovered so far, as computational-basis bitstring integers.
- Return type: