Skip to content

Commit 1aca04f

Browse files
committed
fix
1 parent 7a29e2f commit 1aca04f

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

source/module_hamilt_general/module_xc/xc_functional_libxc.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,32 @@
1212

1313
#include <vector>
1414

15+
std::string uppercase(const std::string& str)
16+
{
17+
std::string result = str;
18+
std::transform(result.begin(), result.end(), result.begin(), ::toupper);
19+
return result;
20+
}
21+
22+
bool XC_Functional_Libxc::xc_with_nonlocal_vdw(const std::string& xc_func_in)
23+
{
24+
const std::string xc_func = uppercase(xc_func_in);
25+
if(xc_func.find("VDW") != std::string::npos) { return true; }
26+
if(xc_func.find("RVV10") != std::string::npos) { return true; }
27+
const std::vector<std::string> not_supported = {"C09X", "VCML"};
28+
for(const std::string& str : not_supported)
29+
{
30+
if(xc_func.find(str) != std::string::npos) { return true; }
31+
}
32+
return false;
33+
}
34+
1535
std::pair<int,std::vector<int>> XC_Functional_Libxc::set_xc_type_libxc(std::string xc_func_in)
1636
{
1737
// determine the type (lda/gga/mgga)
1838
int func_type; //0:none, 1:lda, 2:gga, 3:mgga, 4:hybrid lda/gga, 5:hybrid mgga
39+
if(XC_Functional_Libxc::xc_with_nonlocal_vdw(xc_func_in))
40+
{ ModuleBase::WARNING_QUIT("XC_Functional::set_xc_type_libxc","functionals with non-local dispersion are not supported."); }
1941
func_type = 1;
2042
if(xc_func_in.find("GGA") != std::string::npos) { func_type = 2; }
2143
if(xc_func_in.find("MGGA") != std::string::npos) { func_type = 3; }

source/module_hamilt_general/module_xc/xc_functional_libxc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ namespace XC_Functional_Libxc
2222
// sets functional type, which allows combination of LIBXC keyword connected by "+"
2323
// for example, "XC_LDA_X+XC_LDA_C_PZ"
2424
extern std::pair<int,std::vector<int>> set_xc_type_libxc(const std::string xc_func_in);
25+
// the following XC are not supported by ABACUS
26+
bool xc_with_nonlocal_vdw(const std::string& xc_func_in);
2527

2628
// converts func_id into corresponding xc_func_type vector
2729
extern std::vector<xc_func_type> init_func(const std::vector<int> &func_id, const int xc_polarized);

0 commit comments

Comments
 (0)