NSPIN2 different with NSPIN1 with LIBXC
Describe the bug
There are 0.2 eV difference between nspin=1 and nspin=2 in case Ce:
When "dft_functional GGA_X_PBE+GGA_C_PBE", energy would be -3.43776621e+03 for nspin=1 and -3.43753665e+03 for nspin=2, while results are same with "dft_functional pbe" .
I think there would be something error in LIBXC when nspin > 1.
Expected behavior
No response
To Reproduce
No response
Environment
No response
Additional Context
No response
Task list for Issue attackers (only for developers)
- [ ] Verify the issue is not a duplicate.
- [ ] Describe the bug.
- [ ] Steps to reproduce.
- [ ] Expected behavior.
- [ ] Error message.
- [ ] Environment details.
- [ ] Additional context.
- [ ] Assign a priority level (low, medium, high, urgent).
- [ ] Assign the issue to a team member.
- [ ] Label the issue with relevant tags.
- [ ] Identify possible related issues.
- [ ] Create a unit test or automated test to reproduce the bug (if applicable).
- [ ] Fix the bug.
- [ ] Test the fix.
- [ ] Update documentation (if necessary).
- [ ] Close the issue and inform the reporter (if applicable).
It turns out that this issue is likely to be an outcome of a misused threshold (mask).
In QE, there are actually two layers of threshold:
-
in the first layer, rho_up/dw is compared with rho_threshold_lda (not gga even for gga functionals! default to 1e-10). If it falls below the threshold, all quantities (exc, vrho & vsigma) are set to zero.
-
if it passes the first threshold, rho_up/dw as well as their gradients are then compared with rho_threshold_gga & grho_threshold_gga. If they falls below the threshold, only vsigma is set to zero.
In ABACUS, however, there is only one layer of mask for gga functionals, which uses rho_threshold_gga & grho_threshold_gga. As a result, the threshold used for exc is different from that of QE. In fact, the following change (an ad hoc modification, should not be used in production code)
would not only make the results by ABACUS agree with those of QE, but also make ABACUS nspin=1/2/4 agree with themselves (at least in simple examples):
Would that means that nspin=2 calculation using LibXC in ABACUS (including mGGA like MGGA_X_R2SCAN+MGGA_C_R2SCAN and HSE-LibRI) will give WRONG results ?
Would that means that
nspin=2calculation using LibXC in ABACUS (including mGGA likeMGGA_X_R2SCAN+MGGA_C_R2SCANand HSE-LibRI) will give WRONG results ?
@QuantumMisaka This issue is only about the numerical difference of different Numerical truncation settings, not means the results of LIBXC would be wrong, but we still plan to fix this difference, results of nspin=2 would be changed after fixed.
@dyzheng Any update of this issue ?