Skip to content

Commit

Permalink
Add support for libxc 7.x.x
Browse files Browse the repository at this point in the history
  • Loading branch information
vanderhe committed Dec 6, 2024
1 parent 40a9137 commit beefbab
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cmake/SkProgsUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ function (skprogs_add_fypp_defines fyppflags)
list(APPEND _fyppflags -DWITH_MPI)
endif()

list(APPEND _fyppflags -DLIBXC_VERSION_MAJOR="${Libxc_VERSION_MAJOR}")

set(${fyppflags} ${_fyppflags} PARENT_SCOPE)

endfunction()
Expand Down
1 change: 1 addition & 0 deletions common/include/common.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#:set DEBUG = getvar('DEBUG', 0)
#:set WITH_ASSERT = defined('WITH_ASSERT') or DEBUG > 0
#:set WITH_MPI = defined('WITH_MPI')
#:set LIBXC_VERSION_MAJOR = getvar('LIBXC_VERSION_MAJOR', 1)


#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Expand Down
7 changes: 7 additions & 0 deletions sktwocnt/lib/twocnt.F90
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,17 @@ module twocnt

use, intrinsic :: iso_c_binding, only : c_size_t

#:if LIBXC_VERSION_MAJOR == 6
use xc_f03_lib_m, only : xc_f03_func_t, xc_f03_func_init, xc_f03_func_end, xc_f03_lda_vxc,&
& xc_f03_gga_vxc, XC_LDA_X, XC_LDA_X_YUKAWA, XC_LDA_C_PW, XC_GGA_X_PBE, XC_GGA_C_PBE,&
& XC_GGA_X_B88, XC_GGA_C_LYP, XC_GGA_X_SFAT_PBE, XC_HYB_GGA_XC_B3LYP,&
& XC_HYB_GGA_XC_CAMY_B3LYP, XC_UNPOLARIZED, xc_f03_func_set_ext_params
#:elif LIBXC_VERSION_MAJOR == 7
use xc_f03_lib_m, only : xc_f03_func_t, xc_f03_func_init, xc_f03_func_end, xc_f03_lda_vxc,&
& xc_f03_gga_vxc, xc_f03_func_set_ext_params, XC_UNPOLARIZED
use xc_f03_funcs_m, only : XC_LDA_X, XC_LDA_X_YUKAWA, XC_LDA_C_PW, XC_GGA_X_PBE, XC_GGA_C_PBE,&
& XC_GGA_X_B88, XC_GGA_C_LYP, XC_GGA_X_SFAT_PBE, XC_HYB_GGA_XC_B3LYP, XC_HYB_GGA_XC_CAMY_B3LYP
#:endif

implicit none
private
Expand Down
4 changes: 2 additions & 2 deletions slateratom/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ set(sources-f90
output.f90
total_energy.f90
utilities.f90
xcfunctionals.f90
zora_routines.f90)

set(sources-fpp
Expand All @@ -34,7 +33,8 @@ set(sources-fpp
confinement.F90
input.F90
lapackroutines.F90
simplemixer.F90)
simplemixer.F90
xcfunctionals.F90)

skprogs_preprocess("${FYPP}" "${fypp_flags}" "F90" "f90" "${sources-fpp}" sources-f90-preproc)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
#:include 'common.fypp'

!> Module related to supported xc-functionals of the slateratom code.
module xcfunctionals

use, intrinsic :: iso_c_binding, only : c_size_t
use common_accuracy, only : dp
use common_constants, only : rec4pi
use utilities, only : zeroOutCpotOfEmptyDensitySpinChannels
#:if LIBXC_VERSION_MAJOR == 6
use xc_f03_lib_m, only : xc_f03_func_t, xc_f03_func_init, xc_f03_func_end, xc_f03_lda_exc_vxc,&
& xc_f03_gga_exc_vxc, xc_f03_func_set_ext_params, XC_LDA_X, XC_LDA_X_YUKAWA, XC_LDA_C_PW,&
& XC_GGA_X_PBE, XC_GGA_X_B88, XC_GGA_X_SFAT_PBE, XC_HYB_GGA_XC_B3LYP,&
& XC_HYB_GGA_XC_CAMY_B3LYP, XC_GGA_C_PBE, XC_GGA_C_LYP, XC_POLARIZED
#:elif LIBXC_VERSION_MAJOR == 7
use xc_f03_lib_m, only : xc_f03_func_t, xc_f03_func_init, xc_f03_func_end, xc_f03_lda_exc_vxc,&
& xc_f03_gga_exc_vxc, xc_f03_func_set_ext_params, XC_POLARIZED
use xc_f03_funcs_m, only : XC_LDA_X, XC_LDA_X_YUKAWA, XC_LDA_C_PW, XC_GGA_X_PBE, XC_GGA_X_B88,&
& XC_GGA_X_SFAT_PBE, XC_HYB_GGA_XC_B3LYP, XC_HYB_GGA_XC_CAMY_B3LYP, XC_GGA_C_PBE,&
& XC_GGA_C_LYP
#:endif

implicit none
private
Expand Down

0 comments on commit beefbab

Please sign in to comment.