Skip to content

Commit 4c1b930

Browse files
committed
special programming for wb97 famiy
1 parent 1aca04f commit 4c1b930

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

source/module_hamilt_general/module_xc/xc_functional_libxc.cpp

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,48 @@
99
#endif
1010

1111
#include <xc.h>
12-
1312
#include <vector>
1413

15-
std::string uppercase(const std::string& str)
14+
std::string _uppercase(const std::string& str)
1615
{
1716
std::string result = str;
1817
std::transform(result.begin(), result.end(), result.begin(), ::toupper);
1918
return result;
2019
}
2120

22-
bool XC_Functional_Libxc::xc_with_nonlocal_vdw(const std::string& xc_func_in)
21+
bool not_supported_xc_with_nonlocal_vdw(const std::string& xc_func_in)
2322
{
24-
const std::string xc_func = uppercase(xc_func_in);
23+
const std::string xc_func = _uppercase(xc_func_in);
2524
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"};
25+
/* known excluded: GGA_X_OPTB86B_VDW, GGA_X_OPTB88_VDW, GGA_X_OPTPBE_VDW, GGA_X_PBEK1_VDW */
26+
27+
if(xc_func.find("VV10") != std::string::npos) { return true; }
28+
/* known excluded: GGA_XC_VV10, HYB_GGA_XC_LC_VV10, MGGA_C_REVSCAN_VV10, MGGA_C_SCAN_VV10,
29+
MGGA_C_SCANL_VV10, MGGA_XC_VCML_RVV10 */
30+
31+
const std::vector<std::string> not_supported = {"C09X", "VCML", "HYB_MGGA_XC_WB97M_V", "MGGA_XC_B97M_V"};
2832
for(const std::string& str : not_supported)
2933
{
3034
if(xc_func.find(str) != std::string::npos) { return true; }
3135
}
36+
/* known excluded: GGA_X_C09X, MGGA_X_VCML, HYB_MGGA_XC_WB97M_V, MGGA_XC_B97M_V */
37+
38+
/* There is also a functional not quite sure: HYB_GGA_XC_WB97X_V */
39+
if(xc_func.find("HYB_GGA_XC_WB97X_V") != std::string::npos)
40+
{
41+
std::cout << " WARNING: range-seperated XC omega-B97 family with nonlocal correction term is used.\n"
42+
<< " if you are not planning to use these functionals like wB97X-D3BJ that:\n"
43+
<< " XC_GGA_XC_WB97X_V with specified D3BJ DFT-D3 parameters, this is not what\n"
44+
<< " you want." << std::endl;
45+
}
3246
return false;
3347
}
3448

3549
std::pair<int,std::vector<int>> XC_Functional_Libxc::set_xc_type_libxc(std::string xc_func_in)
3650
{
3751
// determine the type (lda/gga/mgga)
3852
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))
53+
if(not_supported_xc_with_nonlocal_vdw(xc_func_in))
4054
{ ModuleBase::WARNING_QUIT("XC_Functional::set_xc_type_libxc","functionals with non-local dispersion are not supported."); }
4155
func_type = 1;
4256
if(xc_func_in.find("GGA") != std::string::npos) { func_type = 2; }

source/module_hamilt_general/module_xc/xc_functional_libxc.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ 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);
2725

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

0 commit comments

Comments
 (0)