From a152ec7cfa590af08540f34564896a4054afe899 Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Mon, 16 May 2022 11:10:43 +0200 Subject: [PATCH 1/2] update flake.lock --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 3f1e19c7..6453ab84 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1652252629, - "narHash": "sha256-SvT64apetqc8P5nYp1/fOZvUmHUPdPFUZbhSpKy+1aI=", + "lastModified": 1652632955, + "narHash": "sha256-cSxiAaS8ozw63rLJHdN6RPwhA4lY2XeC/J+uggodYXw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d2fc6856824cb87742177eefc8dd534bdb6c3439", + "rev": "34e4df55664c24df350f59adba8c7a042dece61e", "type": "github" }, "original": { From 4b0f81645116cae6ae4c575d9dd42c0e7a254944 Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Mon, 16 May 2022 11:12:20 +0200 Subject: [PATCH 2/2] molcas: remove in favour of upstream version, add overrides --- overlay.nix | 21 +++- pkgs/apps/openmolcas/MKL-MPICH.patch | 24 ----- pkgs/apps/openmolcas/default.nix | 154 --------------------------- 3 files changed, 17 insertions(+), 182 deletions(-) delete mode 100644 pkgs/apps/openmolcas/MKL-MPICH.patch delete mode 100644 pkgs/apps/openmolcas/default.nix diff --git a/overlay.nix b/overlay.nix index b115bb50..b2c5113f 100644 --- a/overlay.nix +++ b/overlay.nix @@ -173,10 +173,23 @@ let gfortran = final.gfortran9; }; - molcas = callPackage ./pkgs/apps/openmolcas/default.nix { - stdenv = aggressiveStdenv; - blas = final.blas-ilp64; - }; + molcas = let + molcasOpt = prev.openmolcas.override { + stdenv = aggressiveStdenv; + hdf5-cpp = self.hdf5-full; + }; + in molcasOpt.overrideAttrs (oldAttrs: { + buildInputs = oldAttrs.buildInputs ++ [ self.chemps2 ]; + cmakeFlags = oldAttrs.cmakeFlags ++ [ + "-DWFA=ON" + "-DCHEMPS2=ON" "-DCHEMPS2_DIR=${self.chemps2}/bin" + ]; + prePatch = '' + rm -r External/libwfa + cp -r ${self.libwfa.src} External/libwfa + chmod -R u+w External/ + ''; + }); moltemplate = super.python3.pkgs.toPythonApplication self.python3.pkgs.moltemplate; diff --git a/pkgs/apps/openmolcas/MKL-MPICH.patch b/pkgs/apps/openmolcas/MKL-MPICH.patch deleted file mode 100644 index c1bc211a..00000000 --- a/pkgs/apps/openmolcas/MKL-MPICH.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 276ae4e..5e56176 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1304,9 +1304,9 @@ if (LINALG STREQUAL "MKL") - endif () - else () - if (ADDRMODE EQUAL 64) -- set (libpath "${MKLROOT}/lib/intel64") -+ set (libpath "${MKLROOT}/lib") - elseif (ADDRMODE EQUAL 32) -- set (libpath "${MKLROOT}/lib/ia32") -+ set (libpath "${MKLROOT}/lib") - endif () - endif () - set (MKL_LIBRARY_PATH ${libpath} CACHE PATH "location of MKL libraries." FORCE) -@@ -1380,7 +1380,7 @@ if (LINALG STREQUAL "MKL") - find_library (LIBMKL_BLACS NAMES "mkl_blacs_intelmpi_ilp64" - PATHS ${MKL_LIBRARY_PATH} NO_DEFAULT_PATH) - elseif (MPI_IMPLEMENTATION STREQUAL "mpich") -- find_library (LIBMKL_BLACS NAMES "mkl_blacs_ilp64" -+ find_library (LIBMKL_BLACS NAMES "mkl_blacs_intelmpi_ilp64" - PATHS ${MKL_LIBRARY_PATH} NO_DEFAULT_PATH) - endif () diff --git a/pkgs/apps/openmolcas/default.nix b/pkgs/apps/openmolcas/default.nix deleted file mode 100644 index fdfdf78a..00000000 --- a/pkgs/apps/openmolcas/default.nix +++ /dev/null @@ -1,154 +0,0 @@ -{ lib, stdenv, pkgs, fetchFromGitLab, fetchpatch, cmake, gfortran, perl -, blas, hdf5-full, python3, texlive -, armadillo, makeWrapper, fetchFromGitHub, chemps2, libwfa, libxc -} : - -assert - lib.asserts.assertMsg - (blas.isILP64 || blas.passthru.implementation == "mkl") - "A 64 bit integer BLAS implementation is required."; - -assert - lib.asserts.assertMsg - (builtins.elem blas.passthru.implementation [ "openblas" "mkl" ]) - "OpenMolcas requires OpenBLAS or MKL."; - -let - version = "22.02-2022-02-10"; - gitLabRev = "f8df69cf87b241a15ebc82d72a8f9a031a385dd4"; - - python = python3.withPackages (ps : with ps; [ six pyparsing ]); - -in stdenv.mkDerivation { - pname = "openmolcas"; - inherit version; - - src = fetchFromGitLab { - owner = "Molcas"; - repo = "OpenMolcas"; - rev = gitLabRev; - sha256 = "0p2xj8kgqdk5kb1jv5k77acbiqkbl2sh971jnz9p00cmbh556r6a"; - }; - - patches = [ (fetchpatch { - name = "openblas-multiple-output"; # upstream patch - url = "https://raw.githubusercontent.com/NixOS/nixpkgs/2eee4e4eac851a2846515dcfa3274c4ab92ecbe5/pkgs/applications/science/chemistry/openmolcas/openblasPath.patch"; - sha256 = "0l6z5zhfbfpbp9x58228nhhwwp1fzmi8cmmasvzddp84h31f0b8h"; - }) - ./MKL-MPICH.patch - ]; - - prePatch = '' - rm -r External/libwfa - cp -r ${libwfa.src} External/libwfa - chmod -R u+w External/ - ''; - - nativeBuildInputs = [ - perl - gfortran - cmake - texlive.combined.scheme-minimal - makeWrapper - ]; - - buildInputs = [ - blas.passthru.provider - hdf5-full - python - armadillo - chemps2 - libxc - ]; - - # tests are not running right now. - doCheck = false; - - doInstallCheck = true; - - enableParallelBuilding = true; - - NIX_CFLAGS_COMPILE = "-DH5_USE_110_API"; - - cmakeFlags = [ - "-DOPENMP=ON" - "-DTOOLS=ON" - "-DHDF5=ON" - "-DFDE=ON" - "-DWFA=ON" - "-DCTEST=ON" - "-DCHEMPS2=ON" "-DCHEMPS2_DIR=${chemps2}/bin" - "-DEXTERNAL_LIBXC=${libxc}" - ] ++ lib.lists.optionals (blas.passthru.implementation == "openblas") [ - "-DOPENBLASROOT=${blas.passthru.provider.dev}" "-DLINALG=OpenBLAS" - ] ++ lib.lists.optionals (blas.passthru.implementation == "mkl") [ - "-DMKLROOT=${blas.passthru.provider}" "-DLINALG=MKL" - ]; - - postConfigure = '' - # The Makefile will install pymolcas during the build grrr. - mkdir -p $out/bin - export PATH=$PATH:$out/bin - ''; - - 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 \ - --prefix PATH : "${chemps2}/bin" - ''; - - postInstall = '' - mv $out/pymolcas $out/bin - ''; - - installCheckPhase = '' - # - # Minimal check if installation runs properly - # - - export OMPI_MCA_rmaps_base_oversubscribe=1 - - export MOLCAS_WORKDIR=./ - inp=water - - cat << EOF > $inp.xyz - 3 - Angstrom - O 0.000000 0.000000 0.000000 - H 0.758602 0.000000 0.504284 - H 0.758602 0.000000 -0.504284 - EOF - - cat << EOF > $inp.inp - &GATEWAY - coord=water.xyz - basis=sto-3g - &SEWARD - &SCF - EOF - - $out/bin/pymolcas $inp.inp > $inp.out - - echo "Check for successful run:" - grep "Happy landing" $inp.status - echo "Check for correct energy:" - grep "Total SCF energy" $inp.out | grep 74.880174 - ''; - - checkPhase = '' - make test - ''; - - meta = with lib; { - description = "Quantum chemistry software package"; - homepage = "https://gitlab.com/Molcas/OpenMolcas"; - maintainers = [ maintainers.markuskowa ]; - license = licenses.lgpl21; - platforms = platforms.linux; - mainProgram = "pymolcas"; - }; -}