@@ -34,30 +34,44 @@ int XC_Functional::get_func_type()
3434{
3535 return func_type;
3636}
37+
3738void XC_Functional::set_xc_first_loop (const UnitCell& ucell)
3839{
40+ ModuleBase::TITLE (" XC_Functional" , " set_xc_first_loop" );
3941 /* * In the special "two-level" calculation case,
4042the first scf iteration only calculate the functional without exact
4143exchange. but in "nscf" calculation, there is no need of "two-level"
4244method. */
43- if (ucell.atoms [0 ].ncpp .xc_func == " HF" || ucell.atoms [0 ].ncpp .xc_func == " HSE"
44- || ucell.atoms [0 ].ncpp .xc_func == " PBE0" || ucell.atoms [0 ].ncpp .xc_func == " LC_PBE"
45- || ucell.atoms [0 ].ncpp .xc_func == " LC_WPBE" || ucell.atoms [0 ].ncpp .xc_func == " LRC_WPBEH"
46- || ucell.atoms [0 ].ncpp .xc_func == " CAM_PBEH" ) {
45+ if (ucell.atoms [0 ].ncpp .xc_func == " HF" || ucell.atoms [0 ].ncpp .xc_func == " PBE0" || ucell.atoms [0 ].ncpp .xc_func == " HSE" )
46+ {
4747 XC_Functional::set_xc_type (" pbe" );
4848 }
49- else if (ucell.atoms [0 ].ncpp .xc_func == " SCAN0" ) {
50- XC_Functional::set_xc_type (" scan" );
49+ else if ( ucell.atoms [0 ].ncpp .xc_func == " LC_PBE" || ucell.atoms [0 ].ncpp .xc_func == " LC_WPBE"
50+ || ucell.atoms [0 ].ncpp .xc_func == " LRC_WPBEH" || ucell.atoms [0 ].ncpp .xc_func == " CAM_PBEH" )
51+ {
52+ XC_Functional::set_xc_type (" pbe" );
5153 }
52- else if (ucell.atoms [0 ].ncpp .xc_func == " B3LYP" ) {
54+ // added by jghan, 2024-07-07
55+ else if ( ucell.atoms [0 ].ncpp .xc_func == " MULLER" || ucell.atoms [0 ].ncpp .xc_func == " POWER"
56+ || ucell.atoms [0 ].ncpp .xc_func == " WP22" || ucell.atoms [0 ].ncpp .xc_func == " CWP22" )
57+ {
58+ XC_Functional::set_xc_type (" pbe" );
59+ }
60+ else if (ucell.atoms [0 ].ncpp .xc_func == " B3LYP" )
61+ {
5362 XC_Functional::set_xc_type (" blyp" );
5463 }
64+ else if (ucell.atoms [0 ].ncpp .xc_func == " SCAN0" )
65+ {
66+ XC_Functional::set_xc_type (" scan" );
67+ }
5568}
5669
5770// The setting values of functional id according to the index in LIBXC
5871// for detail, refer to https://www.tddft.org/programs/libxc/functionals/
5972void XC_Functional::set_xc_type (const std::string xc_func_in)
6073{
74+ ModuleBase::TITLE (" XC_Functional" , " set_xc_type" );
6175 // Note : due to the separation of gcx_spin and gcc_spin,
6276 // when you are adding new GGA functionals,
6377 // please put exchange first, followed by correlation,
@@ -346,4 +360,44 @@ void XC_Functional::set_xc_type(const std::string xc_func_in)
346360 use_libxc = false ;
347361#endif
348362
363+ }
364+
365+
366+ std::string XC_Functional::output_info ()
367+ {
368+ #ifdef USE_LIBXC
369+ if (use_libxc)
370+ {
371+ std::stringstream ss;
372+ ss<<" Libxc v" <<xc_version_string ()<<std::endl;
373+ ss<<" \t " <<xc_reference ()<<std::endl;
374+
375+ std::vector<xc_func_type> funcs = XC_Functional_Libxc::init_func (func_id, XC_UNPOLARIZED);
376+ for (const auto &func : funcs)
377+ {
378+ const xc_func_info_type *info = xc_func_get_info (&func);
379+ ss<<" XC: " <<xc_func_info_get_name (info)<<std::endl;
380+ for (int i=0 ; i<XC_MAX_REFERENCES; ++i)
381+ {
382+ const func_reference_type *ref = xc_func_info_get_references (func.info , i);
383+ if (ref)
384+ ss<<" \t " <<xc_func_reference_get_ref (ref)<<std::endl;
385+ }
386+ }
387+ XC_Functional_Libxc::finish_func (funcs);
388+ return ss.str ();
389+ }
390+ else
391+ {
392+ std::string s = " XC:\t " ;
393+ for (const auto &id: func_id)
394+ s += std::string (xc_functional_get_name (id))+" \t " ;
395+ return s;
396+ }
397+ #else
398+ std::string s = " XC:\t " ;
399+ for (const auto &id: func_id)
400+ s += std::to_string (id)+" \t " ;
401+ return s;
402+ #endif
349403}
0 commit comments