deepmodeling / abacus-develop

An electronic structure package based on either plane wave basis or numerical atomic orbitals.
http://abacus.ustc.edu.cn
GNU Lesser General Public License v3.0
173 stars 134 forks source link

Problems about `out_mat_dh` and `Gint::cpu_dvlocal_interface` #4818

Open maki49 opened 3 months ago

maki49 commented 3 months ago

Details

  1. It seems that out_mat_dh calculates only the Pulay term $\braket{\phi|H|d\phi}$ while the Hellmann-Feynman term $\braket{\phi|dH|\phi}$ is missing? (see the implementation in sparse_format::cal_dH)
  2. In Gint::cpu_dvlocal_interface (only used when out_mat_dh=1 and nspin=2), @A-006 finds that pvdpRx_thread is calculated but not copied into pvdpRx_reduced, which makes the results different with or without OpenMP.
A-006 commented 3 months ago

Here is the part that calculates Cu

examples/scf/lcao_Cu/INPUT INPUT_PARAMETERS pseudo_dir ../../../tests/PP_ORB orbital_dir ../../../tests/PP_ORB nbands 10 calculation scf ecutwfc 100 scf_thr 1.0e-8 scf_nmax 100 smearing_method gaussian smearing_sigma 0.02 mixing_type broyden mixing_beta 0.4 basis_type lcao gamma_only 0 cal_force 1 cal_stress 1 nspin 2 out_mat_dh 1

1.The calculation results are consistent whether OpenMP is used or not. 2.Whether or not it is accumulated to pvdpRy_reduced, the result is consistent.

What part is this function used to calculate?

A-006 commented 2 weeks ago

in the PR #4827 ,i add the openmp gather in the source/module_hamilt_lcao/module_gint/gint_vl_cpu_interface.cpp:204-223。now the dvlocal has been add to the openmp.Can pvdpRx_reduced be correctly calculated now?

A-006 commented 2 weeks ago

Now the calculation result of gint_kernel_dvlocal will be copied to pvdpRx_reduced. It is not clear whether the calculation result is correct, and it is necessary to understand how to handle the calculation result of dv. Is there a way to add unit tests here?