Skip to content

Commit 6833fe1

Browse files
committed
update esolver_ks
1 parent f06944c commit 6833fe1

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

source/source_esolver/esolver_ks.cpp

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,7 @@ void ESolver_KS<T, Device>::iter_finish(UnitCell& ucell, const int istep, int& i
334334
//----------------------------------------------------------------
335335
// 2) compute magnetization, only for LSDA(spin==2)
336336
//----------------------------------------------------------------
337-
ucell.magnet.compute_mag(ucell.omega,
338-
this->chr.nrxx,
339-
this->chr.nxyz,
340-
this->chr.rho,
337+
ucell.magnet.compute_mag(ucell.omega, this->chr.nrxx, this->chr.nxyz, this->chr.rho,
341338
this->pelec->nelec_spin.data());
342339

343340
//----------------------------------------------------------------
@@ -434,20 +431,15 @@ void ESolver_KS<T, Device>::iter_finish(UnitCell& ucell, const int istep, int& i
434431
MPI_Bcast(this->chr.rho[0], this->pw_rhod->nrxx, MPI_DOUBLE, 0, BP_WORLD);
435432
#endif
436433

437-
//----------------------------------------------------------------
438434
// 4) Update potentials (should be done every SF iter)
439-
//----------------------------------------------------------------
440-
// Hamilt should be used after it is constructed.
441-
// this->phamilt->update(conv_esolver);
442435
this->update_pot(ucell, istep, iter, conv_esolver);
443436

444-
//----------------------------------------------------------------
445437
// 5) calculate energies
446-
//----------------------------------------------------------------
447438
// 1 means Harris-Foulkes functional
448439
// 2 means Kohn-Sham functional
449440
this->pelec->cal_energies(1);
450441
this->pelec->cal_energies(2);
442+
451443
if (iter == 1)
452444
{
453445
this->pelec->f_en.etot_old = this->pelec->f_en.etot;
@@ -456,7 +448,6 @@ void ESolver_KS<T, Device>::iter_finish(UnitCell& ucell, const int istep, int& i
456448
this->pelec->f_en.etot_old = this->pelec->f_en.etot;
457449

458450

459-
460451
//----------------------------------------------------------------
461452
// 6) time and meta-GGA
462453
//----------------------------------------------------------------
@@ -481,21 +472,15 @@ void ESolver_KS<T, Device>::iter_finish(UnitCell& ucell, const int istep, int& i
481472

482473

483474
#ifdef __RAPIDJSON
484-
//----------------------------------------------------------------
485475
// 7) add Json of scf mag
486-
//----------------------------------------------------------------
487-
Json::add_output_scf_mag(ucell.magnet.tot_mag,
488-
ucell.magnet.abs_mag,
476+
Json::add_output_scf_mag(ucell.magnet.tot_mag, ucell.magnet.abs_mag,
489477
this->pelec->f_en.etot * ModuleBase::Ry_to_eV,
490478
this->pelec->f_en.etot_delta * ModuleBase::Ry_to_eV,
491-
drho,
492-
duration);
479+
drho, duration);
493480
#endif //__RAPIDJSON
494481

495482

496-
//----------------------------------------------------------------
497483
// 7) SCF restart information
498-
//----------------------------------------------------------------
499484
if (PARAM.inp.mixing_restart > 0
500485
&& iter == this->p_chgmix->mixing_restart_step - 1
501486
&& iter != PARAM.inp.scf_nmax)
@@ -504,9 +489,7 @@ void ESolver_KS<T, Device>::iter_finish(UnitCell& ucell, const int istep, int& i
504489
std::cout << " SCF restart after this step!" << std::endl;
505490
}
506491

507-
//----------------------------------------------------------------
508492
// 8) Iter finish
509-
//----------------------------------------------------------------
510493
ESolver_FP::iter_finish(ucell, istep, iter, conv_esolver);
511494
}
512495

0 commit comments

Comments
 (0)