Feature: Use pesudo inverse to avoid singularly values and use dsysv
to replace direct inverse in Broyden mixing
#4859
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.
Fix #4802.
List of Changes
dsytrf
&dsytri
&dgemv
bydsysv
in Broyden mixing. Plz note that The pass of PR Try I: replace dsytrf & dsytri & gemv by dsysv inBroyden_mixing
#4842 CI tests show thatdsysv
is OK to replacedsytrf
&dsytri
&dgemv.
1e-12
, waiting for more tests.201_NO_15_f_pseudopots
.update the refdata in
201_NO_15_f_pseudopots
since this example triggers the pseudo-inverse at 7-th iteration, namely:leading to a tiny difference in final DMR.
To prove the implementation of pesudo-inverse in this PR is correct
I choose a simple example at
abacus-develop/examples/scf/lcao_Si2
, and set INPUT asDuring SCF, I output
beta_tmp
andinverse_beta_wosv
at each iteration. In this calculation, I set thershold for singularly valuable as 1e-8. At 4-th iteration, thebeta_matrix
andinverse_beta_wosv
isIn this matrix, there is no singularly valuable. I use python to inverse the matrix by:
and get the inverse matrix:
You can see that the result is the same as
inverse_beta_wosv
in the calculation. So the implementation of pseudo-inverse can reproduce the full inverseif there is no singularly valuable in the matrix.
At 7-th iteration, the
beta_matrix
andinverse_beta_wosv
isthere are 3 singularly valuables in the matrix. I use python to inverse the matrix by:
and get the inverse matrix:
You can see that the result is the same as
inverse_beta_wosv
in the calculation.