diff --git a/Doc/user_guide.tex b/Doc/user_guide.tex index cb0591e03..e28ac836a 100644 --- a/Doc/user_guide.tex +++ b/Doc/user_guide.tex @@ -881,7 +881,7 @@ Several functionals in \libxc\ depend on one or more external parameters. Some o In order to see the available parameters for a given \libxc\ functional and their corresponding indexes, the \texttt{xc\_infos.x} program is available in \texttt{XClib} folder. For more details see Sec. \ref{SubSec:XCtest}.\\ The two routines can be called almost anywhere in \qe, however, as any other \texttt{XClib} setting routine, they must be declared through the \texttt{xc\_lib} module.\\ Without setting the external parameters inside the code, their default value will be assumed. This could lead to results different from the expectations.\\ -In any case, when external parameters are needed by the chosen functionals, a warning message will appear in the output of \qe. +In any case, when external parameters are needed by the chosen functionals, a warning message will appear in the output of \qe. An example of Libxc parameter setting can be found in the \texttt{xclib\_test.f90} code (see below). % \paragraph{Functionals with partial output.} A few \libxc\ functional routines provides the potential but not the energy. These functionals are available in \qe\ for all the families and their output energy is set to zero. diff --git a/XClib/dft_setting_routines.f90 b/XClib/dft_setting_routines.f90 index fdde0f4e2..21157aca3 100644 --- a/XClib/dft_setting_routines.f90 +++ b/XClib/dft_setting_routines.f90 @@ -1031,11 +1031,8 @@ CONTAINS ENDIF ! n_ext_params(iid) = xc_f03_func_info_get_n_ext_params( xc_info(iid) ) -#if (XC_MAJOR_VERSION<=5) p0 = 0 ; pn = n_ext_params(iid)-1 ; ips = 1 -#else - p0 = 1 ; pn = n_ext_params(iid) ; ips = 0 -#endif + ! DO ip = p0, pn par_list(iid,ip+ips) = xc_f03_func_info_get_ext_params_default_value( & xc_info(iid), ip ) diff --git a/XClib/xclib_test.f90 b/XClib/xclib_test.f90 index f21a58798..9ce4b6229 100644 --- a/XClib/xclib_test.f90 +++ b/XClib/xclib_test.f90 @@ -38,7 +38,8 @@ PROGRAM xclib_test xclib_get_ID, xclib_reset_dft, xc, xc_gcx, & xc_metagcx, xclib_dft_is_libxc, xclib_init_libxc,& xclib_finalize_libxc, xclib_set_finite_size_volume,& - xclib_set_auxiliary_flags, xclib_dft_is, start_exx + xclib_set_auxiliary_flags, xclib_dft_is, start_exx,& + set_libxc_ext_param USE xclib_utils_and_para !--xml USE xmltools, ONLY: xml_open_file, xml_closefile,xmlr_readtag, & @@ -581,6 +582,19 @@ PROGRAM xclib_test #if defined(__LIBXC) IF (xclib_dft_is_libxc( 'ANY' )) CALL xclib_init_libxc( ns, .FALSE. ) ! + IF ( igcc1==428 .AND. is_libxc(4) ) THEN + ! Example of how to change an external parameter in a Libxc + ! functional (HYB_GGA_XC_HSE06). + ! Arguments: + ! 1- family-kind index (1:LDAx, 2:LDAc, 3:GGAx, ...); + ! 2- parameter index (you find it with xc_infos.x); + ! 3- new value of the parameter. + CALL set_libxc_ext_param( 4, 0, 0.25d0 ) + CALL set_libxc_ext_param( 4, 1, 0.106d0 ) + CALL set_libxc_ext_param( 4, 2, 0.106d0 ) + ! + ENDIF + ! IF ( xc_kind_error ) THEN CALL print_test_status( skipped4 ) CALL xclib_finalize_libxc() @@ -653,10 +667,14 @@ PROGRAM xclib_test ELSE exc_term = (iexch1+igcx1+imeta1 /= 0) cor_term = (icorr1+igcc1+imetac1 /= 0) + IF ( exc_term ) xc_kind='X' + IF ( cor_term ) xc_kind='C' + IF ( exc_term .AND. cor_term ) xc_kind='XC' ENDIF ! IF (MGGA) THEN IF (.NOT. xc_derivative ) THEN + xc_kind ='XC' exc_term = .TRUE. cor_term = .TRUE. ELSE