Skip to content

Commit 2163ef5

Browse files
committed
Revert "move the after_all_runners() function of the base class to the end"
This reverts commit d672bca.
1 parent de9d3de commit 2163ef5

File tree

7 files changed

+11
-23
lines changed

7 files changed

+11
-23
lines changed

source/source_esolver/esolver_gets.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,11 @@ void ESolver_GetS::runner(UnitCell& ucell, const int istep)
154154
ModuleBase::timer::tick("ESolver_GetS", "runner");
155155
}
156156

157-
void ESolver_GetS::after_all_runners(UnitCell& ucell)
158-
{};
159-
157+
void ESolver_GetS::after_all_runners(UnitCell& ucell) {};
160158
double ESolver_GetS::cal_energy()
161159
{
162160
return 0.0;
163161
};
164-
165162
void ESolver_GetS::cal_force(UnitCell& ucell, ModuleBase::matrix& force) {};
166163
void ESolver_GetS::cal_stress(UnitCell& ucell, ModuleBase::matrix& stress) {};
167164

source/source_esolver/esolver_ks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ void ESolver_KS<T, Device>::after_scf(UnitCell& ucell, const int istep, const bo
606606
template <typename T, typename Device>
607607
void ESolver_KS<T, Device>::after_all_runners(UnitCell& ucell)
608608
{
609-
//! Ensure the function of base class is called last
609+
// 1) write Etot information
610610
ESolver_FP::after_all_runners(ucell);
611611
}
612612

source/source_esolver/esolver_ks_lcao.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ void ESolver_KS_LCAO<TK, TR>::after_all_runners(UnitCell& ucell)
410410
ModuleBase::TITLE("ESolver_KS_LCAO", "after_all_runners");
411411
ModuleBase::timer::tick("ESolver_KS_LCAO", "after_all_runners");
412412

413+
ESolver_KS<TK>::after_all_runners(ucell);
413414

414415
const int nspin0 = (PARAM.inp.nspin == 2) ? 2 : 1;
415416

@@ -511,9 +512,6 @@ void ESolver_KS_LCAO<TK, TR>::after_all_runners(UnitCell& ucell)
511512
);
512513
}
513514

514-
//! Ensure the function of base class is called last
515-
ESolver_KS<TK>::after_all_runners(ucell);
516-
517515
ModuleBase::timer::tick("ESolver_KS_LCAO", "after_all_runners");
518516
}
519517

source/source_esolver/esolver_ks_lcaopw.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ namespace ModuleESolver
236236
template <typename T>
237237
void ESolver_KS_LIP<T>::after_all_runners(UnitCell& ucell)
238238
{
239+
ESolver_KS_PW<T>::after_all_runners(ucell);
239240

240241
#ifdef __LCAO
241242
if (PARAM.inp.out_mat_xc)
@@ -261,10 +262,6 @@ namespace ModuleESolver
261262
);
262263
}
263264
#endif
264-
265-
//! Ensure the function of base class is called last
266-
ESolver_KS_PW<T>::after_all_runners(ucell);
267-
268265
}
269266
template class ESolver_KS_LIP<std::complex<float>>;
270267
template class ESolver_KS_LIP<std::complex<double>>;

source/source_esolver/esolver_ks_pw.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,16 +530,14 @@ void ESolver_KS_PW<T, Device>::cal_stress(UnitCell& ucell, ModuleBase::matrix& s
530530
template <typename T, typename Device>
531531
void ESolver_KS_PW<T, Device>::after_all_runners(UnitCell& ucell)
532532
{
533+
ESolver_KS<T, Device>::after_all_runners(ucell);
533534

534535
ModuleIO::ctrl_runner_pw<T, Device>(ucell, this->pelec, this->pw_wfc,
535536
this->pw_rho, this->pw_rhod, this->chr, this->kv, this->psi,
536537
this->kspw_psi, this->__kspw_psi, this->sf,
537538
this->ppcell, this->solvent, this->ctx, this->Pgrid, PARAM.inp);
538539

539540
elecstate::teardown_estate_pw<T, Device>(this->pelec, this->vsep_cell);
540-
541-
//! Ensure the function of base class is called last
542-
ESolver_KS<T, Device>::after_all_runners(ucell);
543541

544542
}
545543

source/source_esolver/esolver_of.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,6 @@ void ESolver_OF::after_opt(const int istep, UnitCell& ucell, const bool conv_eso
540540
*/
541541
void ESolver_OF::after_all_runners(UnitCell& ucell)
542542
{
543-
//! Ensure the function of base class is called last
544543
ESolver_FP::after_all_runners(ucell);
545544
}
546545

source/source_esolver/esolver_sdft_pw.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,16 @@ void ESolver_SDFT_PW<T, Device>::cal_stress(UnitCell& ucell, ModuleBase::matrix&
259259
template <typename T, typename Device>
260260
void ESolver_SDFT_PW<T, Device>::after_all_runners(UnitCell& ucell)
261261
{
262-
// release memory
262+
// 1) write down etot and eigenvalues (for MDFT) information
263+
ESolver_FP::after_all_runners(ucell);
264+
265+
// 2) release memory
263266
if (this->method_sto == 2)
264267
{
265268
stowf.clean_chiallorder(); // release lots of memories
266269
}
267270

268-
// write down DOS
271+
// 3) write down DOS
269272
if (PARAM.inp.out_dos)
270273
{
271274
if(!std::is_same<T, std::complex<double>>::value || !std::is_same<Device, base_device::DEVICE_CPU>::value)
@@ -291,7 +294,7 @@ void ESolver_SDFT_PW<T, Device>::after_all_runners(UnitCell& ucell)
291294
sto_dos.caldos(PARAM.inp.dos_sigma, PARAM.inp.dos_edelta_ev, PARAM.inp.npart_sto);
292295
}
293296

294-
// sKG cost memory, and it should be placed near the end of the program
297+
// 4) sKG cost memory, and it should be placed at the end of the program
295298
if (PARAM.inp.cal_cond)
296299
{
297300
Sto_EleCond<Real, Device> sto_elecond(&ucell,
@@ -312,10 +315,6 @@ void ESolver_SDFT_PW<T, Device>::after_all_runners(UnitCell& ucell)
312315
PARAM.inp.cond_nonlocal,
313316
PARAM.inp.npart_sto);
314317
}
315-
316-
// write down etot and eigenvalues (for MDFT) information
317-
ESolver_FP::after_all_runners(ucell);
318-
319318
}
320319

321320

0 commit comments

Comments
 (0)