2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitLab, cmake, gfortran, perl
|
2022-05-18 14:49:53 +00:00
|
|
|
, blas-ilp64, hdf5-cpp, python3, texlive
|
|
|
|
, armadillo, libxc, makeWrapper
|
|
|
|
# Note that the CASPT2 module is broken with MPI
|
|
|
|
# See https://gitlab.com/Molcas/OpenMolcas/-/issues/169
|
|
|
|
, enableMpi ? false
|
|
|
|
, 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
|
|
|
|
python = python3.withPackages (ps : with ps; [ six pyparsing numpy h5py ]);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
in stdenv.mkDerivation {
|
|
|
|
pname = "openmolcas";
|
2022-05-18 14:49:53 +00:00
|
|
|
version = "22.02";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
owner = "Molcas";
|
|
|
|
repo = "OpenMolcas";
|
2022-05-18 14:49:53 +00:00
|
|
|
# The tag keeps moving, fix a hash instead
|
|
|
|
rev = "f8df69cf87b241a15ebc82d72a8f9a031a385dd4"; # 2022-02-10
|
|
|
|
sha256 = "0p2xj8kgqdk5kb1jv5k77acbiqkbl2sh971jnz9p00cmbh556r6a";
|
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
|
2022-05-18 14:49:53 +00:00
|
|
|
# Required for MKL builds
|
|
|
|
./MKL-MPICH.patch
|
2021-05-20 23:08:51 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +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
|
|
|
|
texlive.combined.scheme-minimal
|
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
|
|
|
|
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
|
|
|
|
] ++ 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"
|
2022-05-18 14:49:53 +00:00
|
|
|
"-DEXTERNAL_LIBXC=${libxc}"
|
|
|
|
] ++ lib.optionals (blas-ilp64.passthru.implementation == "openblas") [
|
|
|
|
"-DOPENBLASROOT=${blas-ilp64.passthru.provider.dev}" "-DLINALG=OpenBLAS"
|
|
|
|
] ++ lib.optionals (blas-ilp64.passthru.implementation == "mkl") [
|
|
|
|
"-DMKLROOT=${blas-ilp64.passthru.provider}" "-DLINALG=MKL"
|
|
|
|
] ++ 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
|
|
|
'';
|
|
|
|
|
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 ];
|
2021-02-05 17:12:51 +00:00
|
|
|
license = licenses.lgpl21Only;
|
2020-12-27 14:24:52 +00:00
|
|
|
platforms = [ "x86_64-linux" ];
|
2022-05-18 14:49:53 +00:00
|
|
|
mainProgram = "pymolcas";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|