2023-08-04 22:07:22 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitLab
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, gfortran
|
|
|
|
, perl
|
|
|
|
, blas-ilp64
|
|
|
|
, hdf5-cpp
|
|
|
|
, python3
|
2023-11-16 04:20:00 +00:00
|
|
|
, texliveMinimal
|
2023-08-04 22:07:22 +00:00
|
|
|
, armadillo
|
|
|
|
, libxc
|
|
|
|
, makeWrapper
|
|
|
|
, gsl
|
2024-02-29 20:09:43 +00:00
|
|
|
, boost180
|
2023-08-04 22:07:22 +00:00
|
|
|
, autoPatchelfHook
|
|
|
|
# Note that the CASPT2 module is broken with MPI
|
|
|
|
# See https://gitlab.com/Molcas/OpenMolcas/-/issues/169
|
2022-05-18 14:49:53 +00:00
|
|
|
, enableMpi ? false
|
2023-08-04 22:07:22 +00:00
|
|
|
, mpi
|
|
|
|
, globalarrays
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
assert blas-ilp64.isILP64;
|
|
|
|
assert lib.elem blas-ilp64.passthru.implementation [ "openblas" "mkl" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
let
|
2023-08-04 22:07:22 +00:00
|
|
|
python = python3.withPackages (ps: with ps; [ six pyparsing numpy h5py ]);
|
|
|
|
qcmaquisSrc = fetchFromGitHub {
|
|
|
|
owner = "qcscine";
|
|
|
|
repo = "qcmaquis";
|
|
|
|
rev = "release-3.1.1"; # Must match tag in cmake/custom/qcmaquis.cmake
|
|
|
|
hash = "sha256-diLDWj/Om6EHrVp+Hd24jsN6R9vV2vRl0y9gqyRWhkI=";
|
|
|
|
};
|
|
|
|
nevtp2Src = fetchFromGitHub {
|
|
|
|
owner = "qcscine";
|
|
|
|
repo = "nevpt2";
|
|
|
|
rev = "e1484fd"; # Must match tag in cmake/custom/nevpt2.cmake
|
|
|
|
hash = "sha256-Vl+FhwhJBbD/7U2CwsYE9BClSQYLJ8DKXV9EXxQUmz0=";
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
in
|
2024-02-29 20:09:43 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "openmolcas";
|
2024-02-29 20:09:43 +00:00
|
|
|
version = "24.02";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
owner = "Molcas";
|
|
|
|
repo = "OpenMolcas";
|
2024-02-29 20:09:43 +00:00
|
|
|
rev = "v${version}";
|
|
|
|
hash = "sha256-4Ek0cnaRfLEbj1Nj31rRp9b2sois4rIFTcpOUq9h2mw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-10-19 09:53:12 +00:00
|
|
|
patches = [
|
|
|
|
# Required to handle openblas multiple outputs
|
|
|
|
./openblasPath.patch
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
# Required for a local QCMaquis build
|
|
|
|
./qcmaquis.patch
|
2021-05-20 23:08:51 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
postPatch = ''
|
|
|
|
# Using env fails in the sandbox
|
|
|
|
substituteInPlace Tools/pymolcas/export.py --replace \
|
|
|
|
"/usr/bin/env','python3" "python3"
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
# Pointing CMake to local QCMaquis and NEVPT2 archives
|
|
|
|
substituteInPlace cmake/custom/qcmaquis.cmake \
|
|
|
|
--subst-var-by "qcmaquis_src_url" "file://${qcmaquisSrc}"
|
|
|
|
|
|
|
|
substituteInPlace cmake/custom/nevpt2.cmake \
|
|
|
|
--subst-var-by "nevpt2_src_url" "file://${nevtp2Src}"
|
2022-06-26 10:26:21 +00:00
|
|
|
'';
|
|
|
|
|
2021-09-26 12:46:18 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
perl
|
2020-04-24 23:36:52 +00:00
|
|
|
gfortran
|
2021-09-26 12:46:18 +00:00
|
|
|
cmake
|
2023-11-16 04:20:00 +00:00
|
|
|
texliveMinimal
|
2021-09-26 12:46:18 +00:00
|
|
|
makeWrapper
|
2023-08-04 22:07:22 +00:00
|
|
|
autoPatchelfHook
|
2021-09-26 12:46:18 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2022-05-18 14:49:53 +00:00
|
|
|
blas-ilp64.passthru.provider
|
2020-04-24 23:36:52 +00:00
|
|
|
hdf5-cpp
|
|
|
|
python
|
|
|
|
armadillo
|
2022-05-18 14:49:53 +00:00
|
|
|
libxc
|
2023-08-04 22:07:22 +00:00
|
|
|
gsl.dev
|
2024-02-29 20:09:43 +00:00
|
|
|
boost180
|
2022-05-18 14:49:53 +00:00
|
|
|
] ++ lib.optionals enableMpi [
|
2021-02-05 17:12:51 +00:00
|
|
|
mpi
|
2020-04-24 23:36:52 +00:00
|
|
|
globalarrays
|
|
|
|
];
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
passthru = lib.optionalAttrs enableMpi { inherit mpi; };
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DOPENMP=ON"
|
|
|
|
"-DLINALG=OpenBLAS"
|
|
|
|
"-DTOOLS=ON"
|
|
|
|
"-DHDF5=ON"
|
|
|
|
"-DFDE=ON"
|
2023-10-09 19:29:22 +00:00
|
|
|
"-DEXTERNAL_LIBXC=${lib.getDev libxc}"
|
2023-08-04 22:07:22 +00:00
|
|
|
"-DDMRG=ON"
|
|
|
|
"-DNEVPT2=ON"
|
|
|
|
"-DCMAKE_SKIP_BUILD_RPATH=ON"
|
2022-05-18 14:49:53 +00:00
|
|
|
] ++ lib.optionals (blas-ilp64.passthru.implementation == "openblas") [
|
2023-08-04 22:07:22 +00:00
|
|
|
"-DOPENBLASROOT=${blas-ilp64.passthru.provider.dev}"
|
|
|
|
"-DLINALG=OpenBLAS"
|
2022-05-18 14:49:53 +00:00
|
|
|
] ++ lib.optionals (blas-ilp64.passthru.implementation == "mkl") [
|
2023-08-04 22:07:22 +00:00
|
|
|
"-DMKLROOT=${blas-ilp64.passthru.provider}"
|
|
|
|
"-DLINALG=MKL"
|
2022-05-18 14:49:53 +00:00
|
|
|
] ++ lib.optionals enableMpi [
|
|
|
|
"-DGA=ON"
|
|
|
|
"-DMPI=ON"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
preConfigure = lib.optionalString enableMpi ''
|
2021-12-06 16:07:01 +00:00
|
|
|
export GAROOT=${globalarrays};
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postConfigure = ''
|
|
|
|
# The Makefile will install pymolcas during the build grrr.
|
|
|
|
mkdir -p $out/bin
|
|
|
|
export PATH=$PATH:$out/bin
|
|
|
|
'';
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
postInstall = ''
|
|
|
|
mv $out/pymolcas $out/bin
|
2022-05-18 14:49:53 +00:00
|
|
|
find $out/Tools -type f -exec mv \{} $out/bin \;
|
|
|
|
rm -r $out/Tools
|
2021-05-20 23:08:51 +00:00
|
|
|
'';
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
# DMRG executables contain references to /build, however, they are properly
|
|
|
|
# removed by autopatchelf
|
|
|
|
noAuditTmpdir = true;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postFixup = ''
|
|
|
|
# Wrong store path in shebang (no Python pkgs), force re-patching
|
|
|
|
sed -i "1s:/.*:/usr/bin/env python:" $out/bin/pymolcas
|
|
|
|
patchShebangs $out/bin
|
|
|
|
|
|
|
|
wrapProgram $out/bin/pymolcas --set MOLCAS $out
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Advanced quantum chemistry software package";
|
|
|
|
homepage = "https://gitlab.com/Molcas/OpenMolcas";
|
|
|
|
maintainers = [ maintainers.markuskowa ];
|
2023-08-04 22:07:22 +00:00
|
|
|
license = with licenses; [ lgpl21Only bsd3 ];
|
2024-02-29 20:09:43 +00:00
|
|
|
platforms = [ "aarch64-linux" "x86_64-linux" ];
|
2022-05-18 14:49:53 +00:00
|
|
|
mainProgram = "pymolcas";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|