detect size of libxc np

This commit is contained in:
edoapra 2022-12-16 09:57:19 -08:00
parent 5c0b38a519
commit 13e0f41858
No known key found for this signature in database
GPG key ID: 472C4EBB4F3AEDFA
3 changed files with 27 additions and 4 deletions

View file

@ -13,10 +13,13 @@ LIBRARY = libnwdft.a
LIB_INCLUDES = -I../include
ifdef USE_LIBXC
LIB_DEFINES += -DXC_MAJOR_VERSION=$(shell grep XC_MAJOR_VERSION ../../libext/libxc/install/include/xc_version.h |cut -d " " -f 3)
LIB_DEFINES += -DLIBXC_NP_SIZE=$(shell ./libxc_findsizenp.sh ../../libext/libxc/install/include)
LIB_INCLUDES += -I../../libext/libxc/install/include
endif
ifdef LIBXC_INCLUDE
LIB_DEFINES += -DXC_MAJOR_VERSION=$(shell grep XC_MAJOR_VERSION $(LIBXC_INCLUDE)/xc_version.h |cut -d " " -f 3)
LIB_DEFINES += -DXC_MAJOR_VERSION=$(shell grep XC_MAJOR_VE
RSION $(LIBXC_INCLUDE)/xc_version.h |cut -d " " -f 3)
LIB_DEFINES += -DLIBXC_NP_SIZE=$(shell ./libxc_findsizenp.sh $(LIBXC_INCLUDE))
LIB_INCLUDES += -I$(LIBXC_INCLUDE)
endif
LIB_INCLUDES += -I.

View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
npstring=$(egrep np "$1"/xc.h|head -1)
np_array=($npstring)
count=-1
sizenp_string=' '
for substring in "${np_array[@]}"; do
[[ $substring == "np," ]] && sizenp_string=${np_array[$count]} && break
((++count))
done
if [[ "$sizenp_string" == 'int' ]]; then
size_np=4
elif [[ "$sizenp_string" == 'size_t' ]]; then
size_np=8
else
echo "unexpected sizenp_string $sizenp_string"
exit 1
fi
echo $size_np

View file

@ -63,10 +63,12 @@
logical gga,mgga,dolap
logical,external :: nwchem_libxc_family
#if XC_MAJOR_VERSION > 5
#if LIBXC_NP_SIZE == 4
integer*4 nqs
#elif LIBXC_NP_SIZE == 8
integer(c_size_t) :: nqs
#else
integer*4 :: nqs
#elif
#error "unexpected value for LIBXC_NP_SIZE"
#endif
#ifdef USE_LIBXC
type(xc_f03_func_t) :: xcfunc