Bump LibXC to version 5.2.0 (#1899)

* Bump LibXC to version 8.2.0

* Fix redefined i_ref

The behavior of the underlying routine changed such that xc_f03_func_info_get_references does not increase the counter if the next reference is not found. Before, this routine returned -1 instead.

* Use LDA_X_ERF correctly

Before LibXC 5.2, there was a misleading description of the functional. Because these tests implement range-separated MP2, we should adjust the regtests according to the revised documentation of LDA_X_ERF.
This commit is contained in:
Frederick Stein 2022-01-25 12:54:45 +01:00 committed by GitHub
parent 7c4b3984bb
commit 1ff4b5af0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 17 deletions

View file

@ -158,11 +158,15 @@ CONTAINS
INTEGER :: length
#if defined (__LIBXC)
CHARACTER(len=*), PARAMETER :: routineN = 'libxc_get_reference_length'
CHARACTER(LEN=default_string_length) :: func_name
INTEGER :: func_id
INTEGER :: func_id, handle
TYPE(xc_f03_func_t) :: xc_func
TYPE(xc_f03_func_info_t) :: xc_info
CALL timeset(routineN, handle)
func_name = libxc_params%section%name
IF (func_name == "LIBXC" .OR. func_name == "KE_LIBXC") THEN
CALL section_vals_val_get(libxc_params, "functional", c_val=func_name)
@ -182,6 +186,8 @@ CONTAINS
length = xc_libxc_get_reference_length(xc_info)
CALL xc_f03_func_end(xc_func)
CALL timestop(handle)
#else
MARK_USED(libxc_params)
MARK_USED(lsd)

View file

@ -159,18 +159,21 @@ CONTAINS
TYPE(xc_f03_func_info_t), INTENT(IN) :: xc_info
INTEGER :: length
CHARACTER(LEN=*), PARAMETER :: routineN = 'xc_libxc_get_reference_length'
INTEGER, PARAMETER :: maxlen = 67
CHARACTER(LEN=128) :: descr_string
CHARACTER(LEN=1024) :: doi_string, ref_string
INTEGER :: i, i_ref, idx, n_params
INTEGER :: i, i_ref, i_ref_old, n_params, handle
TYPE(xc_f03_func_reference_t) :: xc_ref
CALL timeset(routineN, handle)
! We are counting the number of necessary lines by carrying out a dry run of xc_libxc_wrap_info_refs
i_ref = 0
idx = 1
i_ref_old = -1
length = 0
DO WHILE (i_ref >= 0)
DO WHILE (i_ref >= 0 .AND. i_ref /= i_ref_old)
! information about functional references
xc_ref = xc_f03_func_info_get_references(xc_info, i_ref)
ref_string = xc_f03_func_reference_get_ref(xc_ref)
@ -187,11 +190,13 @@ CONTAINS
length = length + LEN_TRIM(descr_string) + 3
IF (MOD(length, maxlen) /= 0) length = length + maxlen - MOD(length, maxlen)
END DO
idx = idx + 1
i_ref_old = i_ref
END DO
! two additional lines for spin polarization, scaling factor and buffer
length = length + 2*maxlen
CALL timestop(handle)
END FUNCTION xc_libxc_get_reference_length
! **************************************************************************************************
@ -216,16 +221,17 @@ CONTAINS
CHARACTER(LEN=1028) :: doi_string, ref_string
! conservative estimate of the necessary length: 2*1028+11=2067
CHARACTER(LEN=2067) :: tmp_string
INTEGER :: empty, first, handle, i, i_ref, idx, &
INTEGER :: empty, first, handle, i, i_ref, i_ref_old, idx, &
last, n_params
TYPE(xc_f03_func_reference_t) :: xc_ref
CALL timeset(routineN, handle)
i_ref = 0
i_ref_old = -1
idx = 1
first = 1
DO WHILE (i_ref >= 0)
DO WHILE (i_ref >= 0 .AND. i_ref /= i_ref_old)
! information about functional references
xc_ref = xc_f03_func_info_get_references(xc_info, i_ref)
ref_string = xc_f03_func_reference_get_ref(xc_ref)
@ -261,6 +267,7 @@ CONTAINS
END IF
END DO
idx = idx + 1
i_ref_old = i_ref
END DO
SELECT CASE (polarized)
CASE (XC_UNPOLARIZED)

View file

@ -32,11 +32,10 @@
&END SCF
&XC
&XC_FUNCTIONAL
&LDA_X
&END LDA_X
# LDA_X_ERF is the short-range part of the functional
&LDA_X_ERF
_OMEGA ${MY_OMEGA}
SCALE -1.0
SCALE 1.0
&END
&LDA_C_PMGB06
SCALE -1.0

View file

@ -33,11 +33,10 @@
&END SCF
&XC
&XC_FUNCTIONAL
&LDA_X
&END LDA_X
# LDA_X_ERF is the short-range part of the functional
&LDA_X_ERF
_OMEGA ${MY_OMEGA}
SCALE -1.0
SCALE 1.0
&END
&LDA_C_PMGB06
SCALE -1.0

View file

@ -1,4 +1,4 @@
CH3-rsLDAlrMP2.inp 11 1e-8 -7.724767496356234
H2O-rsLDAlrMP2.inp 11 1e-8 -16.899255585036251
CH3-rsLDAlrMP2.inp 11 1e-8 -7.337744306690559
H2O-rsLDAlrMP2.inp 11 1e-8 -17.138844102419636
H2O-B2P3LYP.inp 11 1e-8 -17.030982292980237
#EOF

View file

@ -9,8 +9,8 @@
[ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)"
libxc_ver="5.1.7"
libxc_sha256="1a818fdfe5c5f74270bc8ef0c59064e8feebcd66b8f642c08aecc1e7d125be34"
libxc_ver="5.2.0"
libxc_sha256="b6fee9abea24a0ecbdd7a69aba19bb78d546043217e8465f5d878aac0636a27e"
source "${SCRIPT_DIR}"/common_vars.sh
source "${SCRIPT_DIR}"/tool_kit.sh
source "${SCRIPT_DIR}"/signal_trap.sh