Repository navigation
Feat: add PPCG solver for PW diagonalization (reopened) - #8042
cheerly-pku wants to merge 201 commits into
Conversation
Consider the previous contributions made by classmates, I'm only capable to make small difference without disrupting the entire program ---- like such a small "static".
…w_Small-Changes 2025PKUCourseHW5: Case: 1 - Change rank_seed_offset to static const
…ent) Add PPCG iterative diagonalization with two strategies: - CONJUGATE_GRADIENT: band-by-band Polak-Ribiere CG (verified working) - BLOCK_SUBSPACE: block subspace diagonalization Includes potrf retry fix: save/restore original matrix before applying diagonal shift, preventing accumulated shifts from corrupting the matrix. Test: 1D particle-in-a-box (n_dim=10), CG strategy matches exact eigenvalues with error 4.3e-12. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ormalization Three fixes for numerical stability: 1. potrf: save/restore original matrix before diagonal shift retries, preventing accumulated shifts from corrupting the Cholesky factor. 2. sygvd/syevd: skip workspace query (lwork=-1) and allocate directly. The LAPACK replacement ignores workspace queries, causing the second call to operate on already-transformed data, corrupting eigenvalues. 3. Block subspace: add chol_qr + hpsi/spi recomputation after update_one_block and every rayleigh_ritz, keeping wavefunctions S-orthonormal and preventing numerical drift of H|psi> and S|psi>. Results (1D particle-in-a-box, S=I): - CG nband=1: error 4.3e-12 (unchanged, already working) - BLOCK_SUBSPACE nband=1: no longer NaN, converges (to wrong eigenvalue due to algorithmic limitation with S=I)
… RR steps 1. solve_small_generalized: save/restore M matrix before retry with shifts (prevents accumulation of shifts on sygvd-corrupted M) 2. BLOCK_SUBSPACE: add Krylov fallback for near-collinear p/w vectors When p is nearly parallel to w (cos^2 > 0.99), replace p with H·w to keep the 3-vector subspace [psi, w, p] full rank. This fixes NaN eigenvalues for nband>1 with S=I. 3. LAPACK: use standard workspace query (lwork=-1) pattern for syevd/sygvd More robust with real LAPACK implementations. 4. CG: add periodic Rayleigh-Ritz subspace rotation every rr_step iterations Corrects band ordering and eigenvalue estimates after band-by-band line minimization. Resets PR state after rotation.
The gamma_dot function returns only the real part of inner products, which is correct for Hermitian forms like <psi|H|psi> but wrong for projection coefficients where the imaginary part matters. In orth_gradient and project_against, the projection coefficient <psi_i | v> must use the full complex inner product to correctly remove the overlap. Using only Re(<psi_i | v>) leaves an imaginary component that corrupts the search direction, causing excited-state bands to converge to wrong eigenvalues. This fixes the CG strategy bands 1 and 2 converging to the highest eigenvalue (3.919) instead of the first excited states.
…PACE The chol_qr_active call after update_one_block re-orthonormalized psi but left the p vector in the old basis, creating an inconsistency. The p vector is constructed in update_one_block using the same subspace rotation as psi, so they start consistent. Adding chol_qr_active before the p vector is updated breaks this consistency.
This change was unrelated to the PPCG integration and should not have been included.
H and S are real symmetric operators whose eigenvectors are real. The previous complex random initialization produced complex off-diagonal elements in the H-gram matrix (max |Im| ~ 0.5 for nband=3), causing Re(<psi_i|H|psi_j>) != <psi_i|H|psi_j>. The gamma_dot function only returns the real part, so all subspace Gram matrices (built via gram()) computed wrong off-diagonals, leading to incorrect eigenvalues from sygvd. With real-only psi all inner products are real and gamma_dot is exact, so both BLOCK_SUBSPACE and CONJUGATE_GRADIENT strategies should now converge to the correct eigenvalues.
…tioning The 3-block subspace method builds a generalized eigenvalue problem with basis V = [psi, w, p] where p is constructed from the previous subspace eigenvectors (p_new += w_l * cw in update_one_block). This makes p a linear combination of the w vectors, causing the [w, p] block of the S-gram matrix M to become nearly rank-deficient. With nband=3 and sbsize=4 the 9x9 M matrix has condition number large enough that dsygvd produces negative eigenvalues for the positive-definite problem (observed: -0.26 at iter=2), and the eigenvalues diverge exponentially thereafter. Setting use_p=false reduces the subspace to [psi, w] (2-block), which is a preconditioned Davidson-like method. It converges robustly: the BLOCK_SUBSPACE test now passes in 57 ms with all 3 eigenvalues within 1e-8 of the exact values. The 3-block code path is preserved for future re-enablement once a more robust p-vector construction is implemented.
With rr_step=4, the non-RR iterations use Cholesky orthonormalization
which mixes bands through the upper-triangular U^{-1}, causing high-energy
bands to contaminate low-energy ones. This drives CG eigenvalues to the
spectrum maximum [3.31, 3.68, 3.92] instead of the correct lowest values
[0.081, 0.317, 0.690].
Using rr_step=1 forces Rayleigh-Ritz every iteration, which correctly
diagonalizes the subspace and preserves band ordering.
The orth_cholesky call before rayleigh_ritz mixes bands through the
upper-triangular U^{-1} factor, contaminating low-energy bands with
high-energy components. This drives CG eigenvalues to the spectrum
maximum instead of the minimum.
rayleigh_ritz solves the generalized eigenvalue problem K v = λ M v
via dsygvd, which correctly handles non-S-orthogonal bases. The
orth_cholesky is not needed and is actively harmful.
This makes the CG RR path consistent with BLOCK_SUBSPACE, which
calls rayleigh_ritz without prior orth_cholesky.
BLOCK_SUBSPACE starts with rayleigh_ritz (line 1085) which finds correct eigenvalues and rotates psi before the iteration loop. CG was using diagonal Rayleigh quotients instead — these are poor approximations for random initial guesses, producing wrong gradients that drive the band-by-band line_minimize toward high-energy eigenstates. With rr_step=1 (every-iteration RR), the CG loop itself is now correct, but without an initial RR the first line_minimize step already pushes psi in the wrong direction, and subsequent RR steps cannot fully recover.
Backup preserved at diago_ppcg_test.cpp.bak
The linear approximation α = -C/B drops the α² term from the Rayleigh quotient derivative dR/dα = 0. This picks one of the two stationary points (minimum or maximum) arbitrarily. For bands far from convergence it can select the MAXIMUM, driving ψ toward high-energy states instead of the desired lowest eigenvalues. Solve the full quadratic Aα² + Bα + C = 0, evaluate R(α) for both roots (and the linear guess), and pick the one with the lowest R. Also restore the CG unit test (rr_step=1, initial rayleigh_ritz).
…e use_p
Three changes to make both PPCG strategies correctly converge with rr_step=4:
1. CG non-RR path: After orth_cholesky, solve the nband x nband subspace
generalized eigenvalue problem instead of using diagonal Rayleigh quotients.
The upper-triangular U^{-1} from Cholesky mixes high-energy components into
low-energy bands, making diagonal RQs overestimate the eigenvalues. The
subspace solve gives correct Ritz values without rotating the states,
preserving Polak-Ribiere conjugate-direction accumulators.
2. BLOCK_SUBSPACE: Re-enable use_p=true (3-block [psi, w, p] subspace).
The Krylov fallback (replace p with H·w when p ~ w) was already in place
but dead because use_p was hardcoded to false. Now it activates on the
first iteration (p is zero-initialized) and whenever p becomes collinear
with w after update_one_block.
3. CG test: Change rr_step from 1 back to 4 so the non-RR Cholesky path
is exercised, validating the true Polak-Ribiere CG mechanism.
The 3-block [psi, w, p] subspace generalized eigenproblem becomes ill-conditioned when residuals are small (near convergence). The [w, p] Gram block shrinks, the M matrix approaches singularity, and dsygvd produces garbage eigenvectors that drive eigenvalues to catastrophic values (e.g., -137775 instead of 0.081). The p-bad H·w Krylov fallback fixes p~w collinearity but does not address the small-residual ill-conditioning, which is fundamental to the 3-block construction. Keep use_p=false for robust convergence.
The [w,p] block of the Gram matrix M shrinks as residuals converge, making M nearly singular and causing sygvd to produce garbage eigenvectors. Scaling w and p to unit S-norm keeps M well-conditioned (diagonal ~1) without changing the subspace — Ritz values are identical and Ritz vector coefficients cancel in update_one_block. This enables the full 3-block [psi,w,p] subspace (use_p=true) by addressing the fundamental ill-conditioning that the p-bad Krylov fallback alone could not handle.
The Krylov fallback (replace p with Hw when p~w) was flawed: when w is approximately an eigenvector (Hw ≈ λw), the replacement does not fix collinearity. After S-norm scaling, p ≈ w still, M_wp ≈ [1,1;1,1] is rank-1, and dsygvd fails. Instead, simply skip p for this iteration (use_p_now=false). update_one_block still produces a valid p for the next iteration from the w Ritz-vector contribution.
Add tests for: - 2x2 matrix (smallest non-trivial case) - Degenerate eigenvalues (H = I + J, multiplicity-3 degeneracy) - Larger 20x20 tridiagonal with 5 bands - Dense 8x8 matrix via Givens rotations (addresses full-matrix coverage) All use CONJUGATE_GRADIENT strategy which has sygvd fallback. BLOCK_SUBSPACE tests deferred due to dsygvd instability with some LAPACK builds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Covers diagonal, tridiagonal, dense, pentadiagonal, degenerate, Neumann, S≠I, gamma_g0, single-band, all-band, many-band, bad preconditioner, tight threshold, scaled, gapped spectrum, rr_step=1, 1x1, and eigenvector quality checks. Adds QuickBenchmark (CI-friendly) and DISABLED_FullBenchmark.
|
Thank you for independently building the PR, running the focused tests and At We also tested the proposed square-root tolerance. It reduced work, but failed The default full-Ritz interval is now conservatively 1. During validation, The native 820 check also exposed why periodic refresh alone was insufficient: The description now correctly states that Davidson's basis is capped at The solver PR now has no diff under You are also right about
These should originally have been separate descriptive commits. We preserved The updated PR description lists exact build/test commands, the four-case One remaining limitation deserves emphasis: after removing the PPCG-only |
|
Fresh full CI remains green: 17 recorded check runs, including governance reruns, and Scope and unchanged-input resultsThe current list has 130 cases: 121 original CG/Davidson/default-CG inputs
All four native PPCG cases and five unchanged BPCG controls pass on both Build limitations are recorded rather than counted as PPCG numerical defects: Numerical differences and convergence are separateFor the 121 main substitutions, full-precision final energy and complete There are 30 substituted cases with PPCG residual warnings: 23 still report
These are not all phase-sensitive outputs or harmless rounding. In a separate Bounded iteration diagnosticsSeparate copied inputs, using the separately identified same-head PW-only For Reproduction and next reviewGNU 12.3 / OpenMPI 5.0.10, Release, ELPA 2026.02.001, Libxc 7.0.0, LCAO/LibRI, From each independent case tree, using the unchanged test script and its export OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1
export PRTE_MCA_mapby=slot PRTE_MCA_bindto=none
bash ../integrate/Autotest.sh -a "$VALIDATION_BINARY" -n4 -o1 -j4 -f "$ACTIVE_CASE_LIST"Both main invocations exit 1; their nonpassing results above are preserved. @Critsium-xy, could you re-review the green-head implementation fixes and this |
Apply pw_diag_nmax through the shared PW setup for SCF and NSCF instead of retaining initial or previous calculation state. Keep the default at 50 and BPCG internal budgets unchanged. Document per-attempt semantics and regenerate INPUT docs. Verified: 9/9 typed diago_params tests; MODULE_HSOLVER_pw; regenerated 572 parameter descriptions; staged agent governance check.
Retain valid discarded local Ritz directions, inspect their projected physical Rayleigh quotients, and conditionally augment the global search while preserving the current X subspace. Reclassify the locked prefix and clear stale conjugate directions after recovery. Release superseded candidate buffers before the expanded solve. Add deterministic missed-root and complex generalized regressions plus a distributed recovery case. 50 double and 4 float tests, PW bridge, NSCF setup, MPI np2/3/6 and two-pool tests pass. INPUT metadata regenerated; staged governance passes. This fixes demonstrated local-direction loss, not a universal lowest-root certificate. Full integration revalidation is pending; strict fixed-H 078 still needs investigation at two k points.
Synchronize with deepmodeling/develop at 98c2e22 without rebasing. Preserve upstream DFT+U case renames and all four PPCG entries in CASES_CPU.txt. Accept removal of generated INPUT reference files; PPCG Input_Item metadata remains the source of truth. Focused MPI build succeeds; six PPCG/PW/parameter CTests pass, including np2/3/6 and two-pool regression. Explicit LAPACK comparison (200 10 5 4 4) passes. No PPCG numerical implementation, references, or tolerances changed by conflict resolution. Does not include the two unpublished local solver follow-up commits.
Conflict resolution:
|
Combine b5d5fdb and ad39c40 without rewriting either history. Retain upstream deletion of generated INPUT docs; updated C++ Input_Item metadata remains the documentation source. Verified build: abacus_pw_para plus focused hsolver targets. Focused CTest: 6/6, including 50 double, 4 float, 9 parameter and 6 PW tests and MPI np2/3/6 and two pools. Native and expanded integration issues remain under investigation; this local merge is not a release or full-validation claim.
Exercise kept counts 2, 3 and 7 in a rank-7 complex projected problem. Verify generalized residuals and overlap orthogonality for every valid output, including discarded directions consumed by low-root recovery. No production behavior or INPUT changes; no documentation regeneration is required. Verified freshly built MODULE_HSOLVER_ppcg: 51/51 pass, one benchmark remains disabled. No runtime solver change is included.
Resolve the stochastic HSolver test CMake conflict by keeping develop's formatting and the PPCG source registration. Preserve the original PR history and numerical implementation.
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
Static review of 8613b18477a71b0da091305ad7acfa9614497c4f against merge base 3ab6d32e7f45e626e98fdcf0121c3d6aa3e6b2ba, with independent A/B review and compatibility inspection of current develop at 75debc23d977ec932870bd4ed8f1178a3e628251.
git diff --check and the trusted governance check passed (eight reviewed warnings). No build, runtime, or CI verification was performed; the previously reported numerical validation limits remain open. The current target integration has a content conflict in source/source_hsolver/test/CMakeLists.txt, confirmed by static merge-tree inspection and GitHub.
Eight scoped inline points follow; the remaining cadence-guide correction is tracked in the existing Ritz discussion. This review does not establish an ordinary-size CPU mathematical defect.
Retain PPCG tests in the configure-time fixture setup, register ppcg in the unified solver domain, and pass the MPI test executable explicitly. Add INPUT round-trip, metadata and basis-compatibility checks. Seven focused CTests pass; full build and native-case validation are recorded separately.
Reject the unsupported sdft/ppcg combination during unified INPUT validation, including zero deterministic bands, and cover both rejection and supported CG controls. Document this restriction and correct the guide to distinguish full Ritz cadence from independent H/S image refresh.
Guard the optional mallinfo2 API for supported glibc versions and report an unavailable metric elsewhere. Label post-diag retained heap separately from peak memory, and describe each solver's stopping and restart behavior accurately.
Share checked int-index and LAPACK workspace limits across CPU and GPU entry paths, reject rank-local invalid shapes collectively, and avoid overflow in block-count arithmetic. Add bounded serial and asymmetric MPI regressions. Strengthen the generalized fixture to check lowest analytic roots, fresh residuals and S-orthogonality, and split grouped test declarations.
Replace the all-one smoke thresholds with measured per-property limits: 1e-6 eV energy, 0.02 eV/Angstrom force aggregate and 0.5 kbar stress aggregate. Preserve existing inputs and references. Record RTX3090 CPU/GPU paired agreement and observed reference offsets from repeated two-rank and four-rank runs.
|
Replying specifically to your October 22 review summary of The conflict in The wider numerical-validation limitations you mention remain open. The expanded solver-substitution failures are still under investigation on a separate, unpublished local tree. Its changes and measurements are recorded separately from the validation of this pushed head. |
…curacy Preserve accurate iterative eigensolver updates and basis recovery, add the optional pw_diag_thr_max bound across SCF and fixed-cell relaxation cycles, and cover numerical and INPUT boundaries with focused tests. Retain the validated noncollinear density/Libxc fixes and full-precision PW output. Compare complete wavefunction and Wannier data with phase/gauge-aware checks. Record independent reference calibration and explicit accuracy settings in the affected case READMEs without relaxing acceptance thresholds. Local validation of this snapshot (GNU 12.3, OpenMPI 5.0.10, OMP=1): - Autotest.sh -n4 -o1 -j4 over 130 baseline and 130 PPCG-side calculations: all runtime exits zero; 121 substitutions: 64 pass, 57 warning, 0 fatal. - Nine unchanged/native controls pass. Two existing incomplete baseline reference records and remaining SCF/inner warnings are preserved. - Final relax_dftu_spin4 cross-checks: CG, Davidson-subspace and PPCG; MPI1/MPI4 reference checks pass at original tolerances. - HSolver/INPUT cap tests: 33/33. Final binary CLI controls: 7/7. - C++11 checks for cap changes and staged governance pass. INPUT help is generated from updated Input_Item registrations; generated documentation is not committed. Case READMEs describe reference provenance. The local report, thesis, presentation, and experiment archives are excluded.
Integrate origin/ppcg-v2-reopen without rewriting either history. Preserve its workspace guards, stochastic INPUT rejection, GPU calibration, benchmark portability, and empty-rank MPI support alongside the locally validated solver and reference changes. Retain both Davidson stability and ownership test harnesses. Apply empty-rank BLAS dimensions and zero projection contributions to the new orthogonalization paths. Keep complete shared-gauge Wannier comparisons and both INPUT descriptions. The merged tree is being rebuilt and retested before publication.
Set nscf_hse_same pw_diag_thr to 1e-12 with the default 50-iteration budget. The former threshold leaves a 1.05e-8 eV CG band error after the numerical update and crosses the stored 1e-8 eV comparison boundary. CG, Davidson-subspace and PPCG reproduce the existing band reference with the tighter input and pass the original Autotest energy/band checks at four MPI ranks. Four tighter controls independently agree within 2.4e-13 eV. Preserve references, comparison tolerances and the PPCG residual warning at the default budget. No production source changes.
The restart_spd fixture stops on eigenvalue changes but independently checks a residual. Its 1e-14 request stopped one expansion too early with OpenBLAS 0.3.20, yielding 8.14e-7 against the unchanged 2e-7 residual limit. Request 1e-15 for this fixture without changing production stopping rules, the 200-iteration budget, or any acceptance threshold. The exact test passes all 18 stability scenarios on OpenBLAS 0.3.20 and 0.3.33 (36 runs), plus all 47 focused CTests. The original CI failure is reproduced with 0.3.20; the corrected residual is 2.03e-11.
The shared Libxc uniform-gradient correction also changes this LCAO case. Its old charge cube failed CPU and GPU checks at the Fermi-energy header. Tighten SCF to 1e-10 and print 12-digit cube fields; generate references independently at 1e-12 while retaining all acceptance limits and the original 100-step budget. Validate all 3375 grid points and scalar checks with Libxc 5.1.7 and 7.0.0, explicit CPU/GPU runs and one/two MPI ranks. Eight original Autotest runs pass, plus a Libxc 5.1.7 CPU four-rank control. The 65-case GPU LCAO multik suite passes with the CI Libxc version.
Set pw_diag_thr=1e-12 to keep CG bands away from the original 1e-8 eV printed comparison boundary. Set pw_diag_nmax=100 so PPCG substitutions converge at the tighter residual request without the warnings seen at 50. Retain every reference and comparison tolerance; the 200-step control adds no improvement. The exact fixture passes all eight CPU/GPU, CG/PPCG, MPI 1/4 runs and 32 original property checks with zero inner residual warnings. Maximum band differences against the tighter Davidson-subspace control are 1.954e-11 eV for CG and 1.901e-13 eV for PPCG.
Tighten SCF and diagonalization settings for eight PW fixtures. Keep the original references for the three lattice cases; calibrate the five remaining scalar references with independent high-accuracy Davidson-subspace results cross-checked against CG and PPCG. Keep all acceptance tolerances, physical inputs, and the comparison pipeline unchanged. Fresh paired runs of all 135 active cases reduce PPCG reference warnings from 60 to 52, with 83 passes and zero fatal failures. All 270 calculations exit normally and no prior reference pass regresses. Forty focused CPU/GPU runs pass 220 property checks with no inner residual warning. Production source is unchanged. Full-sweep residual warnings and the two intentionally short SCF cases remain separately recorded.
The three LR force fixtures requested lr_thr=1e-2 while checking signed forces and their absolute-value sum to 1e-6. The shared Davidson changes alter this loose stopping path. An independent build of upstream c82d87d reproduces the old references with loose Davidson, while upstream and current LAPACK give identical printed signed force components. Request lr_thr=1e-16 and calibrate the scalar/signed references from upstream dense LAPACK. Retain Davidson, the existing retry policy, Z-CG coverage, ground-state inputs and all acceptance tolerances. Twelve final controls across OpenBLAS 0.3.20/0.3.33 and MPI1/4 pass; signed-force and sum differences stay below 2e-7. The original 27-case 08_RI suite passes 143 property checks, with the unrelated existing HF-ULR SCF nonconvergence recorded separately. Subsequent 09_DeePKS and 10_others suites also pass locally.
Merge 8a6df3b while retaining the PPCG, Davidson stability and CG accuracy checks. Follow the upstream test-to-unittests migration, keep the upstream CG tests and the existing accuracy harness in separate targets, and use the relocated linear-algebra tests. Preserve both sides of the PW case list. Validation: all selected targets rebuilt; 60 enabled CTests pass with each of OpenBLAS 0.3.20 and 0.3.33. The comparison benchmark remains disabled. Full CPU integration verification follows before publication.
The Read the Docs build for f151acf hit its 900-second limit while compiling ABACUS, before generating parameters or running Sphinx. The default untyped CMake build adds -O3 -g even though this executable is used only to export INPUT metadata. Set Debug with -O0 -g0 and disable native optimization for this documentation-only build. Keep assertions enabled and preserve the regular build defaults. Validation: the complete serial/no-LCAO install finished locally in 129.315 seconds with four build jobs. All 605 documented parameters, generated Markdown, and 73 HTML files match the merged Release build byte for byte. Strict HTML and LaTeX generation pass with warnings treated as errors. Remote RTD timing requires the next build.
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
The new PPCG recovery path exceeds the existing workspace bounds; the follow-up belongs in the existing workspace-bounds discussion. Two maintenance suggestions follow inline.
Static source review of 61d4b7ba31696259d5dbee0c9f94604631d6b646 against 14c224d04dfcc5d74271c56e20145f4b5c40e563, including the incremental changes since ac9f106a56d538ef75fd495e97957573dcd5c7b3. Source, call paths, tests and CI registration were inspected; no build, test, runtime or CI result was independently executed or verified. The regenerated physical references and wider solver-substitution validation remain unverified here. The existing NSCF and Wannier separation decisions remain open.
| const double residual2 = ModuleBase::dot_real_op<T, Device>()(dim, candidate, candidate); | ||
| if (!std::isfinite(residual2) || residual2 < 0.0) | ||
| { | ||
| throw std::runtime_error("DiagoDavid: non-finite residual before preconditioning"); |
There was a problem hiding this comment.
[P3] Scope Davidson scratch across the new failure exits
Non-blocking: the new nonfinite-residual throw exits cal_grad after vc_ev_vector and lagrange are allocated, before their frees at lines 543-544; the revised SchmidtOrth can exit through the same path. A public/Python caller that catches the exception therefore retains these allocations. Please give both buffers device-aware scoped ownership or a cleanup guard covering these exits.
| self.assertEqual((directory/'result.out').read_text(),'Max_wfc_1 0.5000\nMax_wfc_2 0.5000\nMax_wfc_3 0.5000\n') | ||
|
|
||
|
|
||
| if __name__=='__main__':unittest.main() |
There was a problem hiding this comment.
[P3] Run the comparator negative controls in PR checks
Non-blocking: neither this suite nor test_compare_wannier_bundle.py is registered in CTest or invoked by the PR workflows. The integration collectors exercise the comparators on ordinary outputs, so they do not run these corruption, malformed-input and missing-reference controls. Please register and select both suites in a normal PR check, with their Python/NumPy/Bash dependencies.
Summary
Adds
ks_solver=ppcgfor plane-wave Kohn–Sham diagonalization, continuing #7848. The solver updates blocks in[X,W,P], removes dependent local-subspace directions, recovers competing low roots discarded by local blocks, and validates the final residuals with freshly applied operators. CPU is the main implementation; GPU execution uses device H/S operators with host-side PPCG linear algebra and explicit transfers.Current revision:
61d4b7ba3, checked 2026-10-29. All 18 GitHub check-runs and both Read the Docs projects pass. Merge conflicts withdevelopare resolved. Five review discussions remain open, listed below.Implementation and INPUT changes
pw_diag_ndimselects PPCG's local block size.pw_diag_rr_stepcontrols the full Rayleigh–Ritz interval, defaults to 1, and must be positive. Intermediate steps maintain S-orthogonality. Initialization, startup correction, convergence verification, failed orthogonalization, the last update, and conditional recovery of competing discarded roots can add Ritz solves. H/S image refresh is independent: every 16 updates, after severe projection cancellation, and near the numerical precision limit.||Hψ − εSψ||againstmax(ethr_band[i], ethr, 1e-14). The direct residual criterion is retained after a square-root criterion failed force/stress validation. The INPUT help and solver guide describe this distinction.pw_diag_thr_max=0preserves adaptive thresholds. A positive value caps the supplied threshold from the first electronic iteration, including each fixed-cell relaxation step. It requires PW KSDFT,calculation=scforrelax, anddiago_smooth_ethr=false; single precision requires at least5e-5. Cell relaxation, MD and NSCF reject a positive cap. Each solver keeps its own stopping rule and numerical floor.sdft + ppcgis rejected, including zero-stochastic-band configurations.The PR also contains shared fixes exposed by cross-solver regressions: CG projection and stable energy-decrease evaluation; Davidson orthogonalization, dependent-direction rejection and restart handling; dense-grid charge/kinetic-density mixing; and the local Libxc meta-GGA term in the uniform-gradient limit. Empty and uneven MPI ownership remains supported. Shared NSCF setup now reads the current
pw_diag_nmaxfor CG, Davidson, Davidson-subspace and PPCG; BPCG retains its separate update budget.PW text coefficients use 17 significant digits. Complete wavefunction and Wannier-bundle comparisons, their corruption tests, and independently calibrated fixtures are included. The shared NSCF change and Wannier comparator are still in this PR; their separation into other PRs remains under review.
Validation: current revision and expanded replacement scan
61d4b7ba361d4b7ba361d4b7ba361d4b7ba35ae5435a05ae5435a05ae5435a0The current 164-case integration run uses each case's original solver selection. The expanded scan replaces CG/Davidson/Davidson-subspace with PPCG and belongs to the earlier fixture revision
5ae5435a0; it has not been rerun on61d4b7ba3. Thus 52 is the latest measured replacement-warning count. Eight independently calibrated fixtures reduced that count from 60 to 52, with no other case-status regression. All 270 baseline/PPCG calculations in that paired scan exited normally.Current local verification used GNU 12.3, OpenMPI 5.0.10, Release, four MPI ranks for integration, and one OpenMP/BLAS thread. The final CPU binary SHA256 is
ba7a329ce12350558eaf927c2ef3ccae8d7acc614c572c26ec01add36a09fbdb. The preceding mergeaaaf7f530also passed the 60 CTests with both OpenBLAS 0.3.20 and 0.3.33; final-head CTests used the toolchain OpenBLAS. LDA/PBE LR-force tests loaded matching Libxc 7.0.0 with KXC enabled. No INPUT, reference, threshold or checker was altered during the isolated current-head PW and RI runs.Reference and collector calibration
Fixture READMEs record the accuracy settings, independent references, solver/MPI cross-checks and retained diagnostics. Existing scalar acceptance tolerances were retained.
scf_out_band_dos_wfchecks all complex coefficients at both k points, metadata, G-vectors, band energies, normalization and orthogonality. It fits one phase per nondegenerate band, with1e-7coefficient/Gram limits and the existing1e-8 eVenergy limit. Missing, malformed, incomplete or non-finite requested output fails.1e-8 eVlimit; the energy-operator limit is also1e-8 eV, and AMN/MMN entries use1e-8. There is no additional degeneracy window or cluster-average allowance. Independent CG references follow the CG accuracy fixes and were cross-checked with Davidson-family methods and PPCG.CompareFile.pyis identical to the current upstream base.lr_thr=1e-2with force comparisons at1e-6 eV/Angstrom. An independent build of the then-upstreamc82d87d9eand the PR build produced identical printed dense-LAPACK results for all 108 signed force components. The fixtures now requestlr_thr=1e-16and use those upstream dense references, retaining Davidson, Z-CG, the retry policy and the original force limits. Twelve controls across OpenBLAS 0.3.20/0.3.33 and MPI 1/4 passed; maximum component/sum differences were7.64e-8/1.43e-7 eV/Angstrom. Details are in the LDA fixture README.Open review discussions and validation limits
Fourteen of 19 inline review threads are resolved. The following five remain open for the original reviewer:
The 52 expanded-scan reference warnings and the inner convergence diagnostics remain open numerical validation work. That scan also retains two incomplete baseline reference records (
036_PW_AF,061_PW_RE_NEW). Deliberately short SCF/relax tests and LR-window diagnostics are listed separately in the audit; reference-check passes do not certify full physical convergence of those fixtures.An additional MPI-2 GPU exploration retained a
scf_Al100_kspace3force-reference warning (0.001466difference against a1e-3limit) and encountered k-point-pool restrictions in 39 cases. CI runs the PW GPU list at MPI-1. These extra MPI-2 findings remain open.PPCG's GPU path uses host-side linear algebra. Native distributed GPU PPCG, multi-GPU, Intel and the complete LCAO integration matrix remain outside the local validation, as does ROCm; no general speedup or peak-memory advantage is claimed. Workspace accounting includes projected matrices, active columns, LAPACK temporaries and transfer buffers in addition to the eight persistent CPU arrays. Implementation size and complexity remain cleanup work.
The CI audit also identified an unchanged upstream VDW death-test assertion whose driver returns zero. It is recorded separately and excluded from the focused 60-test evidence above.
Governance
PR-relative governance and whitespace checks pass: seven reviewed warnings, no blockers.
diago_ppcg.hrequires complete types for owned vector/function members, complex/scalar traits and lightweight device declarations; it introduces no.hppimplementation dependency. The DeltaSpin call sites consolidate existingPARAMreads and pass configuration explicitly; the global-reference budget is 2 additions/20 removals, net -18. PPCG numerical code does not read globals.C++
Input_Itemregistrations contain the INPUT metadata; generated YAML/Markdown are build artifacts. No governance exception is requested. This continues #7848; local report, thesis and presentation files are excluded.Verification commands and evidence locations
The focused CTest selection used the configured CPU build:
Each isolated
tests/01_PWandtests/08_RIsnapshot ran the original harness:timeout --kill-after=30s 7200s bash ../integrate/Autotest.sh \ -a "$VALIDATION_BINARY" -n 4 -o 1 -j 4 -f CASES_CPU.txtThe expanded paired scan used separate original/PPCG trees and changed only the selected
ks_solvervalues between them. Its original invocation was:Other recorded checks include 92 Python comparator/collector tests, 14 CLI/INPUT boundary controls, MPI PPCG at 2/3/6 ranks and two pools, and empty/uneven ownership controls. The Python command, run from
tests/integrateat the earlier validated source revision, was:Documentation verification used the normal parameter-export workflow with only the documentation build flags changed:
Local artifacts retain full configure commands, library identities, file manifests and raw logs. These filesystem archives are local records; the CI links and committed fixture/test sources above provide the public review entry points.
/mnt/data/Cheerly/ppcg-reconcile-20261029/mnt/data/Cheerly/ppcg-warning-reduction-20261029/mnt/data/Cheerly/ppcg-warning-reduction-20261029/lr-ci/mnt/data/Cheerly/ppcg-ci-fix-20261029/mnt/data/Cheerly/ppcg-push-20261029Resolved CI failures and earlier validation history
dav_subspace_restart_spdfixture stopped at an eigenvalue-change threshold of1e-14with residual8.135e-7on OpenBLAS 0.3.20, exceeding its2e-7limit. Requesting1e-15reduced residuals to2.028e-11and4.346e-10on OpenBLAS 0.3.20/0.3.33. Production stopping rules and the acceptance limit stayed unchanged.scf_out_chg_tau. Its1e-10SCF setting and 12-digit cube output were checked against independent1e-12CPU references. CPU/GPU, Libxc 5.1.7/7.0.0 and MPI controls agreed across all 3375 grid points with original limits. Only builds with matching Libxc headers/libraries count as evidence; an initial mismatched build was excluded.pw_diag_thr=1e-12andpw_diag_nmax=100resolve the band-output boundary and remove its inner warning. The original references and1e-8 eVlimit remain. Eight CPU/GPU, CG/PPCG, MPI 1/4 controls passed; a budget-200 control produced the same result.f151acf90using the independently verified dense references described above. At that revision, the 27-case RI suite and subsequent 28-case DeePKS/4-case other suites passed locally, followed by successful CPU and CUDA CI.-O3 -g. The documentation-only-O0 -g0build completed locally in 129.315 seconds; all 605 parameter records, generated Markdown and 73 HTML files were byte-identical to Release output. Strict HTML/LaTeX generation passed; PDF compilation was not part of that local check. The repaired remote build passed in 305 seconds, including 205 seconds of compilation.5cf8b634a, the matching Libxc 5.1.7 CUDA build passed 186 cases/1249 checks across the original GPU lists: PW at MPI-1; NAO, RT-TDDFT and SDFT at MPI-2. The latest remote CUDA result is linked in the current validation table.a7e7bd0f7scan recorded 75 passes/60 reference warnings/0 fatal outcomes and 120 inner summaries across 30 cases. The later5ae5435a0scan supersedes those figures with 83/52/0 and 113 summaries across 27 cases. Concurrent runs support correctness comparisons; they are not controlled efficiency measurements.