Repository navigation
Fix: validate dav_subspace correction directions before normalization - #8142
Conversation
|
@ABACUS-PR-BOT Please review this PR. I notice that the original issue seems to be provided by AI, so you'd better check whether it is necessary to solve the issue, and whether there is a risk of over-engineering. |
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
Static review at 9609384: this narrow fix is justified. An exact initial Ritz pair reaches cal_grad before the eigenvalue-change check, so the old path can assert or divide by zero despite an ample basis. Checking residuals, preserving Ritz data and filtering converged directions are proportionate; moving the old guard alone still aborts valid eigenpairs. I found no blocking defect or need for a broader redesign.
The original FeRh GPU cause and GPU performance remain unverified. Fresh whitespace/governance checks passed; I ran no builds or runtime tests, and CI diagnostics were unavailable.
Resolve the conflicts with the hsolver test-directory rename and the empty-block leading-dimension change in dav_subspace: - cal_grad: keep develop's matrix_ld leading dimension together with this branch's compacted active_vcc coefficients. - Move the dav_subspace test into source_hsolver/unittests and keep only its target in that CMakeLists; the linear/TDDFT targets now live under module_linalg/unittests on develop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
The merged Davidson safeguard remains a proportionate fix; the source review found no new correctness regression. Conflict resolutions and affected callers were checked statically; no build or runtime tests were run.
Preserve the dav_subspace test targets alongside develop's CMake formatting and updates. Local compilation and tests were not run, as requested.
An already converged Ritz pair can have a zero or tiny Davidson correction even with an ample basis.
dav_subspacecurrently normalizes that direction before checking it, then reports a misleading insufficient-basis diagnosis. This change checks residuals and direction norms before division while retaining ordinary Davidson expansion and the outer SCF stopping criteria.Reminder
AGENTS.mdanddocs/developers_guide/agent_governance.md.Linked Issue
Related to #8127. The correction-handling defect is reproduced and repaired on CPU. The original FeRh GPU trajectory has not been rerun, so this draft does not claim end-to-end verification of that case.
What's changed?
min(ethr_band, max(1e-12, epsilon<Real>*max(1,abs(eigenvalue)))); loose energy tolerances therefore do not skip ordinary expansions.Unit Tests and/or Case Tests for my changes
Verified on 2026-10-14 from develop
f264b4022fd477734de0f3ace723f6da9e306943plus submitted commit fcf6e5c. An independent reviewer checked the source hashes, raw logs and numerical comparisons. Linux CPU: GCC 12.2.0, Open MPI 4.1.4, OpenBLAS 0.3.21, FFTW 3.3.10, LibXC 5.2.3 and ELPA 2022.11.001.All commands passed: 3/3 CTest entries, comprising 14 single-rank regression tests, 8 cases under two MPI ranks, and 2 existing PW tests. The full executable build includes the unchanged LR-TDDFT caller. Version:
v3.11.0-beta10; executable SHA256:9a622f980a41690822af99e04eda1aef34ee4b0966c1e12d305bba1cec2551fb.Before the repair, compatible exact/tiny/large-preconditioner fixtures exited 1 at the old norm guard; the mixed exact/inexact fixture aborted at the positive-norm assertion. These are CPU mechanism reproductions, not the original FeRh GPU run.
Runtime checks, using four MPI ranks and one OpenMP thread:
The ordinary PW harness passed. Both additional calculations exited 0 and converged. Their standard property collector failed because the CPU host lacks
bc; a local independent parser then compared all eight energy/per-atom-energy/force/stress values against unchanged references, reproducing the collector's six-decimal absolute-sum arithmetic. All comparisons passed with the original energy/force/stress thresholds1e-7 / 1e-4 / 1e-3; no inputs or references were relaxed. Noncollinear total force is18.267150, and constrained-spin total force is21.281736, both matching the stored references. These are supplemental numerical checks, not a claimed pass of the two interrupted standard collectors.Fresh
git diff --cached --checkandpython tools/03_code_analysis/agent_governance_check.py --stagedpassed, with the documentation rationale below accounting for the sole warning.Not run: CUDA/ROCm compilation or runtime, the original FeRh GPU case (archive attachment and three required PP/orbital files unavailable), Python package runtime, or a full physical USPP case. CPU real/complex single-precision tests and complex-double MPI coverage do not establish the existing real/float MPI or real-GPU paths. The precision-scaled cutoff is a safeguard, not a general error bound for ill-conditioned overlap matrices.
Governance Notes