Fix occurrence of ghost states with SVDs#3911
Conversation
|
I am not yet fully sure about the cause, but with this PR, I am getting: My test case is |
|
I am currently checking it. It is possible. Apparently, DBCSR silently creates matrices of the wrong (?) size. |
|
I think it is in here. The code implicitly assumes that the number of MOs is the same as the number of AOs. Before this change, this was actually true, whereas I changed it to the size of the linear independent subspace. |
|
Another question is, if there is any test we can add which is showing the issue. |
|
( Btw, good work! ) |
Yes, the code here assumes n_AO = n_MO. Agreed, it should work to resize mo_coeff_b and matrix_tmp as you suggested. |
|
Apparently, it is easier to just get all diagonal elements and copy the first n_MO elements to the actual array. I checked the GW-corrected energies for a regtest-like setup and found the same values as before. But the sigma_C contribution changes. Is this behavior expected? How does the GW-code deal with ghost states? If you want to run some tests, checkout my branch. |
|
I merged your branch and I can confirm it works for the mentioned case! ( As a side-note, either the fix or the SVD change itself seems to have caused a slight regression in performance [ |
|
I have opened the PR. I suppose that the differences in the correlation contributions to the self-energy are related to the falsely considered ghost states in the calculation. |
|
To wrap up #3911 (comment), I tested current master against master with reverted commits Slower run is according to
Perhaps these function just point-out somewhat more work rather than having gotten slower. |
|
That's interesting because I only shrinked the MO matrices a bit (maybe 5-10 %). In |
|
Yeah, it's hard to conclude something actionable (besides of some voodoo). I may take a look as we go forward. Unrelated to this issue: |
Fixes cp2k#3823 . If the Cholesky decomposition is turned off for numerical reasons, CP2K approximates the inverse square roots of the overlap matrix using SVDs. This keeps the null-space during the solution of the eigenvalue problem such that additional eigenvectors with eigenvalue zero are found which are occupied if the Fermi-level μ ≥ − k T . My PR removes the null-space entirely by working in the linear-independent subspace spanned by the eigenvectors outside of the null-space of the overlap matrix. I applied this scheme also to the level-shifting scheme and eigenvalue calculation for MP2. The reference values of the regtests were updated accordingly and are in better agreement with comparable regtests. I reintroduced the EPS_SVD keyword in the MP2 case.
Fixes #3823 . If the Cholesky decomposition is turned off for numerical reasons, CP2K approximates the inverse square roots of the overlap matrix using SVDs. This keeps the null-space during the solution of the eigenvalue problem such that additional eigenvectors with eigenvalue zero are found which are occupied if the Fermi-level$\mu\ge -kT$ .
My PR removes the null-space entirely by working in the linear-independent subspace spanned by the eigenvectors outside of the null-space of the overlap matrix. I applied this scheme also to the level-shifting scheme and eigenvalue calculation for MP2. The reference values of the regtests were updated accordingly and are in better agreement with comparable regtests. I reintroduced the EPS_SVD keyword in the MP2 case.
@JWilhelm I tried Tikhonov regularization but found that it does not solve the problem in our case.