Skip to content

Commit cb5ae35

Browse files
authored
Fix a minor bug in v_xc timer (#6514)
1 parent 07658be commit cb5ae35

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

source/source_hamilt/module_xc/xc_functional_vxc.cpp

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,35 @@
44
// NOTE : it is only used for nspin = 1 and 2, the nspin = 4 case is treated in v_xc
55
// 3. v_xc_meta : which takes rho and tau as input, and v_xc as output
66

7-
#include "xc_functional.h"
87
#include "source_base/parallel_reduce.h"
98
#include "source_base/timer.h"
109
#include "source_io/module_parameter/parameter.h"
10+
#include "xc_functional.h"
1111

1212
#ifdef USE_LIBXC
1313
#include "xc_functional_libxc.h"
1414
#endif
1515

1616
// [etxc, vtxc, v] = XC_Functional::v_xc(...)
17-
std::tuple<double,double,ModuleBase::matrix> XC_Functional::v_xc(
18-
const int &nrxx, // number of real-space grid
19-
const Charge* const chr,
20-
const UnitCell *ucell) // core charge density
17+
std::tuple<double, double, ModuleBase::matrix> XC_Functional::v_xc(const int& nrxx, // number of real-space grid
18+
const Charge* const chr,
19+
const UnitCell* ucell) // core charge density
2120
{
22-
ModuleBase::TITLE("XC_Functional","v_xc");
23-
ModuleBase::timer::tick("XC_Functional","v_xc");
21+
ModuleBase::TITLE("XC_Functional", "v_xc");
22+
ModuleBase::timer::tick("XC_Functional", "v_xc");
2423

25-
if(use_libxc)
24+
if (use_libxc)
2625
{
2726
#ifdef USE_LIBXC
28-
return XC_Functional_Libxc::v_xc_libxc(XC_Functional::get_func_id(), nrxx, ucell->omega, ucell->tpiba, chr, &(scaling_factor_xc));
27+
ModuleBase::timer::tick("XC_Functional", "v_xc");
28+
return XC_Functional_Libxc::v_xc_libxc(XC_Functional::get_func_id(),
29+
nrxx,
30+
ucell->omega,
31+
ucell->tpiba,
32+
chr,
33+
&(scaling_factor_xc));
2934
#else
30-
ModuleBase::WARNING_QUIT("v_xc","compile with LIBXC");
35+
ModuleBase::WARNING_QUIT("v_xc", "compile with LIBXC");
3136
#endif
3237
}
3338

@@ -134,7 +139,7 @@ std::tuple<double,double,ModuleBase::matrix> XC_Functional::v_xc(
134139
double rhodw = arhox * (1.0-zeta) / 2.0;
135140
XC_Functional_Libxc::xc_spin_libxc(XC_Functional::get_func_id(), rhoup, rhodw, exc, vxc[0], vxc[1]);
136141
#else
137-
ModuleBase::WARNING_QUIT("v_xc","compile with LIBXC");
142+
ModuleBase::WARNING_QUIT("v_xc", "compile with LIBXC");
138143
#endif
139144
}
140145
else
@@ -180,6 +185,6 @@ std::tuple<double,double,ModuleBase::matrix> XC_Functional::v_xc(
180185
etxc *= ucell->omega / chr->rhopw->nxyz;
181186
vtxc *= ucell->omega / chr->rhopw->nxyz;
182187

183-
ModuleBase::timer::tick("XC_Functional","v_xc");
188+
ModuleBase::timer::tick("XC_Functional", "v_xc");
184189
return std::make_tuple(etxc, vtxc, std::move(v));
185190
}

0 commit comments

Comments
 (0)