summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
Diffstat (limited to 'var')
-rwxr-xr-xvar/spack/repos/builtin/packages/salmon-tddft/cmakefix.patch108
-rwxr-xr-xvar/spack/repos/builtin/packages/salmon-tddft/fjmpi.patch67
-rwxr-xr-xvar/spack/repos/builtin/packages/salmon-tddft/package.py93
-rwxr-xr-xvar/spack/repos/builtin/packages/salmon-tddft/v2.0.libxc-5.0.patch312
4 files changed, 580 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/salmon-tddft/cmakefix.patch b/var/spack/repos/builtin/packages/salmon-tddft/cmakefix.patch
new file mode 100755
index 0000000000..65ff24bdb4
--- /dev/null
+++ b/var/spack/repos/builtin/packages/salmon-tddft/cmakefix.patch
@@ -0,0 +1,108 @@
+diff -ru spack-src.org/cmakefiles/Modules/FindBLACS.cmake spack-src/cmakefiles/Modules/FindBLACS.cmake
+--- spack-src.org/cmakefiles/Modules/FindBLACS.cmake 2020-12-22 17:37:19.960178408 +0900
++++ spack-src/cmakefiles/Modules/FindBLACS.cmake 2020-12-22 17:32:55.395622085 +0900
+@@ -29,7 +29,7 @@
+ # ## List of vendors (BLA_VENDOR) valid in this module
+ # Generic, Intel (MKL)
+
+-set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
++set(_salmon_blacks_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+
+ # Check the language being used
+ if( NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED) )
+@@ -55,7 +55,7 @@
+
+ # TODO: move this stuff to separate module
+
+-macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads)
++macro(salmon_Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads)
+ # This macro checks for the existence of the combination of fortran libraries
+ # given by _list. If the combination is found, this macro checks (using the
+ # Check_Fortran_Function_Exists macro) whether can link against that library
+@@ -170,7 +170,7 @@
+ if (BLA_VENDOR STREQUAL "Generic" OR
+ BLA_VENDOR STREQUAL "All")
+ if ( NOT BLACS_LIBRARIES )
+- check_lapack_libraries(
++ salmon_check_lapack_libraries(
+ BLACS_LIBRARIES
+ BLACS
+ pcheevx
+@@ -215,7 +215,7 @@
+
+ # First try empty lapack libs
+ if (NOT ${_LIBRARIES})
+- check_lapack_libraries(
++ salmon_check_lapack_libraries(
+ ${_LIBRARIES}
+ BLACS
+ ${BLACS_mkl_SEARCH_SYMBOL}
+@@ -228,7 +228,7 @@
+ # Then try the search libs
+ foreach (IT ${BLACS_SEARCH_LIBS})
+ if (NOT ${_LIBRARIES})
+- check_lapack_libraries(
++ salmon_check_lapack_libraries(
+ ${_LIBRARIES}
+ BLACS
+ ${BLACS_mkl_SEARCH_SYMBOL}
+@@ -268,4 +268,4 @@
+ endif()
+
+ cmake_pop_check_state()
+-set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
++set(CMAKE_FIND_LIBRARY_SUFFIXES ${_salmon_blacks_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+diff -ru spack-src.org/cmakefiles/Modules/FindScaLAPACK.cmake spack-src/cmakefiles/Modules/FindScaLAPACK.cmake
+--- spack-src.org/cmakefiles/Modules/FindScaLAPACK.cmake 2020-12-22 17:37:19.965178229 +0900
++++ spack-src/cmakefiles/Modules/FindScaLAPACK.cmake 2020-12-22 17:33:39.365051770 +0900
+@@ -29,7 +29,7 @@
+ # ## List of vendors (BLA_VENDOR) valid in this module
+ # Generic, Intel (MKL)
+
+-set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
++set(_salmon_scalapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+
+ # Check the language being used
+ if( NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED) )
+@@ -55,7 +55,7 @@
+
+ # TODO: move this stuff to separate module
+
+-macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads)
++macro(salmon_Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads)
+ # This macro checks for the existence of the combination of fortran libraries
+ # given by _list. If the combination is found, this macro checks (using the
+ # Check_Fortran_Function_Exists macro) whether can link against that library
+@@ -161,7 +161,7 @@
+ if (BLA_VENDOR STREQUAL "Generic" OR
+ BLA_VENDOR STREQUAL "All")
+ if ( NOT ScaLAPACK_LIBRARIES )
+- check_lapack_libraries(
++ salmon_check_lapack_libraries(
+ ScaLAPACK_LIBRARIES
+ ScaLAPACK
+ pcheevx
+@@ -202,7 +202,7 @@
+
+ # First try empty lapack libs
+ if (NOT ${_LIBRARIES})
+- check_lapack_libraries(
++ salmon_check_lapack_libraries(
+ ${_LIBRARIES}
+ ScaLAPACK
+ ${ScaLAPACK_mkl_SEARCH_SYMBOL}
+@@ -215,7 +215,7 @@
+ # Then try the search libs
+ foreach (IT ${ScaLAPACK_SEARCH_LIBS})
+ if (NOT ${_LIBRARIES})
+- check_lapack_libraries(
++ salmon_check_lapack_libraries(
+ ${_LIBRARIES}
+ ScaLAPACK
+ ${ScaLAPACK_mkl_SEARCH_SYMBOL}
+@@ -255,4 +255,4 @@
+ endif()
+
+ cmake_pop_check_state()
+-set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
++set(CMAKE_FIND_LIBRARY_SUFFIXES ${_salmon_scalapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
diff --git a/var/spack/repos/builtin/packages/salmon-tddft/fjmpi.patch b/var/spack/repos/builtin/packages/salmon-tddft/fjmpi.patch
new file mode 100755
index 0000000000..3208d150e8
--- /dev/null
+++ b/var/spack/repos/builtin/packages/salmon-tddft/fjmpi.patch
@@ -0,0 +1,67 @@
+--- spack-src.org/CMakeLists.txt 2020-07-21 12:08:53.000000000 +0900
++++ spack-src/CMakeLists.txt 2020-12-23 11:32:57.147128677 +0900
+@@ -38,6 +38,7 @@
+ option_set(USE_SCALAPACK "Use ScaLAPACK Library" OFF)
+ option_set(USE_EIGENEXA "Use EigenExa Library" OFF)
+ option_set(USE_LIBXC "Use Libxc library" OFF)
++option_set(USE_FJMPI "Use FUJITSU MPI" OFF)
+
+ ## Optimization for stencil compitations
+ option_set(USE_OPT_DOMAIN_IS_POW2 "Enable whether the opimization assumes that a stencil domain size is power of two" OFF)
+--- spack-src.org/src/config.h.in 2020-07-21 12:08:53.000000000 +0900
++++ spack-src/src/config.h.in 2020-12-23 11:48:48.384061907 +0900
+@@ -15,6 +15,7 @@
+ #cmakedefine SYSTEM_HAS_PATH_MAX_IN_LINUX_LIMITS_H
+
+ #cmakedefine USE_MPI
++#cmakedefine USE_FJMPI
+ #cmakedefine USE_SCALAPACK
+ #cmakedefine USE_EIGENEXA
+ #cmakedefine USE_LIBXC
+diff -ru spack-src.org/src/parallel/init_communicator.f90 spack-src/src/parallel/init_communicator.f90
+--- spack-src.org/src/parallel/init_communicator.f90 2020-07-21 12:08:53.000000000 +0900
++++ spack-src/src/parallel/init_communicator.f90 2020-12-23 11:50:58.997384260 +0900
+@@ -13,6 +13,7 @@
+ ! See the License for the specific language governing permissions and
+ ! limitations under the License.
+ !
++#include "config.h"
+ MODULE init_communicator
+ implicit none
+
+@@ -35,7 +36,7 @@
+ integer :: i1,i2,i3,i4,i5,ix,iy,iz,nl
+ integer,allocatable :: iranklists(:)
+
+-#ifdef __FUJITSU
++#ifdef USE_FJMPI
+ integer :: iret
+ #endif
+
+@@ -59,7 +60,7 @@
+ 0:nproc_k-1))
+
+ ! communicator r,o,k,ro,ko
+-#ifdef __FUJITSU
++#ifdef USE_FJMPI
+ call tofu_network_oriented_mapping(iret)
+ if (iret < 0) then
+ if (comm_is_root(info%id_rko)) then
+@@ -106,7 +107,7 @@
+
+ if (nl /= info%isize_rko-1) &
+ stop '[FATAL ERROR] init_communicator_dft'
+-#ifdef __FUJITSU
++#ifdef USE_FJMPI
+ end if
+ #endif
+
+@@ -234,7 +235,7 @@
+ info%icomm_xy = comm_create_group_byid(comm, iranklists(1:nl))
+ call comm_get_groupinfo(info%icomm_xy, info%id_xy, info%isize_xy)
+
+-#ifdef __FUJITSU
++#ifdef USE_FJMPI
+ contains
+ subroutine tofu_network_oriented_mapping(iret)
+ use mpi_ext
diff --git a/var/spack/repos/builtin/packages/salmon-tddft/package.py b/var/spack/repos/builtin/packages/salmon-tddft/package.py
new file mode 100755
index 0000000000..7634832748
--- /dev/null
+++ b/var/spack/repos/builtin/packages/salmon-tddft/package.py
@@ -0,0 +1,93 @@
+# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+
+from spack import *
+
+
+class SalmonTddft(CMakePackage):
+ """SALMON is an open-source computer program for ab-initio
+ quantum-mechanical calculations of electron dynamics at the nanoscale
+ that takes place in various situations of light-matter interactions.
+ It is based on time-dependent density functional theory, solving
+ time-dependent Kohn-Sham equation in real time and real space
+ with norm-conserving pseudopotentials."""
+
+ homepage = "https://salmon-tddft.jp"
+ url = "http://salmon-tddft.jp/download/SALMON-v.2.0.0.tar.gz"
+
+ version('2.0.0', sha256='c3bb80bc5d338cba21cd8f345acbf2f2d81ef75af069a0a0ddbdc0acf358456c')
+ version('1.2.1', sha256='a5045149e49abe9dd9edefe00cd1508a1323081bc3d034632176b728effdbaeb')
+
+ variant('mpi', default=False, description='Enable MPI')
+ variant('libxc', default=False, description='Enable libxc')
+ variant('scalapack', default=False, description='Enable scalapack')
+ variant(
+ 'manycore', default=False,
+ description='Enable optimization of reduction for many-core processor'
+ )
+ variant(
+ 'current_processing', default=False,
+ description='Enable preprocessing of the current computation in RT'
+ )
+
+ depends_on('cmake@3.14:', type='build')
+ depends_on('mpi', type='link', when='+mpi')
+ depends_on('scalapack', type='link', when='+scalapack')
+ depends_on('lapack', type='link')
+ depends_on('libxc', type='link', when='+libxc')
+ depends_on('libxc@:4.9', type='link', when='@:1.9.9 +libxc')
+
+ conflicts('+scalapack', when='~mpi')
+ conflicts('+manycore', when='@2.0.0:')
+ conflicts('+current_processing', when='@2.0.0:')
+
+ patch('fjmpi.patch', when='@2.0.0: %fj')
+ patch('v2.0.libxc-5.0.patch', when='@2.0.0 +libxc')
+ patch('cmakefix.patch', when='+scalapack')
+
+ def cmake_args(self):
+ define_from_variant = self.define_from_variant
+ spec = self.spec
+ define = self.define
+ args = [
+ define_from_variant('USE_SCALAPACK', 'scalapack'),
+ define_from_variant('USE_MPI', 'mpi'),
+ define_from_variant('USE_LIBXC', 'libxc'),
+ define_from_variant('REDUCE_FOR_MANYCORE', 'manycore'),
+ define_from_variant('CURRENT_PREPROCESSING', 'current_processing')
+ ]
+ if spec.satisfies('+mpi'):
+ args.extend([
+ define('CMAKE_C_COMPILER', spec['mpi'].mpicc),
+ define('CMAKE_Fortran_COMPILER', spec['mpi'].mpifc),
+ ])
+ if spec.satisfies('+scalapack'):
+ math_libs = spec['scalapack'].libs + \
+ spec['lapack'].libs + spec['blas'].libs
+ if spec.satisfies('@2.0:'):
+ args.append(define('ScaLAPACK_VENDOR_FLAGS',
+ math_libs.ld_flags))
+ else:
+ args.extend([
+ define('BLACS_LINKER_FLAGS', math_libs.ld_flags),
+ define('BLACS_LIBRARIES', math_libs.libraries),
+ define('ScaLAPACK_LINKER_FLAGS', math_libs.ld_flags),
+ define('ScaLAPACK_LIBRARIES', math_libs.libraries)
+ ])
+ if spec.satisfies('^fujitsu-mpi'):
+ args.append(define('USE_FJMPI', True))
+ else:
+ args.append(define('USE_FJMPI', False))
+ if spec.satisfies('%fj'):
+ args.append(self.define('CMAKE_Fortran_MODDIR_FLAG', '-M'))
+ return args
+
+ def flag_handler(self, name, flags):
+ flags = list(flags)
+ if name == 'fflags':
+ if self.spec.satisfies('%gcc'):
+ flags.append('-ffree-line-length-none')
+ return (None, None, flags)
diff --git a/var/spack/repos/builtin/packages/salmon-tddft/v2.0.libxc-5.0.patch b/var/spack/repos/builtin/packages/salmon-tddft/v2.0.libxc-5.0.patch
new file mode 100755
index 0000000000..956eb93da4
--- /dev/null
+++ b/var/spack/repos/builtin/packages/salmon-tddft/v2.0.libxc-5.0.patch
@@ -0,0 +1,312 @@
+diff -ru spack-src.org/src/common/structures.f90 spack-src/src/common/structures.f90
+--- spack-src.org/src/common/structures.f90 2020-07-21 12:08:53.000000000 +0900
++++ spack-src/src/common/structures.f90 2020-12-23 09:15:16.693976332 +0900
+@@ -26,6 +26,8 @@
+ #ifdef USE_LIBXC
+ #if XC_MAJOR_VERSION <= 4
+ use xc_f90_types_m
++#else
++ use iso_c_binding
+ #endif
+ use xc_f90_lib_m
+ #endif
+diff -ru spack-src.org/src/xc/builtin_pbe.f90 spack-src/src/xc/builtin_pbe.f90
+--- spack-src.org/src/xc/builtin_pbe.f90 2020-07-21 12:08:53.000000000 +0900
++++ spack-src/src/xc/builtin_pbe.f90 2020-12-23 09:15:16.701976046 +0900
+@@ -14,17 +14,34 @@
+ ! limitations under the License.
+ !
+ !-----------------------------------------------------------------------------------------
++#include "config.h"
++#ifdef USE_LIBXC
++#include "xc_version.h"
++#endif
+ module builtin_pbe
+ use salmon_math, only: erfc_salmon
++#ifdef USE_LIBXC
++#if XC_MAJOR_VERSION >= 5
++ use iso_c_binding
++#endif
++#endif
+ implicit none
+-
++
+ real(8),parameter :: Pi=3.141592653589793d0
+
+ contains
+
+ subroutine exc_cor_pbe(nl, rho, grho_s, exc, eexc, vexc, nd, ifdx, ifdy, ifdz, nabx, naby, nabz)
+ implicit none
++#ifdef USE_LIBXC
++#if XC_MAJOR_VERSION >= 5
++ integer(c_size_t), intent(in) :: nl
++#else
++ integer, intent(in) :: nl
++#endif
++#else
+ integer, intent(in) :: nl
++#endif
+ real(8), intent(in) :: rho(nl), grho_s(nl, 3)
+ real(8), intent(out) :: exc(nl), eexc(nl), vexc(nl)
+ integer, intent(in) :: nd
+diff -ru spack-src.org/src/xc/builtin_pz.f90 spack-src/src/xc/builtin_pz.f90
+--- spack-src.org/src/xc/builtin_pz.f90 2020-07-21 12:08:53.000000000 +0900
++++ spack-src/src/xc/builtin_pz.f90 2020-12-23 09:15:16.709975759 +0900
+@@ -14,15 +14,28 @@
+ ! limitations under the License.
+ !
+ !-----------------------------------------------------------------------------------------
++#include "config.h"
++#ifdef USE_LIBXC
++#include "xc_version.h"
++#endif
++
+ module builtin_pz
++#if XC_MAJOR_VERSION >= 5
++ use iso_c_binding
++#endif
+ implicit none
++
+
+ contains
+
+
+ subroutine exc_cor_pz(nl, rho_s, exc, eexc, vexc)
+ implicit none
++#if XC_MAJOR_VERSION >= 5
++ integer(c_size_t), intent(in) :: nl
++#else
+ integer, intent(in) :: nl
++#endif
+ real(8), intent(in) :: rho_s(nl)
+ real(8), intent(out) :: exc(nl), eexc(nl), vexc(nl)
+ integer :: i
+diff -ru spack-src.org/src/xc/builtin_pz_sp.f90 spack-src/src/xc/builtin_pz_sp.f90
+--- spack-src.org/src/xc/builtin_pz_sp.f90 2020-07-21 12:08:53.000000000 +0900
++++ spack-src/src/xc/builtin_pz_sp.f90 2020-12-23 09:15:16.717975473 +0900
+@@ -14,7 +14,16 @@
+ ! limitations under the License.
+ !
+ !-----------------------------------------------------------------------------------------
++#include "config.h"
++#ifdef USE_LIBXC
++#include "xc_version.h"
++#endif
+ module builtin_pz_sp
++#ifdef USE_LIBXC
++#if XC_MAJOR_VERSION >= 5
++ use iso_c_binding
++#endif
++#endif
+ implicit none
+
+ contains
+@@ -22,7 +31,15 @@
+
+ subroutine exc_cor_pz_sp(nl, rho_s, exc, eexc, vexc_s)
+ implicit none
++#ifdef USE_LIBXC
++#if XC_MAJOR_VERSION >= 5
++ integer(c_size_t), intent(in) :: nl
++#else
+ integer, intent(in) :: nl
++#endif
++#else
++ integer, intent(in) :: nl
++#endif
+ real(8), intent(in) :: rho_s(nl,2)
+ real(8), intent(out) :: exc(nl), eexc(nl), vexc_s(nl,2)
+ integer :: i
+diff -ru spack-src.org/src/xc/builtin_pzm.f90 spack-src/src/xc/builtin_pzm.f90
+--- spack-src.org/src/xc/builtin_pzm.f90 2020-07-21 12:08:53.000000000 +0900
++++ spack-src/src/xc/builtin_pzm.f90 2020-12-23 09:15:16.722975294 +0900
+@@ -14,14 +14,31 @@
+ ! limitations under the License.
+ !
+ !-----------------------------------------------------------------------------------------
++#include "config.h"
++#ifdef USE_LIBXC
++#include "xc_version.h"
++#endif
+ module builtin_pzm
++#ifdef USE_LIBXC
++#if XC_MAJOR_VERSION >= 5
++ use iso_c_binding
++#endif
++#endif
+ implicit none
+
+ contains
+
+ subroutine exc_cor_pzm(nl, rho_s, exc, eexc, vexc)
+ implicit none
++#ifdef USE_LIBXC
++#if XC_MAJOR_VERSION >= 5
++ integer(c_size_t), intent(in) :: nl
++#else
+ integer, intent(in) :: nl
++#endif
++#else
++ integer, intent(in) :: nl
++#endif
+ real(8), intent(in) :: rho_s(nl)
+ real(8), intent(out) :: exc(nl), eexc(nl), vexc(nl)
+ integer :: i
+diff -ru spack-src.org/src/xc/builtin_tbmbj.f90 spack-src/src/xc/builtin_tbmbj.f90
+--- spack-src.org/src/xc/builtin_tbmbj.f90 2020-07-21 12:08:53.000000000 +0900
++++ spack-src/src/xc/builtin_tbmbj.f90 2020-12-23 09:15:16.725975186 +0900
+@@ -14,7 +14,15 @@
+ ! limitations under the License.
+ !
+ !-----------------------------------------------------------------------------------------
++#include "config.h"
++#ifdef USE_LIBXC
++#include "xc_version.h"
++#endif
++
+ module builtin_tbmbj
++#if XC_MAJOR_VERSION >= 5
++ use iso_c_binding
++#endif
+ use salmon_math, only: erfc_salmon
+ implicit none
+
+@@ -27,7 +35,12 @@
+ subroutine exc_cor_tbmbj(nl, rho, rho_s, grho_s, lrho_s, tau_s, j_s, cval, eexc, vexc)
+ !subroutine exc_cor_tbmbj(nl, rho, rho_s, grho_s, lrho_s, tau_s, j_s, cval, eexc, vexc, Hxyz, aLxyz)
+ implicit none
++
++#if XC_MAJOR_VERSION >= 5
++ integer(c_size_t), intent(in) :: nl
++#else
+ integer, intent(in) :: nl
++#endif
+ real(8), intent(in) :: rho(nl), rho_s(nl)
+ real(8), intent(in) :: grho_s(nl, 3), lrho_s(nl), tau_s(nl), j_s(nl, 3)
+ real(8), intent(in) :: cval
+diff -ru spack-src.org/src/xc/salmon_xc.f90 spack-src/src/xc/salmon_xc.f90
+--- spack-src.org/src/xc/salmon_xc.f90 2020-07-21 12:08:53.000000000 +0900
++++ spack-src/src/xc/salmon_xc.f90 2020-12-23 09:29:58.603384238 +0900
+@@ -32,6 +32,8 @@
+ #ifdef USE_LIBXC
+ #if XC_MAJOR_VERSION <= 4
+ use xc_f90_types_m
++#else
++ use iso_c_binding
+ #endif
+ use xc_f90_lib_m
+ #endif
+@@ -631,7 +633,15 @@
+ ! real(8), intent(in), optional :: aLxyz
+ !===============================================================
+
++#ifdef USE_LIBXC
++#if XC_MAJOR_VERSION <= 4
++ integer :: nx, ny, nz, nl
++#else
++ integer(c_size_t) :: nx, ny, nz, nl
++#endif
++#else
+ integer :: nx, ny, nz, nl
++#endif
+
+ ! Detect size of 3-dimensional grid
+ if (xc%ispin == 0) then
+@@ -699,9 +709,9 @@
+ real(8) :: vexc_sp_1d(nl,2)
+
+ if (xc%ispin == 0) then
+- rho_s_1d = reshape(rho, (/nl/)) * 0.5
++ rho_s_1d = reshape(rho, (/int(nl)/)) * 0.5
+ else if (xc%ispin == 1) then
+- rho_s_sp_1d = reshape(rho_s, (/nl,2/))
++ rho_s_sp_1d = reshape(rho_s, (/int(nl),2/))
+ end if
+
+ #ifndef SALMON_DEBUG_NEGLECT_NLCC
+@@ -723,20 +733,20 @@
+
+ if (xc%ispin == 0) then
+ if (present(vxc)) then
+- vxc = vxc + reshape(vexc_1d, (/nx, ny, nz/))
++ vxc = vxc + reshape(vexc_1d, (/int(nx), int(ny), int(nz)/))
+ endif
+ else if(xc%ispin == 1) then
+ if (present(vxc_s)) then
+- vxc_s = vxc_s + reshape(vexc_sp_1d, (/nx, ny, nz,2/))
++ vxc_s = vxc_s + reshape(vexc_sp_1d, (/int(nx), int(ny), int(nz),2/))
+ endif
+ end if
+
+ if (present(exc)) then
+- exc = exc + reshape(exc_1d, (/nx, ny, nz/))
++ exc = exc + reshape(exc_1d, (/int(nx), int(ny), int(nz)/))
+ endif
+
+ if (present(eexc)) then
+- eexc = eexc + reshape(eexc_1d, (/nx, ny, nz/))
++ eexc = eexc + reshape(eexc_1d, (/int(nx), int(ny), int(nz)/))
+ endif
+
+ return
+@@ -786,22 +796,22 @@
+ real(8) :: eexc_1d(nl)
+ real(8) :: vexc_1d(nl)
+
+- rho_1d = reshape(rho, (/nl/))
+- grho_s_1d = reshape(grho(:, :, :, :), (/nl, 3/)) * 0.5
++ rho_1d = reshape(rho, (/int(nl)/))
++ grho_s_1d = reshape(grho(:, :, :, :), (/int(nl), 3/)) * 0.5
+
+ call exc_cor_pbe(nl, rho_1d, grho_s_1d, exc_1d, eexc_1d, vexc_1d, &
+ & nd, ifdx, ifdy, ifdz, nabx, naby, nabz)
+
+ if (present(vxc)) then
+- vxc = vxc + reshape(vexc_1d, (/nx, ny, nz/))
++ vxc = vxc + reshape(vexc_1d, (/int(nx), int(ny), int(nz)/))
+ endif
+
+ if (present(exc)) then
+- exc = exc + reshape(exc_1d, (/nx, ny, nz/))
++ exc = exc + reshape(exc_1d, (/int(nx), int(ny), int(nz)/))
+ endif
+
+ if (present(eexc)) then
+- eexc = eexc + reshape(eexc_1d, (/nx, ny, nz/))
++ eexc = eexc + reshape(eexc_1d, (/int(nx), int(ny), int(nz)/))
+ endif
+
+ return
+@@ -828,25 +838,25 @@
+ endif
+ #endif
+
+- grho_s_1d = reshape(grho(:, :, :, :), (/nl, 3/)) * 0.5
+- rlrho_s_1d = reshape(rlrho(:, :, :), (/nl/)) * 0.5
+- tau_s_1d = reshape(tau(:, :, :), (/nl/)) * 0.5
+- j_s_1d = reshape(rj(:, :, :, :), (/nl, 3/)) * 0.5
++ grho_s_1d = reshape(grho(:, :, :, :), (/int(nl), 3/)) * 0.5
++ rlrho_s_1d = reshape(rlrho(:, :, :), (/int(nl)/)) * 0.5
++ tau_s_1d = reshape(tau(:, :, :), (/int(nl)/)) * 0.5
++ j_s_1d = reshape(rj(:, :, :, :), (/int(nl), 3/)) * 0.5
+
+ !call exc_cor_tbmbj(nl, rho_1d, rho_s_1d, grho_s_1d, rlrho_s_1d, tau_s_1d, j_s_1d, xc%cval, eexc_1d, vexc_1d, Hxyz, aLxyz)
+ call exc_cor_tbmbj(nl, rho_1d, rho_s_1d, grho_s_1d, rlrho_s_1d, tau_s_1d, j_s_1d, xc%cval, eexc_1d, vexc_1d)
+
+ if (present(vxc)) then
+- vxc = vxc + reshape(vexc_1d, (/nx, ny, nz/))
++ vxc = vxc + reshape(vexc_1d, (/int(nx), int(ny), int(nz)/))
+ endif
+
+ if (present(exc)) then
+ ! NOTE: Take care for "zero-division error"
+- exc = exc + reshape(eexc_1d, (/nx, ny, nz/)) / rho
++ exc = exc + reshape(eexc_1d, (/int(nx), int(ny), int(nz)/)) / rho
+ endif
+
+ if (present(eexc)) then
+- eexc = eexc + reshape(eexc_1d, (/nx, ny, nz/))
++ eexc = eexc + reshape(eexc_1d, (/int(nx), int(ny), int(nz)/))
+ endif
+
+ return