Repository navigation
Expand file tree
/
Copy pathpot_xc.cpp
More file actions
47 lines (40 loc) · 1.54 KB
/
Copy pathpot_xc.cpp
File metadata and controls
47 lines (40 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "pot_xc.h"
#include "source_base/timer.h"
#include "source_pw/module_pwdft/global.h"
#ifdef USE_LIBXC
#include "source_hamilt/module_xc/xc_functional_libxc.h"
#endif
namespace elecstate
{
void PotXC::cal_v_eff(const Charge*const chg, const UnitCell*const ucell, ModuleBase::matrix& v_eff)
{
ModuleBase::TITLE("PotXC", "cal_veff");
ModuleBase::timer::tick("PotXC", "cal_veff");
const int nrxx_current = chg->nrxx;
//----------------------------------------------------------
// calculate the exchange-correlation potential
//----------------------------------------------------------
if (XC_Functional::get_ked_flag())
{
#ifdef USE_LIBXC
const std::tuple<double, double, ModuleBase::matrix, ModuleBase::matrix> etxc_vtxc_v
= XC_Functional_Libxc::v_xc_meta(XC_Functional::get_func_id(), nrxx_current, ucell->omega, ucell->tpiba, chg);
*(this->etxc_) = std::get<0>(etxc_vtxc_v);
*(this->vtxc_) = std::get<1>(etxc_vtxc_v);
v_eff += std::get<2>(etxc_vtxc_v);
*(this->vofk) = std::get<3>(etxc_vtxc_v);
#else
ModuleBase::WARNING_QUIT("v_of_rho", "to use mGGA, compile with LIBXC");
#endif
}
else
{
const std::tuple<double, double, ModuleBase::matrix> etxc_vtxc_v
= XC_Functional::v_xc(nrxx_current, chg, ucell);
*(this->etxc_) = std::get<0>(etxc_vtxc_v);
*(this->vtxc_) = std::get<1>(etxc_vtxc_v);
v_eff += std::get<2>(etxc_vtxc_v);
}
ModuleBase::timer::tick("PotXC", "cal_veff");
}
} // namespace elecstate