@@ -416,7 +416,7 @@ namespace DFTD3 {
416416 " XC (`" + xc + " `)'s DFT-D3M(0) parameters not found" );
417417 }
418418 }
419- else // zero
419+ else if (method == " zero" )
420420 {
421421 if (zero.find (xc_lowercase) != zero.end ())
422422 {
@@ -428,6 +428,11 @@ namespace DFTD3 {
428428 " XC (`" + xc + " `)'s DFT-D3(0) parameters not found" );
429429 }
430430 }
431+ else // should not reach here
432+ {
433+ ModuleBase::WARNING_QUIT (" ModuleHamiltGeneral::ModuleVDW::DFTD3::_search" ,
434+ " Unknown DFT-D3 method: " + method);
435+ }
431436 }
432437
433438 std::string _lowercase (const std::string& s)
@@ -469,7 +474,8 @@ namespace DFTD3 {
469474 double & s6,
470475 double & s8,
471476 double & a1,
472- double & a2)
477+ double & a2,
478+ std::ofstream* plog = nullptr )
473479 {
474480 const std::map<std::string, std::string> param_map = {
475481 {" d3_bj" , " bj" }, {" d3_0" , " zero" }, {" d3_bjm" , " bjm" }, {" d3_0m" , " zerom" },
@@ -493,12 +499,16 @@ namespace DFTD3 {
493499 s8 = (s8_in == " default" ) ? param[3 ] : std::stod (s8_in);
494500 a1 = (a1_in == " default" ) ? param[2 ] : std::stod (a1_in);
495501 a2 = (a2_in == " default" ) ? param[5 ] : std::stod (a2_in);
496- // param = {s6, s8, a1, a2};
497- // FmtTable vdwd3tab({"Parameters", "Original", "Autoset"}, 4, {"%10s", "%10s", "%10.4f"});
498- // const std::vector<std::string> items = {"s6", "s8", "a1", "a2"};
499- // vdwd3tab << items << flag << param;
500- // std::cout << "DFT-D3 Dispersion correction parameters autoset\n" << vdwd3tab.str()
501- // << std::flush;
502+ if (plog != nullptr ) // logging the autoset
503+ {
504+ param = {s6, s8, a1, a2};
505+ FmtTable vdwd3tab ({" Parameters" , " Original" , " Autoset" }, 4 , {" %10s" , " %10s" , " %10.4f" });
506+ const std::vector<std::string> items = {" s6" , " s8" , " a1" , " a2" };
507+ vdwd3tab << items << flag << param;
508+ (*plog) << " \n DFT-D3 Dispersion correction parameters autoset\n " << vdwd3tab.str ()
509+ << " XC functional: " << xc_in << std::endl;
510+ }
511+
502512 }
503513 }
504514}
0 commit comments