Skip to content

Commit 307116c

Browse files
committed
Refactor: move init_mixing to before_scf
1 parent d450c6e commit 307116c

File tree

4 files changed

+15
-23
lines changed

4 files changed

+15
-23
lines changed

source/module_esolver/esolver_ks.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ void ESolver_KS<T, Device>::before_all_runners(UnitCell& ucell, const Input_para
213213
PARAM.inp.mixing_dmr,
214214
ucell.omega,
215215
ucell.tpiba);
216-
p_chgmix->init_mixing();
217216

218217
//! 5) ESolver depends on the Symmetry module
219218
// symmetry analysis should be performed every time the cell is changed
@@ -483,6 +482,10 @@ void ESolver_KS<T, Device>::before_scf(UnitCell& ucell, const int istep)
483482

484483
//! 1) call before_scf() of ESolver_FP
485484
ESolver_FP::before_scf(ucell, istep);
485+
486+
this->p_chgmix->init_mixing();
487+
this->p_chgmix->mixing_restart_step = PARAM.inp.scf_nmax + 1;
488+
this->p_chgmix->mixing_restart_count = 0;
486489
}
487490

488491
template <typename T, typename Device>

source/module_esolver/esolver_ks_lcao.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -522,23 +522,6 @@ void ESolver_KS_LCAO<TK, TR>::iter_init(UnitCell& ucell, const int istep, const
522522
// call iter_init() of ESolver_KS
523523
ESolver_KS<TK>::iter_init(ucell, istep, iter);
524524

525-
if (iter == 1)
526-
{
527-
this->p_chgmix->mix_reset(); // init mixing
528-
this->p_chgmix->mixing_restart_step = PARAM.inp.scf_nmax + 1;
529-
this->p_chgmix->mixing_restart_count = 0;
530-
// this output will be removed once the feeature is stable
531-
if (GlobalC::dftu.uramping > 0.01)
532-
{
533-
std::cout << " U-Ramping! Current U = ";
534-
for (int i = 0; i < GlobalC::dftu.U0.size(); i++)
535-
{
536-
std::cout << GlobalC::dftu.U[i] * ModuleBase::Ry_to_eV << " ";
537-
}
538-
std::cout << " eV " << std::endl;
539-
}
540-
}
541-
542525
// for mixing restart
543526
if (iter == this->p_chgmix->mixing_restart_step && PARAM.inp.mixing_restart > 0.0)
544527
{

source/module_esolver/esolver_ks_pw.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,6 @@ void ESolver_KS_PW<T, Device>::iter_init(UnitCell& ucell, const int istep, const
387387
// call iter_init() of ESolver_KS
388388
ESolver_KS<T, Device>::iter_init(ucell, istep, iter);
389389

390-
if (iter == 1)
391-
{
392-
this->p_chgmix->init_mixing();
393-
this->p_chgmix->mixing_restart_step = PARAM.inp.scf_nmax + 1;
394-
}
395390
// for mixing restart
396391
if (iter == this->p_chgmix->mixing_restart_step && PARAM.inp.mixing_restart > 0.0)
397392
{

source/module_esolver/lcao_before_scf.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,17 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(UnitCell& ucell, const int istep)
272272
this->sf.strucFac);
273273
}
274274

275+
// this output will be removed once the feeature is stable
276+
if (GlobalC::dftu.uramping > 0.01)
277+
{
278+
std::cout << " U-Ramping! Current U = ";
279+
for (int i = 0; i < GlobalC::dftu.U0.size(); i++)
280+
{
281+
std::cout << GlobalC::dftu.U[i] * ModuleBase::Ry_to_eV << " ";
282+
}
283+
std::cout << " eV " << std::endl;
284+
}
285+
275286
ModuleBase::timer::tick("ESolver_KS_LCAO", "before_scf");
276287
return;
277288
}

0 commit comments

Comments
 (0)