@@ -201,12 +201,14 @@ void OperatorEXX<OperatorLCAO<TK, TR>>::contributeHR()
201201{
202202 ModuleBase::TITLE (" OperatorEXX" , " contributeHR" );
203203 // Peize Lin add 2016-12-03
204- if (PARAM.inp .calculation != " nscf" && this ->two_level_step != nullptr && *this ->two_level_step == 0 && !this ->restart ) { return ; // in the non-exx loop, do nothing
205- }
204+ if (PARAM.inp .calculation != " nscf" && this ->two_level_step != nullptr && *this ->two_level_step == 0 && !this ->restart ) { return ; } // in the non-exx loop, do nothing
205+ if (this ->add_hexx_type == Add_Hexx_Type::k) { return ; }
206+
206207 if (XC_Functional::get_func_type () == 4 || XC_Functional::get_func_type () == 5 )
207208 {
208209 // add H(R) normally
209- if (GlobalC::exx_info.info_ri .real_number ) {
210+ if (GlobalC::exx_info.info_ri .real_number )
211+ {
210212 RI_2D_Comm::add_HexxR (
211213 this ->current_spin ,
212214 GlobalC::exx_info.info_global .hybrid_alpha ,
@@ -215,7 +217,9 @@ void OperatorEXX<OperatorLCAO<TK, TR>>::contributeHR()
215217 PARAM.globalv .npol ,
216218 *this ->hR ,
217219 this ->use_cell_nearest ? &this ->cell_nearest : nullptr );
218- } else {
220+ }
221+ else
222+ {
219223 RI_2D_Comm::add_HexxR (
220224 this ->current_spin ,
221225 GlobalC::exx_info.info_global .hybrid_alpha ,
@@ -224,19 +228,20 @@ void OperatorEXX<OperatorLCAO<TK, TR>>::contributeHR()
224228 PARAM.globalv .npol ,
225229 *this ->hR ,
226230 this ->use_cell_nearest ? &this ->cell_nearest : nullptr );
227- }
231+ }
228232 }
229- if (PARAM.inp .nspin == 2 ) { this ->current_spin = 1 - this ->current_spin ;
230- }
233+ if (PARAM.inp .nspin == 2 ) { this ->current_spin = 1 - this ->current_spin ; }
231234}
232235
233236template <typename TK, typename TR>
234237void OperatorEXX<OperatorLCAO<TK, TR>>::contributeHk(int ik)
235238{
236239 ModuleBase::TITLE (" OperatorEXX" , " constributeHR" );
237240 // Peize Lin add 2016-12-03
238- if (PARAM.inp .calculation != " nscf" && this ->two_level_step != nullptr && *this ->two_level_step == 0 && !this ->restart ) { return ; // in the non-exx loop, do nothing
239- }
241+ if (PARAM.inp .calculation != " nscf" && this ->two_level_step != nullptr && *this ->two_level_step == 0 && !this ->restart ) { return ; } // in the non-exx loop, do nothing
242+
243+ if (this ->add_hexx_type == Add_Hexx_Type::R) { throw std::invalid_argument (" Set Add_Hexx_Type::k sto call OperatorEXX::contributeHk()." ); }
244+
240245 if (XC_Functional::get_func_type () == 4 || XC_Functional::get_func_type () == 5 )
241246 {
242247 if (this ->restart && this ->two_level_step != nullptr )
0 commit comments