Skip to content

Commit 54ea210

Browse files
committed
is it because I voilate ODR?
1 parent fba0e72 commit 54ea210

File tree

2 files changed

+5
-27
lines changed

2 files changed

+5
-27
lines changed

source/module_hamilt_general/module_vdw/vdwd3_autoset_xcparam.cpp

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,6 @@ const std::map<std::string, std::vector<double>> op = {
358358

359359

360360
// 's6', 'rs6', 'a1', 's8', 'rs8', 'a2', 's9', 'alp', 'bet'
361-
// a declaration
362-
std::string _lowercase(const std::string& s);
363361
/**
364362
* @brief Get the dftd3 params object.
365363
* dftd3 method fall back: xc-bjm -> xc-bj -> pbe-bj
@@ -373,7 +371,7 @@ void _search(const std::string& xc,
373371
const std::string& method,
374372
std::vector<double>& param)
375373
{
376-
const std::string xc_lowercase = _lowercase(xc);
374+
const std::string xc_lowercase = FmtCore::lower(xc);
377375
const std::vector<std::string> allowed_ = { "bj", "zero", "bjm", "zerom", "op" };
378376
assert(std::find(allowed_.begin(), allowed_.end(), method) != allowed_.end());
379377
if (method == "op")
@@ -443,20 +441,6 @@ void _search(const std::string& xc,
443441
}
444442
}
445443

446-
std::string _lowercase(const std::string& s)
447-
{
448-
std::string result = s;
449-
std::transform(s.begin(), s.end(), result.begin(), ::tolower);
450-
return result;
451-
}
452-
453-
std::string _uppercase(const std::string& s)
454-
{
455-
std::string result = s;
456-
std::transform(s.begin(), s.end(), result.begin(), ::toupper);
457-
return result;
458-
}
459-
460444
/**
461445
* @brief Get DFT-D3 parameters. If if there are parameters defined,
462446
* then it will overwrite the search result. If all parameters are

source/module_hamilt_general/module_xc/xc_functional_libxc.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
#include "xc_functional_libxc.h"
44
#include "module_parameter/parameter.h"
55
#include "module_base/tool_quit.h"
6+
#include "module_base/formatter.h"
67

78
#ifdef __EXX
89
#include "module_hamilt_pw/hamilt_pwdft/global.h" // just for GlobalC::exx_info
910
#endif
1011

1112
#include <xc.h>
1213
#include <vector>
13-
bool xc_with_laplacian(const std::string& xc_func_in)
14+
bool not_supported_xc_with_laplacian(const std::string& xc_func_in)
1415
{
1516
// see Pyscf: https://github.com/pyscf/pyscf/blob/master/pyscf/dft/libxc.py#L1062
1617
// ABACUS issue: https://github.com/deepmodeling/abacus-develop/issues/5372
@@ -26,16 +27,9 @@ bool xc_with_laplacian(const std::string& xc_func_in)
2627
return false;
2728
}
2829

29-
std::string _uppercase(const std::string& str)
30-
{
31-
std::string result = str;
32-
std::transform(result.begin(), result.end(), result.begin(), ::toupper);
33-
return result;
34-
}
35-
3630
bool not_supported_xc_with_nonlocal_vdw(const std::string& xc_func_in)
3731
{
38-
const std::string xc_func = _uppercase(xc_func_in);
32+
const std::string xc_func = FmtCore::upper(xc_func_in);
3933
if(xc_func.find("VDW") != std::string::npos) { return true; }
4034
/* known excluded: GGA_X_OPTB86B_VDW, GGA_X_OPTB88_VDW, GGA_X_OPTPBE_VDW, GGA_X_PBEK1_VDW */
4135

@@ -64,7 +58,7 @@ bool not_supported_xc_with_nonlocal_vdw(const std::string& xc_func_in)
6458
std::pair<int,std::vector<int>> XC_Functional_Libxc::set_xc_type_libxc(std::string xc_func_in)
6559
{
6660
// determine the type (lda/gga/mgga)
67-
if (xc_with_laplacian(xc_func_in))
61+
if (not_supported_xc_with_laplacian(xc_func_in))
6862
{
6963
ModuleBase::WARNING_QUIT("XC_Functional::set_xc_type_libxc",
7064
"XC Functional involving Laplacian of rho is not implemented.");

0 commit comments

Comments
 (0)