1010#include " ../module_neighbor/sltk_atom_arrange.h"
1111#include " ../src_io/istate_charge.h"
1212#include " ../src_io/istate_envelope.h"
13- #include " src_lcao/ELEC_scf.h"
14- #include " src_lcao/ELEC_nscf.h"
15- #include " src_lcao/ELEC_cbands_gamma.h"
16- #include " src_lcao/ELEC_cbands_k.h"
1713#include " src_lcao/ELEC_evolve.h"
1814//
1915#include " ../src_ri/exx_abfs.h"
@@ -205,7 +201,27 @@ namespace ModuleESolver
205201 }
206202 }
207203#endif
204+
205+ // Peize Lin add 2016-12-03
206+ #ifdef __MPI
207+ if (Exx_Global::Hybrid_Type::No != GlobalC::exx_global.info .hybrid_type )
208+ {
209+ if (Exx_Global::Hybrid_Type::HF == GlobalC::exx_lcao.info .hybrid_type
210+ || Exx_Global::Hybrid_Type::PBE0 == GlobalC::exx_lcao.info .hybrid_type
211+ || Exx_Global::Hybrid_Type::HSE == GlobalC::exx_lcao.info .hybrid_type )
212+ {
213+ GlobalC::exx_lcao.cal_exx_ions (*this ->LOWF .ParaV );
214+ }
215+ if (Exx_Global::Hybrid_Type::Generate_Matrix == GlobalC::exx_global.info .hybrid_type )
216+ {
217+ Exx_Opt_Orb exx_opt_orb;
218+ exx_opt_orb.generate_matrix ();
219+ ModuleBase::timer::tick (" LOOP_ions" , " opt_ions" );
220+ return ;
221+ }
222+ }
208223 }
224+ #endif
209225
210226 void ESolver_KS_LCAO::beforescf (int istep)
211227 {
@@ -226,6 +242,9 @@ namespace ModuleESolver
226242
227243 phami->non_first_scf = istep;
228244
245+ // for exx two_level scf
246+ this ->two_level_step = 0 ;
247+
229248 ModuleBase::timer::tick (" ESolver_KS_LCAO" , " beforescf" );
230249 return ;
231250 }
@@ -236,53 +255,7 @@ namespace ModuleESolver
236255 ModuleBase::timer::tick (" ESolver_KS_LCAO" , " othercalculation" );
237256 this ->beforesolver (istep);
238257 // self consistent calculations for electronic ground state
239- if (GlobalV::CALCULATION == " scf" || GlobalV::CALCULATION == " md"
240- || GlobalV::CALCULATION == " relax" || GlobalV::CALCULATION == " cell-relax" ) // pengfei 2014-10-13
241- {
242- #ifdef __MPI
243- // Peize Lin add 2016-12-03
244- if (Exx_Global::Hybrid_Type::HF == GlobalC::exx_lcao.info .hybrid_type
245- || Exx_Global::Hybrid_Type::PBE0 == GlobalC::exx_lcao.info .hybrid_type
246- || Exx_Global::Hybrid_Type::HSE == GlobalC::exx_lcao.info .hybrid_type )
247- {
248- GlobalC::exx_lcao.cal_exx_ions (*this ->LOWF .ParaV );
249- }
250- if (Exx_Global::Hybrid_Type::Generate_Matrix == GlobalC::exx_global.info .hybrid_type )
251- {
252- Exx_Opt_Orb exx_opt_orb;
253- exx_opt_orb.generate_matrix ();
254- }
255- else // Peize Lin add 2016-12-03
256- {
257- #endif // __MPI
258- ELEC_scf es;
259- es.scf (istep, this ->LOC , this ->LOWF , this ->UHM );
260- #ifdef __MPI
261- if (GlobalC::exx_global.info .separate_loop )
262- {
263- for (size_t hybrid_step = 0 ; hybrid_step != GlobalC::exx_global.info .hybrid_step ; ++hybrid_step)
264- {
265- XC_Functional::set_xc_type (GlobalC::ucell.atoms [0 ].xc_func );
266- GlobalC::exx_lcao.cal_exx_elec (this ->LOC , this ->LOWF .wfc_k_grid );
267-
268- ELEC_scf es;
269- es.scf (istep, this ->LOC , this ->LOWF , this ->UHM );
270- if (ELEC_scf::iter == 1 ) // exx converge
271- {
272- break ;
273- }
274- }
275- }
276- else
277- {
278- XC_Functional::set_xc_type (GlobalC::ucell.atoms [0 ].xc_func );
279- ELEC_scf es;
280- es.scf (istep, this ->LOC , this ->LOWF , this ->UHM );
281- }
282- }
283- #endif // __MPI
284- }
285- else if (GlobalV::CALCULATION == " nscf" )
258+ if (GlobalV::CALCULATION == " nscf" )
286259 {
287260 this ->nscf ();
288261 }
0 commit comments