pytc.solver.bug_rpa

BUG-dRPA: low-rank direct RPA, matrix-free and iterative.

The Riccati amplitude is kept as T = U diag(S) U^T in the occupied-virtual pair space. Each iteration augments U with projected-residual directions, solves the Galerkin (Casida) problem in the augmented space exactly, damps and truncates. Two residencies:

  • host_backed=False – B_ov and U on the device;

  • host_backed=True – B_ov and every pair-height array in host memory, streamed to the device one row panel at a time, for systems whose pair-height arrays do not fit in device memory.

Functions

_initial_guess

Normalize and validate a low-rank initial factorization.

_owned

Mask to the rows panel i owns: the clamped tail panel repeats rows.

_panel_plan

Row panel and panel count, clamped to the array.

_panel_slices

_residual_panel

basis_update

Form the updated amplitude basis without extra full-height results.

df_weighted_energy_host_streamed

sum_r S_r ||B.T U_r||^2 with B host-resident.

fused_host_streamed_core

Core Grams and the selected projected residual, without forming BU.

hostbacked_core_blocks

Projected core blocks with every tall operand on the host.

kernel

Low-rank closed-shell dRPA from the DF factor B_ov (nocc, nvir, naux) and eia = e_i - e_a.

low_rank_rpa

Low-rank closed-shell dRPA of a PySCF density-fitted mean field.

pair_window

Orbitals that can give (f > 0) and take (f < 2) an electron.

projected_residual

RPA residual D = 2 BU (1+S) + d U S deflated twice against U.

rpa_inputs

(B, eia) for kernel() from a closed-shell PySCF DF mean field.

streamed_core_grams

(U.T @ (d U), 2 U.T @ BU) without a full-height intermediate.

streamed_orth_directions

Rank-revealing orthonormal basis of a HOST-resident block.

streamed_reorthogonalize

Second Gram-Schmidt pass of host-resident Q against the host basis U, streamed by row panels: C = U^T Q; if max|C| > tol, Q <- Q - U C (in place).

streamed_tsqr_r

R factor of a host-resident tall matrix, by panel reduction.

weighted_pairs

Direct-RPA pair factors and gaps for a (possibly) fractional reference.