mirror of https://gitlab.com/QEF/q-e.git
XClib - small adds (Libxc ext params example)
This commit is contained in:
parent
2c44792a15
commit
a3d4cda070
|
@ -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}.\\
|
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.\\
|
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.\\
|
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.}
|
\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.
|
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.
|
||||||
|
|
|
@ -1031,11 +1031,8 @@ CONTAINS
|
||||||
ENDIF
|
ENDIF
|
||||||
!
|
!
|
||||||
n_ext_params(iid) = xc_f03_func_info_get_n_ext_params( xc_info(iid) )
|
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
|
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
|
DO ip = p0, pn
|
||||||
par_list(iid,ip+ips) = xc_f03_func_info_get_ext_params_default_value( &
|
par_list(iid,ip+ips) = xc_f03_func_info_get_ext_params_default_value( &
|
||||||
xc_info(iid), ip )
|
xc_info(iid), ip )
|
||||||
|
|
|
@ -38,7 +38,8 @@ PROGRAM xclib_test
|
||||||
xclib_get_ID, xclib_reset_dft, xc, xc_gcx, &
|
xclib_get_ID, xclib_reset_dft, xc, xc_gcx, &
|
||||||
xc_metagcx, xclib_dft_is_libxc, xclib_init_libxc,&
|
xc_metagcx, xclib_dft_is_libxc, xclib_init_libxc,&
|
||||||
xclib_finalize_libxc, xclib_set_finite_size_volume,&
|
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
|
USE xclib_utils_and_para
|
||||||
!--xml
|
!--xml
|
||||||
USE xmltools, ONLY: xml_open_file, xml_closefile,xmlr_readtag, &
|
USE xmltools, ONLY: xml_open_file, xml_closefile,xmlr_readtag, &
|
||||||
|
@ -581,6 +582,19 @@ PROGRAM xclib_test
|
||||||
#if defined(__LIBXC)
|
#if defined(__LIBXC)
|
||||||
IF (xclib_dft_is_libxc( 'ANY' )) CALL xclib_init_libxc( ns, .FALSE. )
|
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
|
IF ( xc_kind_error ) THEN
|
||||||
CALL print_test_status( skipped4 )
|
CALL print_test_status( skipped4 )
|
||||||
CALL xclib_finalize_libxc()
|
CALL xclib_finalize_libxc()
|
||||||
|
@ -653,10 +667,14 @@ PROGRAM xclib_test
|
||||||
ELSE
|
ELSE
|
||||||
exc_term = (iexch1+igcx1+imeta1 /= 0)
|
exc_term = (iexch1+igcx1+imeta1 /= 0)
|
||||||
cor_term = (icorr1+igcc1+imetac1 /= 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
|
ENDIF
|
||||||
!
|
!
|
||||||
IF (MGGA) THEN
|
IF (MGGA) THEN
|
||||||
IF (.NOT. xc_derivative ) THEN
|
IF (.NOT. xc_derivative ) THEN
|
||||||
|
xc_kind ='XC'
|
||||||
exc_term = .TRUE.
|
exc_term = .TRUE.
|
||||||
cor_term = .TRUE.
|
cor_term = .TRUE.
|
||||||
ELSE
|
ELSE
|
||||||
|
|
Loading…
Reference in New Issue