11#include " vdwd3_parameters.h"
2+ #include " vdw_xcname.h"
23
34#include < algorithm>
45#include < cctype>
@@ -72,9 +73,9 @@ std::string libxc_component(const std::string& component, const std::string& mar
7273
7374std::string canonicalize_libxc_pair (const std::string& input)
7475{
75- const std::size_t plus = input.find (' + ' );
76- std::string first = input.substr (0 , plus );
77- std::string second = input.substr (plus + 1 );
76+ const std::size_t separator = input.find (' : ' );
77+ std::string first = input.substr (0 , separator );
78+ std::string second = input.substr (separator + 1 );
7879 const std::string first_lower = lower_ascii (first);
7980 if (first_lower.find (" _c_" ) != std::string::npos)
8081 {
@@ -92,25 +93,26 @@ std::string canonicalize_libxc_pair(const std::string& input)
9293 // libxc_component(). Only mixed exchange/correlation names need an
9394 // explicit mapping; identical component names are handled above.
9495 static const std::map<std::string, std::string> special = {
95- {" b88+lyp " , " blyp " }, {" b88+p86 " , " bp86 " },
96- {" b88+ pbe" , " bpbe" }, {" pber+ pbe" , " revpbe" },
97- {" rpbe+ pbe" , " rpbe" }, {" optx+ lyp" , " olyp" },
98- {" mpw91+ pw91" , " mpwpw" }, {" ms2+ regtpss" , " ms2" },
99- {" ms2h+ regtpss" , " ms2h" }, {" pbe+ oppbe" , " pbeop" },
100- {" b88+ opb88" , " bop" },
96+ {" b88:p86 " , " bp86 " }, {" b88:lyp " , " blyp " },
97+ {" b88: pbe" , " bpbe" }, {" pber: pbe" , " revpbe" },
98+ {" rpbe: pbe" , " rpbe" }, {" optx: lyp" , " olyp" },
99+ {" mpw91: pw91" , " mpwpw" }, {" ms2: regtpss" , " ms2" },
100+ {" ms2h: regtpss" , " ms2h" }, {" pbe: oppbe" , " pbeop" },
101+ {" b88: opb88" , " bop" },
101102 };
102- const auto found = special.find (exchange + " + " + correlation);
103+ const auto found = special.find (exchange + " : " + correlation);
103104 return found == special.end () ? std::string () : found->second ;
104105}
105106
106107} // namespace
107108
108109std::string canonicalize_method_name (const std::string& input)
109110{
111+ const std::string xc_name = normalize_xc_name (input);
110112 std::string canonical;
111- if (input .find (' + ' ) != std::string::npos)
113+ if (xc_name .find (' : ' ) != std::string::npos)
112114 {
113- const std::string pair = canonicalize_libxc_pair (input );
115+ const std::string pair = canonicalize_libxc_pair (xc_name );
114116 if (!pair.empty ())
115117 {
116118 canonical = pair;
@@ -119,10 +121,9 @@ std::string canonicalize_method_name(const std::string& input)
119121
120122 if (canonical.empty ())
121123 {
122- const std::string lower = lower_ascii (input);
123- const std::size_t xc = lower.find (" _xc_" );
124- canonical = xc == std::string::npos ? normalized (input)
125- : normalized (input.substr (xc + 4 ));
124+ const std::size_t xc = xc_name.find (" _xc_" );
125+ canonical = xc == std::string::npos ? normalized (xc_name)
126+ : normalized (xc_name.substr (xc + 4 ));
126127 }
127128
128129 // ABACUS calls its HSE06 implementation "HSE" in user input and
0 commit comments