Skip to content

Commit 2d19f7b

Browse files
committed
update timer
1 parent f14edcb commit 2d19f7b

File tree

2 files changed

+32
-33
lines changed

2 files changed

+32
-33
lines changed

source/module_cell/module_neighbor/sltk_grid.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ void Grid::setMemberVariables(std::ofstream& ofs_in, // output data to ofs
266266

267267
void Grid::Construct_Adjacent(const UnitCell& ucell)
268268
{
269-
ModuleBase::timer::tick("Grid", "Construct_Adjacent_expand");
269+
ModuleBase::timer::tick("Grid", "constru_adj");
270270

271271
for (int i_type = 0; i_type < ucell.ntype; i_type++)
272272
{
@@ -283,23 +283,17 @@ void Grid::Construct_Adjacent(const UnitCell& ucell)
283283
this->Construct_Adjacent_near_box(atom);
284284
}
285285
}
286-
ModuleBase::timer::tick("Grid", "Construct_Adjacent_expand");
286+
ModuleBase::timer::tick("Grid", "constru_adj");
287287
}
288288

289289
void Grid::Construct_Adjacent_near_box(const FAtom& fatom)
290290
{
291-
// if (test_grid)ModuleBase::TITLE(ofs_running, "Grid", "Construct_Adjacent_expand_periodic");
292-
ModuleBase::timer::tick("Grid", "Construct_Adjacent_expand_periodic");
293-
int box_i_x, box_i_y, box_i_z;
291+
ModuleBase::timer::tick("Grid", "adj_near_box");
292+
int box_i_x=0;
293+
int box_i_y=0;
294+
int box_i_z=0;
294295
this->getBox(box_i_x, box_i_y, box_i_z, fatom.x, fatom.y, fatom.z);
295296

296-
/* for (int box_i_x_adj = std::max(box_i_x - 1, 0); box_i_x_adj <= std::min(box_i_x + 1, box_nx - 1); box_i_x_adj++)
297-
{
298-
for (int box_i_y_adj = std::max(box_i_y - 1, 0); box_i_y_adj <= std::min(box_i_y + 1, box_ny - 1); box_i_y_adj++)
299-
{
300-
for (int box_i_z_adj = std::max(box_i_z - 1, 0); box_i_z_adj <= std::min(box_i_z + 1, box_nz - 1); box_i_z_adj++)
301-
{
302-
*/
303297
for (int box_i_x_adj = 0; box_i_x_adj < glayerX + glayerX_minus; box_i_x_adj++)
304298
{
305299
for (int box_i_y_adj = 0; box_i_y_adj < glayerY + glayerY_minus; box_i_y_adj++)
@@ -313,7 +307,7 @@ void Grid::Construct_Adjacent_near_box(const FAtom& fatom)
313307
}
314308
}
315309
}
316-
ModuleBase::timer::tick("Grid", "Construct_Adjacent_expand_periodic");
310+
ModuleBase::timer::tick("Grid", "adj_near_box");
317311
}
318312

319313
void Grid::Construct_Adjacent_final(const FAtom& fatom1,

source/module_elecstate/module_charge/charge_mixing_residual.cpp

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ double Charge_Mixing::get_dkin(Charge* chr, const double nelec)
110110

111111
double Charge_Mixing::inner_product_recip_rho(std::complex<double>* rho1, std::complex<double>* rho2)
112112
{
113-
ModuleBase::TITLE("Charge_Mixing", "inner_product_recip_rho");
114-
ModuleBase::timer::tick("Charge_Mixing", "inner_product_recip_rho");
113+
ModuleBase::TITLE("Charge_Mixing", "recip_rho");
114+
ModuleBase::timer::tick("Charge_Mixing", "recip_rho");
115115

116116
std::complex<double>** rhog1 = new std::complex<double>*[PARAM.inp.nspin];
117117
std::complex<double>** rhog2 = new std::complex<double>*[PARAM.inp.nspin];
@@ -134,10 +134,11 @@ double Charge_Mixing::inner_product_recip_rho(std::complex<double>* rho1, std::c
134134
#endif
135135
for (int ig = 0; ig < this->rhopw->npw; ++ig)
136136
{
137-
if (this->rhopw->gg[ig] < 1e-8) {
138-
continue;
139-
}
140-
sum += (conj(rhog1[0][ig]) * rhog2[0][ig]).real() / this->rhopw->gg[ig];
137+
if (this->rhopw->gg[ig] < 1e-8)
138+
{
139+
continue;
140+
}
141+
sum += (conj(rhog1[0][ig]) * rhog2[0][ig]).real() / this->rhopw->gg[ig];
141142
}
142143
sum *= fac;
143144
return sum;
@@ -207,9 +208,10 @@ double Charge_Mixing::inner_product_recip_rho(std::complex<double>* rho1, std::c
207208
#endif
208209
for (int ig = 0; ig < this->rhopw->npw; ig++)
209210
{
210-
if (ig == this->rhopw->ig_gge0) {
211-
continue;
212-
}
211+
if (ig == this->rhopw->ig_gge0)
212+
{
213+
continue;
214+
}
213215
sum += (conj(rhog1[0][ig]) * rhog2[0][ig]).real() / this->rhopw->gg[ig];
214216
}
215217
sum *= fac;
@@ -243,20 +245,21 @@ double Charge_Mixing::inner_product_recip_rho(std::complex<double>* rho1, std::c
243245
#ifdef __MPI
244246
Parallel_Reduce::reduce_pool(sum);
245247
#endif
246-
ModuleBase::timer::tick("Charge_Mixing", "inner_product_recip_rho");
247248

248249
sum *= *this->omega * 0.5;
249250

250251
delete[] rhog1;
251252
delete[] rhog2;
253+
254+
ModuleBase::timer::tick("Charge_Mixing", "recip_rho");
252255
return sum;
253256
}
254257

255258
// a simple inner product, now is not used anywhere. For test only.
256259
double Charge_Mixing::inner_product_recip_simple(std::complex<double>* rho1, std::complex<double>* rho2)
257260
{
258-
ModuleBase::TITLE("Charge_Mixing", "inner_product_recip_simple");
259-
ModuleBase::timer::tick("Charge_Mixing", "inner_product_recip_simple");
261+
ModuleBase::TITLE("Charge_Mixing", "recip_simple");
262+
ModuleBase::timer::tick("Charge_Mixing", "recip_simple");
260263

261264
double rnorm = 0.0;
262265
// consider a resize for mixing_angle
@@ -274,16 +277,16 @@ double Charge_Mixing::inner_product_recip_simple(std::complex<double>* rho1, std
274277
Parallel_Reduce::reduce_pool(rnorm);
275278
#endif
276279

277-
ModuleBase::timer::tick("Charge_Mixing", "inner_product_recip_simple");
280+
ModuleBase::timer::tick("Charge_Mixing", "recip_simple");
278281

279282
return rnorm;
280283
}
281284

282285
// a Hartree-like inner product
283286
double Charge_Mixing::inner_product_recip_hartree(std::complex<double>* rhog1, std::complex<double>* rhog2)
284287
{
285-
ModuleBase::TITLE("Charge_Mixing", "inner_product_recip_hartree");
286-
ModuleBase::timer::tick("Charge_Mixing", "inner_product_recip_hartree");
288+
ModuleBase::TITLE("Charge_Mixing", "recip_hartree");
289+
ModuleBase::timer::tick("Charge_Mixing", "recip_hartree");
287290

288291
static const double fac = ModuleBase::e2 * ModuleBase::FOUR_PI / ((*this->tpiba) * (*this->tpiba));
289292
static const double fac2 = ModuleBase::e2 * ModuleBase::FOUR_PI / (ModuleBase::TWO_PI * ModuleBase::TWO_PI);
@@ -444,10 +447,10 @@ double Charge_Mixing::inner_product_recip_hartree(std::complex<double>* rhog1, s
444447
Parallel_Reduce::reduce_pool(sum);
445448
#endif
446449

447-
ModuleBase::timer::tick("Charge_Mixing", "inner_product_recip_hartree");
448-
449450
sum *= *this->omega * 0.5;
450451

452+
ModuleBase::timer::tick("Charge_Mixing", "recip_hartree");
453+
451454
return sum;
452455
}
453456

@@ -456,8 +459,10 @@ double Charge_Mixing::inner_product_real(double* rho1, double* rho2)
456459
double rnorm = 0.0;
457460
// consider a resize for mixing_angle
458461
int resize_tmp = 1;
459-
if (PARAM.inp.nspin == 4 && this->mixing_angle > 0) { resize_tmp = 2;
460-
}
462+
if (PARAM.inp.nspin == 4 && this->mixing_angle > 0)
463+
{
464+
resize_tmp = 2;
465+
}
461466

462467
#ifdef _OPENMP
463468
#pragma omp parallel for reduction(+ : rnorm)
@@ -470,4 +475,4 @@ double Charge_Mixing::inner_product_real(double* rho1, double* rho2)
470475
Parallel_Reduce::reduce_pool(rnorm);
471476
#endif
472477
return rnorm;
473-
}
478+
}

0 commit comments

Comments
 (0)