1717// even in a LSDA calculation.
1818// ----------------------------------------------------------
1919#include " charge.h"
20- #include < vector>
21- #include " module_parameter/parameter.h"
20+
2221#include " module_base/global_function.h"
2322#include " module_base/global_variable.h"
24- #include " module_parameter/parameter.h"
2523#include " module_base/libm/libm.h"
2624#include " module_base/math_integral.h"
2725#include " module_base/memory.h"
2826#include " module_base/parallel_reduce.h"
2927#include " module_base/timer.h"
3028#include " module_base/tool_threading.h"
3129#include " module_cell/unitcell.h"
32- #include " module_elecstate/elecstate_getters.h"
3330#include " module_elecstate/magnetism.h"
31+ #include " module_hamilt_general/module_xc/xc_functional.h"
32+ #include " module_parameter/parameter.h"
33+
34+ #include < vector>
3435
3536#ifdef USE_PAW
3637#include " module_cell/module_paw/paw_cell.h"
@@ -80,7 +81,7 @@ void Charge::destroy()
8081 delete[] _space_rhog_save;
8182 delete[] _space_kin_r;
8283 delete[] _space_kin_r_save;
83- if (elecstate::get_xc_func_type () == 3 || elecstate::get_xc_func_type () == 5 || PARAM.inp .out_elf [0 ] > 0 )
84+ if (XC_Functional::get_has_kedf () || PARAM.inp .out_elf [0 ] > 0 )
8485 {
8586 delete[] kin_r;
8687 delete[] kin_r_save;
@@ -121,7 +122,7 @@ void Charge::allocate(const int& nspin_in)
121122 _space_rho_save = new double [nspin * nrxx];
122123 _space_rhog = new std::complex <double >[nspin * ngmc];
123124 _space_rhog_save = new std::complex <double >[nspin * ngmc];
124- if (elecstate::get_xc_func_type () == 3 || elecstate::get_xc_func_type () == 5 || PARAM.inp .out_elf [0 ] > 0 )
125+ if (XC_Functional::get_has_kedf () || PARAM.inp .out_elf [0 ] > 0 )
125126 {
126127 _space_kin_r = new double [nspin * nrxx];
127128 _space_kin_r_save = new double [nspin * nrxx];
@@ -130,7 +131,7 @@ void Charge::allocate(const int& nspin_in)
130131 rhog = new std::complex <double >*[nspin];
131132 rho_save = new double *[nspin];
132133 rhog_save = new std::complex <double >*[nspin];
133- if (elecstate::get_xc_func_type () == 3 || elecstate::get_xc_func_type () == 5 || PARAM.inp .out_elf [0 ] > 0 )
134+ if (XC_Functional::get_has_kedf () || PARAM.inp .out_elf [0 ] > 0 )
134135 {
135136 kin_r = new double *[nspin];
136137 kin_r_save = new double *[nspin];
@@ -151,7 +152,7 @@ void Charge::allocate(const int& nspin_in)
151152 ModuleBase::GlobalFunc::ZEROS (rhog[is], ngmc);
152153 ModuleBase::GlobalFunc::ZEROS (rho_save[is], nrxx);
153154 ModuleBase::GlobalFunc::ZEROS (rhog_save[is], ngmc);
154- if (elecstate::get_xc_func_type () == 3 || elecstate::get_xc_func_type () == 5 || PARAM.inp .out_elf [0 ] > 0 )
155+ if (XC_Functional::get_has_kedf () || PARAM.inp .out_elf [0 ] > 0 )
155156 {
156157 kin_r[is] = _space_kin_r + is * nrxx;
157158 ModuleBase::GlobalFunc::ZEROS (kin_r[is], nrxx);
@@ -171,7 +172,7 @@ void Charge::allocate(const int& nspin_in)
171172 ModuleBase::Memory::record (" Chg::rho_save" , sizeof (double ) * nspin * nrxx);
172173 ModuleBase::Memory::record (" Chg::rhog" , sizeof (double ) * nspin * ngmc);
173174 ModuleBase::Memory::record (" Chg::rhog_save" , sizeof (double ) * nspin * ngmc);
174- if (elecstate::get_xc_func_type () == 3 || elecstate::get_xc_func_type () == 5 || PARAM.inp .out_elf [0 ] > 0 )
175+ if (XC_Functional::get_has_kedf () || PARAM.inp .out_elf [0 ] > 0 )
175176 {
176177 ModuleBase::Memory::record (" Chg::kin_r" , sizeof (double ) * nspin * ngmc);
177178 ModuleBase::Memory::record (" Chg::kin_r_save" , sizeof (double ) * nspin * ngmc);
@@ -701,9 +702,10 @@ void Charge::save_rho_before_sum_band()
701702 for (int is = 0 ; is < PARAM.inp .nspin ; is++)
702703 {
703704 ModuleBase::GlobalFunc::DCOPY (rho[is], rho_save[is], this ->rhopw ->nrxx );
704- if (elecstate::get_xc_func_type () == 3 || elecstate::get_xc_func_type () == 5 ) {
705+ if (XC_Functional::get_has_kedf ())
706+ {
705707 ModuleBase::GlobalFunc::DCOPY (kin_r[is], kin_r_save[is], this ->rhopw ->nrxx );
706- }
708+ }
707709#ifdef USE_PAW
708710 if (PARAM.inp .use_paw ) {
709711 ModuleBase::GlobalFunc::DCOPY (nhat[is], nhat_save[is], this ->rhopw ->nrxx );
0 commit comments