3232#include < memory>
3333#ifdef __EXX
3434#include " module_io/restart_exx_csr.h"
35+ #include " module_ri/exx_opt_orb.h"
3536#include " module_ri/RPA_LRI.h"
3637#endif
3738
@@ -170,9 +171,15 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(const Input_para& inp, UnitCell
170171 inp.lcao_rmax ,
171172 ucell,
172173 two_center_bundle_,
173- orb_);
174+ this -> orb_ );
174175 // ------------------init Basis_lcao----------------------
175176
177+ if (PARAM.inp .calculation == " gen_opt_abfs" )
178+ {
179+ Exx_Opt_Orb::generate_matrix (GlobalC::exx_info.info_opt_abfs , this ->kv , this ->orb_ );
180+ return ;
181+ }
182+
176183 // 5) initialize density matrix
177184 // DensityMatrix is allocated here, DMK is also initialized here
178185 // DMR is not initialized here, it will be constructed in each before_scf
@@ -188,7 +195,7 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(const Input_para& inp, UnitCell
188195 // 6) initialize Hamilt in LCAO
189196 // * allocate H and S matrices according to computational resources
190197 // * set the 'trace' between local H/S and global H/S
191- LCAO_domain::divide_HS_in_frag (PARAM.globalv .gamma_only_local , pv, this ->kv .get_nks (), orb_);
198+ LCAO_domain::divide_HS_in_frag (PARAM.globalv .gamma_only_local , pv, this ->kv .get_nks (), this -> orb_ );
192199
193200#ifdef __EXX
194201 // 7) initialize exx
@@ -202,11 +209,11 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(const Input_para& inp, UnitCell
202209 // initialize 2-center radial tables for EXX-LRI
203210 if (GlobalC::exx_info.info_ri .real_number )
204211 {
205- this ->exx_lri_double ->init (MPI_COMM_WORLD, this ->kv , orb_);
212+ this ->exx_lri_double ->init (MPI_COMM_WORLD, this ->kv , this -> orb_ );
206213 }
207214 else
208215 {
209- this ->exx_lri_complex ->init (MPI_COMM_WORLD, this ->kv , orb_);
216+ this ->exx_lri_complex ->init (MPI_COMM_WORLD, this ->kv , this -> orb_ );
210217 }
211218 }
212219 }
@@ -215,7 +222,7 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(const Input_para& inp, UnitCell
215222 // 8) initialize DFT+U
216223 if (PARAM.inp .dft_plus_u )
217224 {
218- GlobalC::dftu.init (ucell, &this ->pv , this ->kv .get_nks (), orb_);
225+ GlobalC::dftu.init (ucell, &this ->pv , this ->kv .get_nks (), this -> orb_ );
219226 }
220227
221228 // 9) initialize ppcell
@@ -244,7 +251,7 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(const Input_para& inp, UnitCell
244251 // load the DeePKS model from deep neural network
245252 GlobalC::ld.load_model (PARAM.inp .deepks_model );
246253 // read pdm from file for NSCF or SCF-restart, do it only once in whole calculation
247- GlobalC::ld.read_projected_DM ((PARAM.inp .init_chg == " file" ), PARAM.inp .deepks_equiv , *orb_.Alpha );
254+ GlobalC::ld.read_projected_DM ((PARAM.inp .init_chg == " file" ), PARAM.inp .deepks_equiv , *this -> orb_ .Alpha );
248255 }
249256#endif
250257
@@ -313,7 +320,7 @@ void ESolver_KS_LCAO<TK, TR>::cal_force(ModuleBase::matrix& force)
313320 this ->GG , // mohan add 2024-04-01
314321 this ->GK , // mohan add 2024-04-01
315322 two_center_bundle_,
316- orb_,
323+ this -> orb_ ,
317324 force,
318325 this ->scs ,
319326 this ->sf ,
@@ -466,7 +473,7 @@ void ESolver_KS_LCAO<TK, TR>::after_all_runners()
466473 this ->GG ,
467474 this ->GK ,
468475 this ->kv ,
469- orb_.cutoffs (),
476+ this -> orb_ .cutoffs (),
470477 this ->pelec ->wg ,
471478 GlobalC::GridD
472479#ifdef __EXX
@@ -495,7 +502,7 @@ void ESolver_KS_LCAO<TK, TR>::after_all_runners()
495502 this ->kv ,
496503 this ->pelec ->wg ,
497504 GlobalC::GridD,
498- orb_.cutoffs (),
505+ this -> orb_ .cutoffs (),
499506 this ->two_center_bundle_
500507#ifdef __EXX
501508 ,
@@ -1168,7 +1175,7 @@ void ESolver_KS_LCAO<TK, TR>::after_scf(const int istep)
11681175 this ->pelec ->ekb ,
11691176 this ->pelec ->klist ->kvec_d ,
11701177 GlobalC::ucell,
1171- orb_,
1178+ this -> orb_ ,
11721179 GlobalC::GridD,
11731180 &(this ->pv ),
11741181 *(this ->psi ),
@@ -1188,8 +1195,8 @@ void ESolver_KS_LCAO<TK, TR>::after_scf(const int istep)
11881195 rpa_lri_double.cal_postSCF_exx (*dynamic_cast <const elecstate::ElecStateLCAO<TK>*>(this ->pelec )->get_DM (),
11891196 MPI_COMM_WORLD,
11901197 this ->kv ,
1191- orb_);
1192- rpa_lri_double.init (MPI_COMM_WORLD, this ->kv , orb_.cutoffs ());
1198+ this -> orb_ );
1199+ rpa_lri_double.init (MPI_COMM_WORLD, this ->kv , this -> orb_ .cutoffs ());
11931200 rpa_lri_double.out_for_RPA (this ->pv , *(this ->psi ), this ->pelec );
11941201 }
11951202#endif
@@ -1278,7 +1285,7 @@ void ESolver_KS_LCAO<TK, TR>::after_scf(const int istep)
12781285 this ->kv .kvec_d ,
12791286 &hR,
12801287 &GlobalC::ucell,
1281- orb_.cutoffs (),
1288+ this -> orb_ .cutoffs (),
12821289 &GlobalC::GridD,
12831290 two_center_bundle_.kinetic_orb .get ());
12841291
0 commit comments