@@ -386,27 +386,11 @@ void ESolver_KS_PW<T, Device>::before_scf(UnitCell& ucell, const int istep)
386386 auto * dftu = ModuleDFTU::DFTU::get_instance ();
387387 dftu->init (ucell, nullptr , this ->kv .get_nks ());
388388 }
389- // after init_rho (in pelec->init_scf), we have rho now.
390- // before hamilt2density, we update Hk and initialize psi
391-
392- // before_scf function will be called everytime before scf. However, once
393- // atomic coordinates changed, structure factor will change, therefore all
394- // atomwise properties will change. So we need to reinitialize psi every
395- // time before scf. But for random wavefunction, we dont, because random
396- // wavefunction is not related to atomic coordinates. What the old strategy
397- // does is only to initialize for once...
398- if (((PARAM.inp .init_wfc == " random" ) && (istep == 0 )) || (PARAM.inp .init_wfc != " random" ))
399- {
400- this ->p_psi_init ->initialize_psi (this ->psi ,
401- this ->kspw_psi ,
402- this ->p_hamilt ,
403- GlobalV::ofs_running,
404- this ->already_initpsi );
405-
406- if (this ->already_initpsi == false )
407- {
408- this ->already_initpsi = true ;
409- }
389+
390+ if (!this ->already_initpsi )
391+ {
392+ this ->p_psi_init ->initialize_psi (this ->psi , this ->kspw_psi , this ->p_hamilt , GlobalV::ofs_running);
393+ this ->already_initpsi = true ;
410394 }
411395
412396 ModuleBase::timer::tick (" ESolver_KS_PW" , " before_scf" );
0 commit comments