@@ -211,8 +211,7 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(UnitCell& ucell, const int istep)
211211 // 12) init_scf, should be before_scf? mohan add 2025-03-10
212212 this ->pelec ->init_scf (istep, ucell, this ->Pgrid , this ->sf .strucFac , this ->locpp .numeric , ucell.symm );
213213
214- // 13) initalize DMR
215- // DMR should be same size with Hamiltonian(R)
214+ // 13) initalize DM(R), which has the same size with Hamiltonian(R)
216215 auto * hamilt_lcao = dynamic_cast <hamilt::HamiltLCAO<TK, TR>*>(this ->p_hamilt );
217216 if (!hamilt_lcao)
218217 {
@@ -221,7 +220,7 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(UnitCell& ucell, const int istep)
221220 this ->dmat .dm ->init_DMR (*hamilt_lcao->getHR ());
222221
223222#ifdef __MLALGO
224- // 14) initialize DMR of DeePKS
223+ // 14) initialize DM2(R) of DeePKS, the DM2(R) is different from DM(R)
225224 this ->deepks .ld .init_DMR (ucell, orb_, this ->pv , this ->gd );
226225#endif
227226
@@ -257,8 +256,6 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(UnitCell& ucell, const int istep)
257256template <typename TK, typename TR>
258257double ESolver_KS_LCAO<TK, TR>::cal_energy()
259258{
260- ModuleBase::TITLE (" ESolver_KS_LCAO" , " cal_energy" );
261-
262259 return this ->pelec ->f_en .etot ;
263260}
264261
@@ -294,15 +291,13 @@ void ESolver_KS_LCAO<TK, TR>::cal_stress(UnitCell& ucell, ModuleBase::matrix& st
294291 ModuleBase::TITLE (" ESolver_KS_LCAO" , " cal_stress" );
295292 ModuleBase::timer::tick (" ESolver_KS_LCAO" , " cal_stress" );
296293
297- // if the users do not want to calculate forces but want stress,
298- // we call cal_force
299294 if (!this ->have_force )
300295 {
301296 ModuleBase::matrix fcs;
302297 this ->cal_force (ucell, fcs);
303298 }
304299
305- // the 'scs' stress has already been calculated in 'cal_force'
300+ // the stress has been calculated in 'cal_force'
306301 stress = this ->scs ;
307302 this ->have_force = false ;
308303
@@ -319,21 +314,14 @@ void ESolver_KS_LCAO<TK, TR>::after_all_runners(UnitCell& ucell)
319314
320315 const int nspin0 = (PARAM.inp .nspin == 2 ) ? 2 : 1 ;
321316
322- auto * estate = dynamic_cast <elecstate::ElecStateLCAO<TK>*>(this ->pelec );
323317 auto * hamilt_lcao = dynamic_cast <hamilt::HamiltLCAO<TK, TR>*>(this ->p_hamilt );
324-
325- if (!estate)
326- {
327- ModuleBase::WARNING_QUIT (" ESolver_KS_LCAO::after_all_runners" ," pelec does not exist" );
328- }
329-
330318 if (!hamilt_lcao)
331319 {
332320 ModuleBase::WARNING_QUIT (" ESolver_KS_LCAO::after_all_runners" ," p_hamilt does not exist" );
333321 }
334322
335323 ModuleIO::ctrl_runner_lcao<TK, TR>(ucell,
336- PARAM.inp , this ->kv , estate , this ->dmat , this ->pv , this ->Pgrid ,
324+ PARAM.inp , this ->kv , this -> pelec , this ->dmat , this ->pv , this ->Pgrid ,
337325 this ->gd , this ->psi , this ->chr , hamilt_lcao,
338326 this ->two_center_bundle_ ,
339327 this ->orb_ , this ->pw_rho , this ->pw_rhod ,
@@ -350,17 +338,10 @@ void ESolver_KS_LCAO<TK, TR>::iter_init(UnitCell& ucell, const int istep, const
350338 // call iter_init() of ESolver_KS
351339 ESolver_KS<TK>::iter_init (ucell, istep, iter);
352340
353- // cast pointers
354- auto * estate = dynamic_cast <elecstate::ElecStateLCAO<TK>*>(this ->pelec );
355- if (!estate)
356- {
357- ModuleBase::WARNING_QUIT (" ESolver_KS_LCAO::iter_init" ," pelec does not exist" );
358- }
359-
360341 module_charge::chgmixing_ks_lcao (iter, this ->p_chgmix , this ->dmat .dm ->get_DMR_pointer (1 )->get_nnr (), PARAM.inp );
361342
362343 // mohan update 2012-06-05
363- estate-> f_en .deband_harris = estate ->cal_delta_eband (ucell);
344+ this -> pelec -> f_en .deband_harris = this -> pelec ->cal_delta_eband (ucell);
364345
365346 if (istep == 0 && PARAM.inp .init_wfc == " file" )
366347 {
@@ -374,7 +355,7 @@ void ESolver_KS_LCAO<TK, TR>::iter_init(UnitCell& ucell, const int istep, const
374355 this ->exx_nao .exd ->two_level_step : this ->exx_nao .exc ->two_level_step ;
375356 }
376357#endif
377- elecstate::init_dm<TK>(ucell, estate , this ->dmat , this ->psi , this ->chr , iter, exx_two_level_step);
358+ elecstate::init_dm<TK>(ucell, this -> pelec , this ->dmat , this ->psi , this ->chr , iter, exx_two_level_step);
378359 }
379360
380361#ifdef __EXX
0 commit comments