diff --git a/source/source_esolver/esolver_ks_pw.cpp b/source/source_esolver/esolver_ks_pw.cpp index 5c29df7827..2c342bfa13 100644 --- a/source/source_esolver/esolver_ks_pw.cpp +++ b/source/source_esolver/esolver_ks_pw.cpp @@ -265,20 +265,7 @@ void ESolver_KS_PW::before_scf(UnitCell& ucell, const int istep) this->allocate_hamilt(ucell); //---------------------------------------------------------- - //! 4) Exx calculations - //---------------------------------------------------------- - if (PARAM.inp.calculation == "scf" || PARAM.inp.calculation == "relax" || PARAM.inp.calculation == "cell-relax" - || PARAM.inp.calculation == "md") - { - if (GlobalC::exx_info.info_global.cal_exx && PARAM.inp.basis_type == "pw") - { - auto hamilt_pw = reinterpret_cast*>(this->p_hamilt); - hamilt_pw->set_exx_helper(exx_helper); - } - } - - //---------------------------------------------------------- - //! 4.5) DFT-1/2 calculations, sep potential need to generate before effective potential calculation + //! 4) DFT-1/2 calculations, sep potential need to generate before effective potential calculation //---------------------------------------------------------- if (PARAM.inp.dfthalf_type > 0) { @@ -383,6 +370,8 @@ void ESolver_KS_PW::before_scf(UnitCell& ucell, const int istep) { if (GlobalC::exx_info.info_global.cal_exx && PARAM.inp.basis_type == "pw") { + auto hamilt_pw = reinterpret_cast*>(this->p_hamilt); + hamilt_pw->set_exx_helper(exx_helper); exx_helper.set_psi(kspw_psi); } } diff --git a/source/source_pw/module_pwdft/operator_pw/op_exx_pw.h b/source/source_pw/module_pwdft/operator_pw/op_exx_pw.h index eebd9ff607..577db11b04 100644 --- a/source/source_pw/module_pwdft/operator_pw/op_exx_pw.h +++ b/source/source_pw/module_pwdft/operator_pw/op_exx_pw.h @@ -53,7 +53,7 @@ class OperatorEXXPW : public OperatorPW void construct_ace() const; - bool first_iter = false; + bool first_iter = true; private: const int* isk = nullptr;