mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 04:35:41 +03:00
openmolcas: 24.10 -> 25.02 (#399186)
This commit is contained in:
commit
d5b441b83f
4 changed files with 131 additions and 62 deletions
22
pkgs/by-name/op/openmolcas/nevpt2.patch
Normal file
22
pkgs/by-name/op/openmolcas/nevpt2.patch
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
diff --git a/src/gctime.c b/src/gctime.c
|
||||||
|
index 34fcb6f..832459c 100644
|
||||||
|
--- a/src/gctime.c
|
||||||
|
+++ b/src/gctime.c
|
||||||
|
@@ -1,14 +1,15 @@
|
||||||
|
+#include <string.h>
|
||||||
|
typedef long f77_int; /* Fortran integer type */
|
||||||
|
typedef char * f77_char; /* Fortran character argument */
|
||||||
|
#define CH_F2C(X) ((char *) (X)) /* How to get char ptr from F77 argument */
|
||||||
|
-gctime (fstr, lstr) f77_char *fstr; int lstr; {
|
||||||
|
+int gctime (fstr, lstr) f77_char *fstr; int lstr; {
|
||||||
|
long time(), t;
|
||||||
|
char *ctime();
|
||||||
|
t = time ( (long *) 0);
|
||||||
|
strcpy(CH_F2C(fstr),ctime(&t));
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
-gctime_(fstr, lstr) f77_char *fstr; int lstr; {
|
||||||
|
+int gctime_(fstr, lstr) f77_char *fstr; int lstr; {
|
||||||
|
long time(), t;
|
||||||
|
char *ctime();
|
||||||
|
t = time ( (long *) 0);
|
|
@ -1,12 +0,0 @@
|
||||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
||||||
index 276ae4e2..db13e6e3 100644
|
|
||||||
--- a/CMakeLists.txt
|
|
||||||
+++ b/CMakeLists.txt
|
|
||||||
@@ -1507,7 +1507,6 @@ if (LINALG STREQUAL "OpenBLAS")
|
|
||||||
NAMES openblas
|
|
||||||
PATHS ${OPENBLASROOT}
|
|
||||||
PATH_SUFFIXES lib
|
|
||||||
- NO_DEFAULT_PATH
|
|
||||||
)
|
|
||||||
|
|
||||||
if (NOT LIBOPENBLAS)
|
|
|
@ -7,6 +7,7 @@
|
||||||
gfortran,
|
gfortran,
|
||||||
perl,
|
perl,
|
||||||
blas-ilp64,
|
blas-ilp64,
|
||||||
|
lapack-ilp64,
|
||||||
hdf5-cpp,
|
hdf5-cpp,
|
||||||
python3,
|
python3,
|
||||||
texliveMinimal,
|
texliveMinimal,
|
||||||
|
@ -16,7 +17,7 @@
|
||||||
gsl,
|
gsl,
|
||||||
boost,
|
boost,
|
||||||
autoPatchelfHook,
|
autoPatchelfHook,
|
||||||
enableQcmaquis ? false,
|
enableQcmaquis ? true,
|
||||||
# Note that the CASPT2 module is broken with MPI
|
# Note that the CASPT2 module is broken with MPI
|
||||||
# See https://gitlab.com/Molcas/OpenMolcas/-/issues/169
|
# See https://gitlab.com/Molcas/OpenMolcas/-/issues/169
|
||||||
enableMpi ? false,
|
enableMpi ? false,
|
||||||
|
@ -25,11 +26,7 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert blas-ilp64.isILP64;
|
assert blas-ilp64.isILP64;
|
||||||
assert lib.elem blas-ilp64.passthru.implementation [
|
assert lapack-ilp64.isILP64;
|
||||||
"openblas"
|
|
||||||
"mkl"
|
|
||||||
];
|
|
||||||
assert enableQcmaquis -> lib.elem blas-ilp64.passthru.implementation "mkl";
|
|
||||||
|
|
||||||
let
|
let
|
||||||
python = python3.withPackages (
|
python = python3.withPackages (
|
||||||
|
@ -46,30 +43,43 @@ let
|
||||||
rev = "release-3.1.4"; # Must match tag in cmake/custom/qcmaquis.cmake
|
rev = "release-3.1.4"; # Must match tag in cmake/custom/qcmaquis.cmake
|
||||||
hash = "sha256-vhC5k+91IPFxdCi5oYt1NtF9W08RxonJjPpA0ls4I+o=";
|
hash = "sha256-vhC5k+91IPFxdCi5oYt1NtF9W08RxonJjPpA0ls4I+o=";
|
||||||
};
|
};
|
||||||
nevtp2Src = fetchFromGitHub {
|
|
||||||
owner = "qcscine";
|
# NEVPT2 sources must be patched to be valid C code in gctime.c
|
||||||
repo = "nevpt2";
|
nevpt2Src = stdenv.mkDerivation {
|
||||||
rev = "e1484fd"; # Must match tag in cmake/custom/nevpt2.cmake
|
pname = "nevpt2-src";
|
||||||
hash = "sha256-Vl+FhwhJBbD/7U2CwsYE9BClSQYLJ8DKXV9EXxQUmz0=";
|
version = "unstable";
|
||||||
|
phases = [
|
||||||
|
"unpackPhase"
|
||||||
|
"patchPhase"
|
||||||
|
"installPhase"
|
||||||
|
];
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "qcscine";
|
||||||
|
repo = "nevpt2";
|
||||||
|
rev = "e1484fd"; # Must match tag in cmake/custom/nevpt2.cmake
|
||||||
|
hash = "sha256-Vl+FhwhJBbD/7U2CwsYE9BClSQYLJ8DKXV9EXxQUmz0=";
|
||||||
|
};
|
||||||
|
patches = [ ./nevpt2.patch ];
|
||||||
|
installPhase = ''
|
||||||
|
mkdir $out
|
||||||
|
cp -r * $out/.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "openmolcas";
|
pname = "openmolcas";
|
||||||
version = "24.10";
|
version = "25.02";
|
||||||
|
|
||||||
src = fetchFromGitLab {
|
src = fetchFromGitLab {
|
||||||
owner = "Molcas";
|
owner = "Molcas";
|
||||||
repo = "OpenMolcas";
|
repo = "OpenMolcas";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
hash = "sha256-LXxr/xqBHG7a0rOBrb8IMZ4IjZak3NsBw40Qf+z1fic=";
|
hash = "sha256-Ty7C7zj1lQixuUzeKLcwQCmcPexZXtIGDzp1wUMKDi0=";
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [
|
patches = [
|
||||||
# Required to handle openblas multiple outputs
|
# Required for a local QCMaquis build. Also sanitises QCMaquis BLAS/LAPACK handling
|
||||||
./openblasPath.patch
|
|
||||||
|
|
||||||
# Required for a local QCMaquis build
|
|
||||||
./qcmaquis.patch
|
./qcmaquis.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -83,7 +93,7 @@ stdenv.mkDerivation rec {
|
||||||
--subst-var-by "qcmaquis_src_url" "file://${qcmaquisSrc}"
|
--subst-var-by "qcmaquis_src_url" "file://${qcmaquisSrc}"
|
||||||
|
|
||||||
substituteInPlace cmake/custom/nevpt2.cmake \
|
substituteInPlace cmake/custom/nevpt2.cmake \
|
||||||
--subst-var-by "nevpt2_src_url" "file://${nevtp2Src}"
|
--subst-var-by "nevpt2_src_url" "file://${nevpt2Src}"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
|
@ -97,13 +107,14 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
buildInputs =
|
buildInputs =
|
||||||
[
|
[
|
||||||
blas-ilp64.passthru.provider
|
|
||||||
hdf5-cpp
|
hdf5-cpp
|
||||||
python
|
python
|
||||||
armadillo
|
armadillo
|
||||||
libxc
|
libxc
|
||||||
gsl.dev
|
gsl.dev
|
||||||
boost
|
boost
|
||||||
|
blas-ilp64
|
||||||
|
lapack-ilp64
|
||||||
]
|
]
|
||||||
++ lib.optionals enableMpi [
|
++ lib.optionals enableMpi [
|
||||||
mpi
|
mpi
|
||||||
|
@ -112,38 +123,31 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
passthru = lib.optionalAttrs enableMpi { inherit mpi; };
|
passthru = lib.optionalAttrs enableMpi { inherit mpi; };
|
||||||
|
|
||||||
cmakeFlags =
|
preConfigure =
|
||||||
[
|
''
|
||||||
"-DOPENMP=ON"
|
cmakeFlagsArray+=(
|
||||||
"-DTOOLS=ON"
|
"-DOPENMP=ON"
|
||||||
"-DHDF5=ON"
|
"-DTOOLS=ON"
|
||||||
"-DFDE=ON"
|
"-DHDF5=ON"
|
||||||
"-DEXTERNAL_LIBXC=${lib.getDev libxc}"
|
"-DFDE=ON"
|
||||||
(lib.strings.cmakeBool "DMRG" enableQcmaquis)
|
"-DEXTERNAL_LIBXC=${lib.getDev libxc}"
|
||||||
(lib.strings.cmakeBool "NEVPT2" enableQcmaquis)
|
${lib.strings.cmakeBool "DMRG" enableQcmaquis}
|
||||||
"-DCMAKE_SKIP_BUILD_RPATH=ON"
|
${lib.strings.cmakeBool "NEVPT2" enableQcmaquis}
|
||||||
(lib.strings.cmakeBool "BUILD_STATIC_LIBS" stdenv.hostPlatform.isStatic)
|
"-DCMAKE_SKIP_BUILD_RPATH=ON"
|
||||||
(lib.strings.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
|
${lib.strings.cmakeBool "BUILD_STATIC_LIBS" stdenv.hostPlatform.isStatic}
|
||||||
]
|
${lib.strings.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic)}
|
||||||
++ lib.optionals (blas-ilp64.passthru.implementation == "openblas") [
|
"-DLINALG=Manual"
|
||||||
"-DOPENBLASROOT=${blas-ilp64.passthru.provider.dev}"
|
"-DLINALG_LIBRARIES=-lblas -llapack"
|
||||||
"-DLINALG=OpenBLAS"
|
${lib.strings.cmakeBool "DGA" enableMpi}
|
||||||
]
|
${lib.strings.cmakeBool "MPI" enableMpi}
|
||||||
++ lib.optionals (blas-ilp64.passthru.implementation == "mkl") [
|
)
|
||||||
"-DMKLROOT=${blas-ilp64.passthru.provider}"
|
''
|
||||||
"-DLINALG=MKL"
|
+ lib.optionalString enableMpi ''
|
||||||
]
|
export GAROOT=${globalarrays};
|
||||||
++ lib.optionals enableMpi [
|
'';
|
||||||
"-DGA=ON"
|
|
||||||
"-DMPI=ON"
|
|
||||||
];
|
|
||||||
|
|
||||||
preConfigure = lib.optionalString enableMpi ''
|
|
||||||
export GAROOT=${globalarrays};
|
|
||||||
'';
|
|
||||||
|
|
||||||
|
# The Makefile will install pymolcas during the build grrr.
|
||||||
postConfigure = ''
|
postConfigure = ''
|
||||||
# The Makefile will install pymolcas during the build grrr.
|
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
export PATH=$PATH:$out/bin
|
export PATH=$PATH:$out/bin
|
||||||
'';
|
'';
|
||||||
|
@ -158,8 +162,8 @@ stdenv.mkDerivation rec {
|
||||||
# removed by autopatchelf
|
# removed by autopatchelf
|
||||||
noAuditTmpdir = true;
|
noAuditTmpdir = true;
|
||||||
|
|
||||||
|
# Wrong store path in shebang (bare Python, no Python pkgs), force manual re-patching
|
||||||
postFixup = ''
|
postFixup = ''
|
||||||
# Wrong store path in shebang (bare Python, no Python pkgs), force manual re-patching
|
|
||||||
for exe in $(find $out/bin/ -type f -name "*.py"); do
|
for exe in $(find $out/bin/ -type f -name "*.py"); do
|
||||||
sed -i "1s:.*:#!${python}/bin/python:" "$exe"
|
sed -i "1s:.*:#!${python}/bin/python:" "$exe"
|
||||||
done
|
done
|
||||||
|
|
|
@ -45,3 +45,58 @@ index 5fd1ef207..8d2957c6e 100644
|
||||||
SOURCE_SUBDIR dmrg
|
SOURCE_SUBDIR dmrg
|
||||||
CMAKE_ARGS ${EP_CMAKE_ARGS}
|
CMAKE_ARGS ${EP_CMAKE_ARGS}
|
||||||
CMAKE_CACHE_ARGS ${EP_CMAKE_CACHE_ARGS}
|
CMAKE_CACHE_ARGS ${EP_CMAKE_CACHE_ARGS}
|
||||||
|
diff --git a/cmake/custom/qcmaquis.cmake b/cmake/custom/qcmaquis.cmake
|
||||||
|
index 5fd1ef207..4291ec3d7 100644
|
||||||
|
--- a/cmake/custom/qcmaquis.cmake
|
||||||
|
+++ b/cmake/custom/qcmaquis.cmake
|
||||||
|
@@ -94,47 +94,9 @@ if (NOT MAQUIS_DMRG_FOUND) # Does the opposite work?
|
||||||
|
)
|
||||||
|
endif (BOOST_ROOT)
|
||||||
|
|
||||||
|
- if (LINALG STREQUAL "Manual")
|
||||||
|
- target_files (LINALG_LIBRARIES_FILES ${LINALG_LIBRARIES})
|
||||||
|
- list (APPEND LINALG_LIBRARIES_FILES ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
|
||||||
|
- string (REPLACE ";" '\' LINALG_LIBRARIES_FILES "${LINALG_LIBRARIES_FILES}")
|
||||||
|
- list (APPEND QCMaquisCMakeArgs
|
||||||
|
- "-DBLAS_LAPACK_SELECTOR=manual"
|
||||||
|
- "-DMAQUISLapack_LIBRARIES=${LINALG_LIBRARIES_FILES}"
|
||||||
|
- )
|
||||||
|
- elseif (LINALG STREQUAL "MKL")
|
||||||
|
- list (APPEND QCMaquisCMakeArgs
|
||||||
|
- "-DBLAS_LAPACK_SELECTOR=mkl_sequential"
|
||||||
|
- )
|
||||||
|
- elseif (LINALG STREQUAL "OpenBLAS")
|
||||||
|
- list (APPEND QCMaquisCMakeArgs
|
||||||
|
- "-DBLAS_LAPACK_SELECTOR=openblas"
|
||||||
|
- "-DOPENBLASROOT=${OPENBLASROOT}"
|
||||||
|
- )
|
||||||
|
- elseif (LINALG STREQUAL "Accelerate")
|
||||||
|
- list (APPEND QCMaquisCMakeArgs
|
||||||
|
- "-DBLAS_LAPACK_SELECTOR:STRING=veclib"
|
||||||
|
- )
|
||||||
|
- elseif (LINALG STREQUAL "Internal")
|
||||||
|
-
|
||||||
|
- # To link QCMaquis with Fortran static libraries, we
|
||||||
|
- # need to add -lgfortran for gfortran
|
||||||
|
- # It seems that ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}
|
||||||
|
- # is not suited for this because it contains also other unnecessary libraries
|
||||||
|
-
|
||||||
|
- # for some reason, the list does not work if the generator expression -lgfortran is not first
|
||||||
|
- # but for correct linking it needs to be last AND with a prepended "-l"
|
||||||
|
- if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
|
||||||
|
- set (Fortran_RUNTIME_LIBRARY "gfortran")
|
||||||
|
- endif ()
|
||||||
|
-
|
||||||
|
- list (APPEND QCMaquisCMakeArgs
|
||||||
|
- "-DBLAS_LAPACK_SELECTOR=manual"
|
||||||
|
- "-DMAQUISLapack_LIBRARIES=$<$<BOOL:Fortran_RUNTIME_LIBRARY>:${Fortran_RUNTIME_LIBRARY}\ >$<TARGET_FILE:blas>\ $<TARGET_FILE:lapack>\ $<TARGET_FILE:blas>\ -l$<$<BOOL:Fortran_RUNTIME_LIBRARY>:${Fortran_RUNTIME_LIBRARY}>"
|
||||||
|
- )
|
||||||
|
- else ()
|
||||||
|
- message (FATAL_ERROR "LINALG=${LINALG} is not supported by QCMaquis")
|
||||||
|
- endif ()
|
||||||
|
+ list (APPEND QCMaquisCMakeArgs
|
||||||
|
+ "-DBLAS_LAPACK_SELECTOR=auto"
|
||||||
|
+ )
|
||||||
|
|
||||||
|
# Enabling source changes to keep ExternalProject happy
|
||||||
|
set (CMAKE_DISABLE_SOURCE_CHANGES OFF
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue