Skip to content

Commit 9b05571

Browse files
committed
refactor in_built_xc_func_ext_params()
1 parent 15967e7 commit 9b05571

File tree

1 file changed

+32
-24
lines changed

1 file changed

+32
-24
lines changed

source/module_hamilt_general/module_xc/xc_functional_libxc.cpp

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -149,44 +149,52 @@ XC_Functional_Libxc::set_xc_type_libxc(const std::string& xc_func_in)
149149

150150
const std::vector<double> in_built_xc_func_ext_params(const int id)
151151
{
152-
const std::map<int, std::vector<double>> mymap = {
152+
switch(id)
153+
{
153154
// finite temperature XC functionals
154-
{XC_LDA_XC_KSDT, {PARAM.inp.xc_temperature * 0.5}},
155-
{XC_LDA_XC_CORRKSDT, {PARAM.inp.xc_temperature * 0.5}},
156-
{XC_LDA_XC_GDSMFB, {PARAM.inp.xc_temperature * 0.5}},
157-
// hybrid functionals
155+
case XC_LDA_XC_KSDT:
156+
return {PARAM.inp.xc_temperature * 0.5};
157+
case XC_LDA_XC_CORRKSDT:
158+
return {PARAM.inp.xc_temperature * 0.5};
159+
case XC_LDA_XC_GDSMFB:
160+
return {PARAM.inp.xc_temperature * 0.5};
158161
#ifdef __EXX
159-
{XC_HYB_GGA_XC_PBEH, {GlobalC::exx_info.info_global.hybrid_alpha,
160-
GlobalC::exx_info.info_global.hse_omega,
161-
GlobalC::exx_info.info_global.hse_omega}},
162-
{XC_HYB_GGA_XC_HSE06, {GlobalC::exx_info.info_global.hybrid_alpha,
163-
GlobalC::exx_info.info_global.hse_omega,
164-
GlobalC::exx_info.info_global.hse_omega}},
162+
// hybrid functionals
163+
case XC_HYB_GGA_XC_PBEH:
164+
return {GlobalC::exx_info.info_global.hybrid_alpha,
165+
GlobalC::exx_info.info_global.hse_omega,
166+
GlobalC::exx_info.info_global.hse_omega};
167+
case XC_HYB_GGA_XC_HSE06:
168+
return {GlobalC::exx_info.info_global.hybrid_alpha,
169+
GlobalC::exx_info.info_global.hse_omega,
170+
GlobalC::exx_info.info_global.hse_omega};
165171
// short-range of B88_X
166-
{XC_GGA_X_ITYH, {PARAM.inp.exx_hse_omega}},
172+
case XC_GGA_X_ITYH:
173+
return {PARAM.inp.exx_hse_omega};
167174
// short-range of LYP_C
168-
{XC_GGA_C_LYPR, {0.04918, 0.132, 0.2533, 0.349,
169-
0.35/2.29, 2.0/2.29, PARAM.inp.exx_hse_omega}},
175+
case XC_GGA_C_LYPR:
176+
return {0.04918, 0.132, 0.2533, 0.349,
177+
0.35/2.29, 2.0/2.29, PARAM.inp.exx_hse_omega};
170178
#endif
171-
};
172-
auto it = mymap.find(id);
173-
return (it != mymap.end()) ? it->second : std::vector<double>{};
179+
default:
180+
return std::vector<double>{};
181+
}
174182
}
175183

176184
const std::vector<double> external_xc_func_ext_params(const int id)
177185
{
178186
const std::map<int, std::vector<double>> mymap = {
179-
{
180-
PARAM.inp.xc_exch_ext[0],
187+
{
188+
PARAM.inp.xc_exch_ext[0],
181189
std::vector<double>(PARAM.inp.xc_exch_ext.begin()+1,
182-
PARAM.inp.xc_exch_ext.end())
190+
PARAM.inp.xc_exch_ext.end())
183191
},
184-
{
185-
PARAM.inp.xc_corr_ext[0],
192+
{
193+
PARAM.inp.xc_corr_ext[0],
186194
std::vector<double>(PARAM.inp.xc_corr_ext.begin()+1,
187-
PARAM.inp.xc_corr_ext.end())
195+
PARAM.inp.xc_corr_ext.end())
188196
}
189-
};
197+
};
190198
auto it = mymap.find(id);
191199
return (it != mymap.end()) ? it->second : std::vector<double>{};
192200
}

0 commit comments

Comments
 (0)