diff --git a/source/source_lcao/module_deepks/LCAO_deepks_interface.cpp b/source/source_lcao/module_deepks/LCAO_deepks_interface.cpp index 04eb0cffc2..3e450221bb 100644 --- a/source/source_lcao/module_deepks/LCAO_deepks_interface.cpp +++ b/source/source_lcao/module_deepks/LCAO_deepks_interface.cpp @@ -618,6 +618,24 @@ void LCAO_Deepks_Interface::out_deepks_labels(const double& etot, // 7. atom.npy, box.npy, overlap.npy //================================================================================ + if( ((PARAM.inp.deepks_out_labels == 2) && is_after_scf ) + || ( PARAM.inp.deepks_out_freq_elec ) )// need overlap when deepks_out_freq_elec + { + if (PARAM.inp.deepks_v_delta > 0) + { + // prepare for overlap.npy, very much like h_tot except for p_ham->getSk() + std::vector s_tot(nks); + DeePKS_domain::get_h_tot(*ParaV, p_ham, s_tot, nlocal, nks, 'S'); + const std::string file_stot = get_filename("overlap", PARAM.inp.deepks_out_labels, iter); + LCAO_deepks_io::save_npy_h(s_tot, + file_stot, + nlocal, + nks, + rank, + 1.0); // don't need unit_scale for overlap + } + } + if ( is_after_scf ) // don't need to output in multiple electronic steps { if (PARAM.inp.deepks_out_labels == 2) @@ -632,20 +650,6 @@ void LCAO_Deepks_Interface::out_deepks_labels(const double& etot, DeePKS_domain::prepare_box(ucell, box_out); const std::string file_box = PARAM.globalv.global_out_dir + "deepks_box.npy"; LCAO_deepks_io::save_tensor2npy(file_box, box_out, rank); - - if (PARAM.inp.deepks_v_delta > 0) - { - // prepare for overlap.npy, very much like h_tot except for p_ham->getSk() - std::vector s_tot(nks); - DeePKS_domain::get_h_tot(*ParaV, p_ham, s_tot, nlocal, nks, 'S'); - const std::string file_stot = PARAM.globalv.global_out_dir + "deepks_overlap.npy"; - LCAO_deepks_io::save_npy_h(s_tot, - file_stot, - nlocal, - nks, - rank, - 1.0); // don't need unit_scale for overlap - } } //================================================================================ diff --git a/tests/09_DeePKS/103_NO_GO_deepks_out_freq_elec/result.ref b/tests/09_DeePKS/103_NO_GO_deepks_out_freq_elec/result.ref index 5c61657bb1..4707e8c814 100644 --- a/tests/09_DeePKS/103_NO_GO_deepks_out_freq_elec/result.ref +++ b/tests/09_DeePKS/103_NO_GO_deepks_out_freq_elec/result.ref @@ -22,4 +22,6 @@ deepks_f_label_elec .06676003678176294 deepks_fdelta_elec .017979102769780632 deepks_s_label_elec .06851710382835817 deepks_sdelta_elec .013725178909672755 +deepks_overlap 61.931587180384426 +deepks_overlap_elec 309.657935901922130 totaltimeref 3.76 diff --git a/tests/09_DeePKS/103_NO_KP_deepks_out_freq_elec/result.ref b/tests/09_DeePKS/103_NO_KP_deepks_out_freq_elec/result.ref index bc76b36bcc..996128b56d 100644 --- a/tests/09_DeePKS/103_NO_KP_deepks_out_freq_elec/result.ref +++ b/tests/09_DeePKS/103_NO_KP_deepks_out_freq_elec/result.ref @@ -22,4 +22,6 @@ deepks_f_label_elec .0667600367817765 deepks_fdelta_elec .017979102769778977 deepks_s_label_elec .06851710382837811 deepks_sdelta_elec .013725178909649378 +deepks_overlap 61.931587180384426 +deepks_overlap_elec 309.657935901922130 totaltimeref 3.52 diff --git a/tests/integrate/tools/catch_deepks_properties.sh b/tests/integrate/tools/catch_deepks_properties.sh index f8bd7cbf0d..74b66f7dc5 100644 --- a/tests/integrate/tools/catch_deepks_properties.sh +++ b/tests/integrate/tools/catch_deepks_properties.sh @@ -203,6 +203,11 @@ if ! test -z "$deepks_out_labels" && [ $deepks_out_labels == 1 ]; then # Process deepks_out_freq_elec > 0 if [ ! -z "$deepks_out_freq_elec" ] && [ $deepks_out_freq_elec -gt 0 ]; then process_many_npys "multi" "_elec" "$1" + if ! test -z "$deepks_v_delta" && [[ $deepks_v_delta -gt 0 ]]; then + process_npy "single" "abs" "overlap" "" "deepks_overlap" "$1" + process_npy "multi" "abs" "overlap" "" "deepks_overlap_elec" "$1" + + fi fi fi