vibe-qcDocumentation

The real fold tensor: exchange order without symmetric factors

AICCM/CCM remains experimental. VibeQCAICCM/FoldFit.lean adds nine kernel-checked claims about the fitted tensor in the order the real-Gamma route contracts it. The first AICCM tranche states the Gram order under a row-symmetry hypothesis. These claims need no such hypothesis. No reported energy changes.

Why the fold order is stated

The first tranche (Fitting.lean, derivation) writes the fitted integral as gramERI,

V(ij|kl) = sum_P B_P[i,j] B_P[k,l],

and assumes that every factor row is symmetric, B_P[i,j] = B_P[j,i] (hypothesis sym). With the exchange convention K_ij = sum_kl V(ik|jl) D_kl this gives K = sum_P B_P D B_P^T.

The production factors are the real fold stack of periodic/ccm/neutral.py::ccm_neutral_cderi_fold. Its fold identity is

(ab|cd) = sum_q sum_P B_q[P,a,b] conj(B_q[P,d,c]),

with the second pair reversed, and the program evaluates K = sum_P L_P D L_P (ccm_ri_k_neutral), which is the exchange map of

foldERI(ij|kl) = sum_P B_P[i,j] B_P[l,k].

The statements below are written for that order and need no symmetry of the factor rows. For symmetric rows the two tensors are the same.

Correction of 2026-11-14. This note first said that the rows of the fold stack are not symmetric once the basis has functions beyond s shells, on the strength of a comment in ccm_ri_k_neutral_factored. That was not measured when it was written, and the measurement in the last section of this note does not reproduce it: on every cell tested the rows are symmetric to rounding and the hypothesis sym holds numerically. The first tranche therefore describes the program on those cells. The fold statements remain the ones that hold for any real factors.

Statements

Indices are real supercell AOs, Aux is the retained auxiliary set, and all scalars are real. Units and conventions are those of the first tranche: S and the spin-summed D dimensionless, energies in Hartree, xi the signed self-potential, one positive cell divisor.

Claim

Statement

fold_symmetric_gram

Under sym, foldERI = gramERI entry for entry.

fold_exchange_matrix

The exchange contraction of foldERI equals sum_P (B_P D B_P)_ij.

gram_exchange_matrix

The exchange contraction of gramERI equals sum_P (B_P D B_P^T)_ij.

fold_coulomb_gram

For symmetric D the two Coulomb matrices agree.

fold_coulomb_nonnegative

For symmetric D, D . J(D) is a sum of squares, hence nonnegative.

fold_swap_reciprocal

A pair kernel with W(q~,p~) = W(p,q), the tilde reversing a pair, is self-adjoint on symmetric pair vectors.

fold_kernel_reversal

The RHF kernel of foldERI plus the seam xi/2 S x S has that reversal symmetry when S is symmetric.

fold_energy_expansion

Exact quadratic expansion of the electronic energy along D + t X, from reciprocity on D and X only.

fold_per_cell_derivative

For arbitrary real factors and symmetric S, D, X: the derivative at t = 0 of the per-cell total energy is X . F(D) / N_c.

The last line replaces fitted_per_cell_derivative for the production tensor. It needs no symmetry of individual factor rows. The reversal symmetry is automatic: reversing both pairs and exchanging them maps B_P[i,j] B_P[l,k] to B_P[l,k] B_P[i,j]. On symmetric matrices this is trace cyclicity, tr(X L D L) = tr(D L X L).

What is not covered

  • The Fock matrix built from a general stack need not be symmetric. Its symmetry requires the bra-ket and first-pair symmetries of the complete folded tensor, which come from the conjugate pairing of transfer channels, not from these claims. The program symmetrises F after the build. VibeQCRHF.rhf_fock_symmetric applies once those symmetries are supplied.

  • Positivity is stated for the Coulomb form on symmetric densities only.

  • The fit-response statements (gamma_fit_difference, gamma_fit_bound, supplement Eq. (L9)) are written for arbitrary four-index tensors and need no change. formal/check_aiccm_fit_response.py still builds its tensors in the Gram order. formal/aiccm_reference.py contracts in the fold order since the measurement below and no longer rejects non-symmetric factors.

  • Whether a factor stack reproduces a continuum integral is a separate obligation, as before.

Measured row symmetry of the dense fold stack

Measured on 2026-11-13 with ccm_neutral_cderi_fold (dense storage) on rocksalt LiH, a = 4.084 Angstrom, native core sha256 4dbf397e..., a source check under the stale-core override. max|L - L^T| is the largest element of L_P - L_P^T over the stack; the exchange column is max|sum_P L D L - sum_P L D L^T| on a random symmetric density.

| Basis | Mesh | Fit | AOs | max|L - L^T| | Exchange difference | |—|—|—|—:|—:|—:| | STO-3G | (2,1,1) | classic, tail resolved | 12 | 2.0e-14 | 3.2e-15 | | STO-3G | (2,1,1) | SR/LR | 12 | 4.6e-11 | 5.6e-13 | | STO-3G | (2,2,1) | SR/LR | 24 | 2.0e-11 | 3.2e-13 | | pob-DZVP-rev2 | (2,1,1) | SR/LR | 22 | 8.1e-12 | 4.7e-13 | | pob-TZVP-rev2 | (2,1,1) | SR/LR | 26 | 6.4e-11 | 3.7e-12 | | pob-TZVP-rev2 | (2,2,1) | classic, no tail | 52 | 8.2e-15 | 1.8e-15 | | pob-TZVP-rev2 | (2,2,1) | classic, no tail, historical_index_ball | 52 | 2.1e-14 | 2.7e-15 | | pob-TZVP-rev2 | (2,2,2) | classic, no tail | 104 | 5.3e-15 | 2.2e-15 |

On every cell tested, with p functions and with the polarized bases, the rows of the dense real fold stack are symmetric to rounding on the classic fit and to the integral screen of the builder on the SR/LR fit, and the Gram-order and fold-order exchange agree to the same level. The statement above that the rows are not symmetric beyond s shells is therefore not reproduced on the current dense fold: for these factors the sym hypothesis of the first tranche holds numerically and gramERI and foldERI are one tensor. The 5.6e-6 quoted in periodic/ccm/ri.py::ccm_ri_k_neutral_factored was measured on an earlier build and was not reproduced on the cell it names. The fold statements remain the ones that need no such hypothesis, and they are what the program evaluates.

formal/check_aiccm.py now contains both cases. A synthetic stack with non-symmetric rows checks the program’s J, K, factored K, energy formula and directional derivative against an independent explicit fold-order contraction, with the Gram order as the negative control. A complete two-cell calculation on LiH/STO-3G beside the H2 cell, on both named fits, compares the returned Fock and energy with the same reference and reports max|L - L^T| (1.3e-14 classic, 4.0e-11 SR/LR). 54 residuals pass (largest 3.7e-9 against 2e-8), 19 controls separate.

Check

python formal/check_proofs.py with the pinned Lake: 685 claims pass with the allowed axioms propext, Classical.choice and Quot.sound. No quantum-chemistry calculation is involved; these are finite identities.