Repository navigation
fix: use truncated pseudo-inverse for Broyden mixing - #7968
Merged
mohanchen merged 3 commits intoSep 15, 2026
Merged
Conversation
Collaborator
Author
|
/abacus-ci gpu |
GPU validation: successGPU cases: 124 passed, 0 failed, 0 infrastructure. Open the Actions run | Download raw test files Candidate: |
Collaborator
|
@WHUweiqingzhou May you have a look for the enhancement of broyden mixing ? Thanks ! |
16 tasks
mohanchen
approved these changes
Sep 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This issue was discovered through intermittent failures in daily GPU testing: the same H2 case usually passed, but occasionally terminated with
Error when DSYSVwithout any input changes. Repeated runs reproduced the failure, and inspection of the Broyden history identified nearly linearly dependent residual differences as the cause.Reminder
AGENTS.mdanddocs/developers_guide/agent_governance.md.source/changes.Linked Issue
No separate issue is needed: the daily GPU failure records the error and identifies the existing reproducer,
tests/12_NAO_Gamma_GPU/006_NO_H2_SZ_S2_GPU.Unit Tests and/or Case Tests for my changes
Verification reuses existing regression cases:
94b0b23ccalso passed the 124-case GPU suite.13_NO_Taylor_TDDFTpassed repeated checks with both the original and updated Broyden solvers. Tighter SCF calculations confirm a common converged energy; all comparison tolerances are unchanged.What's changed?
Broyden mixing forms a small Gram matrix from inner products of recent residual differences and solves
G gamma = cto obtain the mixing coefficients. As SCF proceeds, some history directions can become almost linear combinations of others. The Gram matrix then develops very small eigenvalues, making the direct solve sensitive to roundoff: small floating-point differences between otherwise identical GPU runs can be amplified into large coefficient changes, or make the factorization report a singular matrix.The coefficient solve now uses
DSYEVto diagonalize the symmetric Gram matrix and construct a truncated pseudo-inverse. Only eigenvalues strictly greater than1e-12 * lambda_maxcontribute to the coefficients. This removes numerically unresolved history combinations from the solve while preserving the existing history buffer, coefficient mapping and Kerker screening.CP2K's Broyden charge mixer provides a reference for this relative spectral cutoff:
Its SVD helper discards singular values at or below
rskip * max(singular_values). The present change applies the cutoff directly to ABACUS's Gram matrix through symmetric eigendecomposition; CP2K's additional history normalization, weighting and diagonal regularization are not ported.For
13_NO_Taylor_TDDFT, tightenscf_thrfrom1e-6to1e-10and refresh the total and per-atom energy references using results converged at1e-12. The original SCF threshold leaves the energy sensitive to the mixing path beyond the test's1e-7 eVtolerance. Energy, force and stress comparison tolerances remain unchanged.Governance Notes
scf_thrsetting changes. Parameter definitions, defaults and interfaces are unchanged, so parameter documentation updates are unnecessary.source/source_base/module_mixing/broyden_mixing.cppchanges. For history dimensionm, the small-matrix solve remainsO(m^3), withO(m^2)eigenvector transforms andO(m)additional temporary storage. No density-grid arrays or additional MPI inner products are introduced.