qrunch.chemistry.qrackle.scf.orbital_rotation.orbital_rotation_protocol
Protocols for orbital-rotation Hessian products and preconditioners.
Classes
Precondition Davidson residuals directly in their compact occupied-virtual representation. |
|
Convert full orbital-rotation generators to and from compact occupied-virtual blocks. |
|
Injectable Hessian-vector product for the orbital-rotation optimizer. |
|
Approximate shifted Hessian inverse for expanding the Davidson subspace. |
- class OccupiedVirtualBlockPreconditioner
Bases:
Protocol[TSCFMatrix]Precondition Davidson residuals directly in their compact occupied-virtual representation.
An approximate inverse of the shifted orbital Hessian turns a residual into a candidate direction for expanding the Davidson subspace. This changes how the eigensolver searches, not the Hessian operator being solved.
Input and output use the same compact basis and layout as
OccupiedVirtualCompactRepresentation. UnlikeOrbitalStepPreconditioner, this interface avoids expanding residuals into full antisymmetric matrices just to precondition them.An orbital-energy implementation divides each residual entry by its corresponding orbital-energy gap minus the shift, with small denominators bounded away from zero.
- __init__(*args, **kwargs)
- apply_to_occupied_virtual_block(block: TSCFMatrix, shift: float) TSCFMatrix
Return a new preconditioned block without modifying the input.
The result retains the input’s compact basis, shape and spin-channel layout. The caller owns the returned block.
- Parameters:
block (TSCFMatrix) – Compact occupied-virtual representation of a Davidson residual.
shift (float) – Eigenvalue estimate subtracted from the Hessian approximation before inversion.
- Return type:
TSCFMatrix
- class OccupiedVirtualCompactRepresentation
Bases:
Protocol[TSCFMatrix]Convert full orbital-rotation generators to and from compact occupied-virtual blocks.
A full generator is an antisymmetric matrix. In the occupied/virtual orbital basis, its two off-diagonal blocks are negative transposes of each other and therefore encode the same rotations. Rotations within the occupied space or within the virtual space do not change the occupied subspace and are discarded.
The compact representation stores only the virtual-occupied block: one row per virtual orbital and one column per occupied orbital. For \(N\) total orbitals and \(N_{\mathrm{occ}}\) occupied orbitals, this requires \((N - N_{\mathrm{occ}}) N_{\mathrm{occ}}\) independent entries per spin channel instead of a full \(N \times N\) matrix.
The stored block is scaled by \(\sqrt{2}\) to account for both off-diagonal blocks in the full matrix. This makes its Frobenius inner products and norms match those of the full occupied-virtual generators. Conversion back restores both off-diagonal blocks, leaving the within-occupied and within-virtual blocks zero.
- __init__(*args, **kwargs)
- from_occupied_virtual_block(block: TSCFMatrix) TSCFMatrix
Return the antisymmetric orthonormal-basis generator of a compact representation.
- Parameters:
block (TSCFMatrix) – Compact occupied-virtual representation.
- Return type:
TSCFMatrix
- to_occupied_virtual_block(generator: TSCFMatrix) TSCFMatrix
Return the compact representation of the occupied-virtual part of a generator.
- Parameters:
generator (TSCFMatrix) – Antisymmetric generator in the orthonormal basis.
- Return type:
TSCFMatrix
- class OrbitalHessianVectorProduct
Bases:
Protocol[TSCFMatrix]Injectable Hessian-vector product for the orbital-rotation optimizer.
Given a trial antisymmetric rotation \(X\) (in the orthonormal basis) it returns \(H[X]\) (also antisymmetric, in the orthonormal basis).
- __init__(*args, **kwargs)
- apply(trial: TSCFMatrix) TSCFMatrix
Compute \(H[X]\) for a trial rotation \(X\).
- Parameters:
trial (TSCFMatrix) – Antisymmetric trial rotation in the orthonormal basis.
- Return type:
TSCFMatrix
- apply_many(trials: list[TSCFMatrix]) list[TSCFMatrix]
Compute \(H[X]\) for several trial rotations.
- Parameters:
trials (list[TSCFMatrix]) – Antisymmetric trial rotations in the orthonormal basis.
- Return type:
list[TSCFMatrix]
- class OrbitalStepPreconditioner
Bases:
Protocol[TSCFMatrix]Approximate shifted Hessian inverse for expanding the Davidson subspace.
- __init__(*args, **kwargs)
- apply(residual: TSCFMatrix, shift: float) TSCFMatrix
Return a new preconditioned residual matrix.
- Parameters:
residual (TSCFMatrix) – Antisymmetric Davidson residual in the orthonormal basis.
shift (float) – Augmented-Hessian level shift.
- Return type:
TSCFMatrix