@@ -35,22 +35,7 @@ ESolver_KS_LCAO<TK, TR>::ESolver_KS_LCAO()
3535{
3636 this ->classname = " ESolver_KS_LCAO" ;
3737 this ->basisname = " LCAO" ;
38-
39- #ifdef __EXX
40- // 1. currently this initialization must be put in constructor rather than `before_all_runners()`
41- // because the latter is not reused by ESolver_LCAO_TDDFT,
42- // which cause the failure of the subsequent procedure reused by ESolver_LCAO_TDDFT
43- // 2. always construct but only initialize when if(cal_exx) is true
44- // because some members like two_level_step are used outside if(cal_exx)
45- if (GlobalC::exx_info.info_ri .real_number )
46- {
47- this ->exd = std::make_shared<Exx_LRI_Interface<TK, double >>(GlobalC::exx_info.info_ri );
48- }
49- else
50- {
51- this ->exc = std::make_shared<Exx_LRI_Interface<TK, std::complex <double >>>(GlobalC::exx_info.info_ri );
52- }
53- #endif
38+ this ->exx_nao .init (); // mohan add 20251008
5439}
5540
5641template <typename TK, typename TR>
@@ -137,31 +122,7 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(UnitCell& ucell, const Input_pa
137122 dynamic_cast <elecstate::ElecStateLCAO<TK>*>(this ->pelec )->init_DM (&this ->kv , &(this ->pv ), inp.nspin );
138123
139124 // 8) init exact exchange calculations
140- #ifdef __EXX
141- if (inp.calculation == " scf" || inp.calculation == " relax" || inp.calculation == " cell-relax"
142- || inp.calculation == " md" )
143- {
144- if (GlobalC::exx_info.info_global .cal_exx )
145- {
146- if (inp.init_wfc != " file" )
147- { // if init_wfc==file, directly enter the EXX loop
148- XC_Functional::set_xc_first_loop (ucell);
149- }
150-
151- // initialize 2-center radial tables for EXX-LRI
152- if (GlobalC::exx_info.info_ri .real_number )
153- {
154- this ->exd ->init (MPI_COMM_WORLD, ucell, this ->kv , orb_);
155- this ->exd ->exx_before_all_runners (this ->kv , ucell, this ->pv );
156- }
157- else
158- {
159- this ->exc ->init (MPI_COMM_WORLD, ucell, this ->kv , orb_);
160- this ->exc ->exx_before_all_runners (this ->kv , ucell, this ->pv );
161- }
162- }
163- }
164- #endif
125+ exx_nao.before_runner ();
165126
166127 // 9) initialize DFT+U
167128 if (inp.dft_plus_u )
@@ -280,10 +241,7 @@ void ESolver_KS_LCAO<TK, TR>::cal_force(UnitCell& ucell, ModuleBase::matrix& for
280241 this ->ld ,
281242 " tot" ,
282243#endif
283- #ifdef __EXX
284- *this ->exd ,
285- *this ->exc ,
286- #endif
244+ this ->exx_nao ,
287245 &ucell.symm );
288246
289247 // delete RA after cal_force
@@ -434,7 +392,6 @@ void ESolver_KS_LCAO<TK, TR>::iter_init(UnitCell& ucell, const int istep, const
434392#ifdef __EXX
435393 // calculate exact-exchange
436394 if (PARAM.inp .calculation != " nscf" )
437- q
438395 {
439396 if (GlobalC::exx_info.info_ri .real_number )
440397 {
0 commit comments