abacus-develop icon indicating copy to clipboard operation
abacus-develop copied to clipboard

XC energy is not zero when dft_functional=hf and nspin=2

Open maki49 opened this issue 1 year ago • 1 comments

Describe the bug

The function v_xc returns non-zero etxc when dft_functional=hf and nspin=2.

The bug may lie in grad_corr: https://github.com/deepmodeling/abacus-develop/blob/e5768eca2a2bac46b216822edd5ed3c51d084555/source/module_hamilt_general/module_xc/xc_functional_vxc.cpp#L173 etxc before this line is 0, but become non-zero after this line.

If I comment out the condition if(use_libxc) here to force the code run libxc-subroutine v_xc_libxc instead, the result will be right (E_xc is 0). https://github.com/deepmodeling/abacus-develop/blob/e5768eca2a2bac46b216822edd5ed3c51d084555/source/module_hamilt_general/module_xc/xc_functional_vxc.cpp#L25

To Reproduce

run examples/scf/lcao_Si2 with:

nspin 2
dft_functional hf

After the run finished:

grep E_xc OUT.ABACUS/running_scf.log

maki49 avatar Nov 04 '24 12:11 maki49

Who have the ability to solve it? @maki49

mohanchen avatar Nov 23 '24 02:11 mohanchen