From c1f3fe68a62fb5fe4f0abfd2e87194f672ab903f Mon Sep 17 00:00:00 2001 From: Matthias Redies Date: Tue, 21 May 2019 11:15:40 +0200 Subject: [PATCH] check for libxc errors --- types/types_xcpot_libxc.F90 | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/types/types_xcpot_libxc.F90 b/types/types_xcpot_libxc.F90 index 302ffe88..3be855aa 100644 --- a/types/types_xcpot_libxc.F90 +++ b/types/types_xcpot_libxc.F90 @@ -63,6 +63,7 @@ CONTAINS INTEGER, INTENT(IN) :: vxc_id_x, vxc_id_c ! potential functional INTEGER, INTENT(IN) :: exc_id_x, exc_id_c ! energy functionals LOGICAL :: same_functionals ! are vxc and exc equal + INTEGER :: errors(4) #ifdef CPP_LIBXC INTEGER :: err @@ -84,23 +85,32 @@ CONTAINS IF (jspins==1) THEN ! potential functionals - CALL xc_f03_func_init(xcpot%vxc_func_x, xcpot%func_vxc_id_x, XC_UNPOLARIZED) - IF (xcpot%func_vxc_id_c>0) CALL xc_f03_func_init(xcpot%vxc_func_c, xcpot%func_vxc_id_c, XC_UNPOLARIZED) + CALL xc_f03_func_init(xcpot%vxc_func_x, xcpot%func_vxc_id_x, XC_UNPOLARIZED, err=errors(1)) + IF (xcpot%func_vxc_id_c>0) CALL xc_f03_func_init(xcpot%vxc_func_c, xcpot%func_vxc_id_c, & + XC_UNPOLARIZED, err=errors(2)) ! energy functionals - CALL xc_f03_func_init(xcpot%exc_func_x, xcpot%func_exc_id_x, XC_UNPOLARIZED) - IF (xcpot%func_exc_id_c>0) CALL xc_f03_func_init(xcpot%exc_func_c, xcpot%func_exc_id_c, XC_UNPOLARIZED) + CALL xc_f03_func_init(xcpot%exc_func_x, xcpot%func_exc_id_x, XC_UNPOLARIZED, err=errors(3)) + IF (xcpot%func_exc_id_c>0) CALL xc_f03_func_init(xcpot%exc_func_c, xcpot%func_exc_id_c, & + XC_UNPOLARIZED, err=errors(4)) ELSE ! potential functionals - CALL xc_f03_func_init(xcpot%vxc_func_x, xcpot%func_vxc_id_x, XC_POLARIZED) - IF (xcpot%func_vxc_id_c>0) CALL xc_f03_func_init(xcpot%vxc_func_c, xcpot%func_vxc_id_c, XC_POLARIZED) + CALL xc_f03_func_init(xcpot%vxc_func_x, xcpot%func_vxc_id_x, XC_POLARIZED, err=errors(1)) + IF (xcpot%func_vxc_id_c>0) CALL xc_f03_func_init(xcpot%vxc_func_c, xcpot%func_vxc_id_c, & + XC_POLARIZED, err=errors(2)) !energy functionals - CALL xc_f03_func_init(xcpot%exc_func_x, xcpot%func_exc_id_x, XC_POLARIZED) - IF (xcpot%func_exc_id_c>0) CALL xc_f03_func_init(xcpot%exc_func_c, xcpot%func_exc_id_c, XC_POLARIZED) + CALL xc_f03_func_init(xcpot%exc_func_x, xcpot%func_exc_id_x, XC_POLARIZED, err=errors(3)) + IF (xcpot%func_exc_id_c>0) CALL xc_f03_func_init(xcpot%exc_func_c, xcpot%func_exc_id_c, & + XC_POLARIZED, err=errors(4)) END IF + IF(errors(1) /= 0) call juDFT_error("Exchange potential functional not in LibXC") + IF(errors(2) /= 0) call juDFT_error("Correlation potential functional not in LibXC") + IF(errors(3) /= 0) call juDFT_error("Exchange energy functional not in LibXC") + IF(errors(4) /= 0) call juDFT_error("Correlation energy functional not in LibXC") + !check if any potental is a MetaGGA IF(ANY([XC_FAMILY_MGGA, XC_FAMILY_HYB_MGGA] == xc_get_family(xcpot%vxc_func_x))) THEN call juDFT_error("vxc_x: MetaGGA is not implemented for potentials") -- GitLab