@@ -941,76 +941,11 @@ void ESolver_KS_LCAO<TK, TR>::iter_finish(int& iter)
941941
942942#ifdef __EXX
943943 // 3) save exx matrix
944- int two_level_step = GlobalC::exx_info.info_ri .real_number ? this ->exd ->two_level_step : this ->exc ->two_level_step ;
945-
946- if (GlobalC::restart.info_save .save_H && two_level_step > 0
947- && (!GlobalC::exx_info.info_global .separate_loop || iter == 1 )) // to avoid saving the same value repeatedly
948- {
949- // //////// for Add_Hexx_Type::k
950- /*
951- hamilt::HS_Matrix_K<TK> Hexxk_save(&this->pv, 1);
952- for (int ik = 0; ik < this->kv.get_nks(); ++ik) {
953- Hexxk_save.set_zero_hk();
954-
955- hamilt::OperatorEXX<hamilt::OperatorLCAO<TK, TR>> opexx_save(&Hexxk_save,
956- nullptr,
957- this->kv);
958-
959- opexx_save.contributeHk(ik);
960-
961- GlobalC::restart.save_disk("Hexx",
962- ik,
963- this->pv.get_local_size(),
964- Hexxk_save.get_hk());
965- }*/
966- // //////// for Add_Hexx_Type:R
967- const std::string& restart_HR_path = GlobalC::restart.folder + " HexxR" + std::to_string (GlobalV::MY_RANK);
968- if (GlobalC::exx_info.info_ri .real_number )
969- {
970- ModuleIO::write_Hexxs_csr (restart_HR_path, GlobalC::ucell, this ->exd ->get_Hexxs ());
971- }
972- else
973- {
974- ModuleIO::write_Hexxs_csr (restart_HR_path, GlobalC::ucell, this ->exc ->get_Hexxs ());
975- }
976- if (GlobalV::MY_RANK == 0 )
977- {
978- GlobalC::restart.save_disk (" Eexx" , 0 , 1 , &this ->pelec ->f_en .exx );
979- }
980- }
981-
982- if (GlobalC::exx_info.info_global .cal_exx && this ->conv_esolver )
944+ if (GlobalC::exx_info.info_global .cal_exx )
983945 {
984- // Kerker mixing does not work for the density matrix.
985- // In the separate loop case, it can still work in the subsequent inner loops where Hexx(DM) is fixed.
986- // In the non-separate loop case where Hexx(DM) is updated in every iteration of the 2nd loop, it should be
987- // closed.
988- if (!GlobalC::exx_info.info_global .separate_loop )
989- {
990- this ->p_chgmix ->close_kerker_gg0 ();
991- }
992- if (GlobalC::exx_info.info_ri .real_number )
993- {
994- this ->conv_esolver = this ->exd ->exx_after_converge (
995- *this ->p_hamilt ,
996- *dynamic_cast <const elecstate::ElecStateLCAO<TK>*>(this ->pelec )->get_DM (),
997- this ->kv ,
998- PARAM.inp .nspin ,
999- iter,
1000- this ->pelec ->f_en .etot ,
1001- this ->scf_ene_thr );
1002- }
1003- else
1004- {
1005- this ->conv_esolver = this ->exc ->exx_after_converge (
1006- *this ->p_hamilt ,
1007- *dynamic_cast <const elecstate::ElecStateLCAO<TK>*>(this ->pelec )->get_DM (),
1008- this ->kv ,
1009- PARAM.inp .nspin ,
1010- iter,
1011- this ->pelec ->f_en .etot ,
1012- this ->scf_ene_thr );
1013- }
946+ GlobalC::exx_info.info_ri .real_number ?
947+ this ->exd ->exx_iter_finish (this ->kv , GlobalC::ucell, *this ->p_hamilt , *this ->pelec , *this ->p_chgmix , this ->scf_ene_thr , iter, this ->conv_esolver ) :
948+ this ->exc ->exx_iter_finish (this ->kv , GlobalC::ucell, *this ->p_hamilt , *this ->pelec , *this ->p_chgmix , this ->scf_ene_thr , iter, this ->conv_esolver );
1014949 }
1015950#endif
1016951
0 commit comments