diff options
author | Phillip Seeber <phillip.seeber@uni-jena.de> | 2023-12-04 17:06:21 +0100 |
---|---|---|
committer | Phillip Seeber <phillip.seeber@uni-jena.de> | 2023-12-04 17:08:07 +0100 |
commit | 50fc2bfb8bbb28356d39f891eec31ea1a31db633 (patch) | |
tree | 446aa848f91cca7921cf4eaf8fa41ba274914238 /pkgs/applications/science/chemistry | |
parent | 36fbaa0de4ba40984daae894f1ab3ce5d8c9f76e (diff) |
quantum-espresso: 6.6 -> 7.2
Diffstat (limited to 'pkgs/applications/science/chemistry')
-rw-r--r-- | pkgs/applications/science/chemistry/quantum-espresso/default.nix | 104 |
1 files changed, 91 insertions, 13 deletions
diff --git a/pkgs/applications/science/chemistry/quantum-espresso/default.nix b/pkgs/applications/science/chemistry/quantum-espresso/default.nix index 9933d0d8c727f..4c44829197724 100644 --- a/pkgs/applications/science/chemistry/quantum-espresso/default.nix +++ b/pkgs/applications/science/chemistry/quantum-espresso/default.nix @@ -1,41 +1,119 @@ { lib , stdenv , fetchFromGitLab +, fetchFromGitHub +, fetchurl +, git +, cmake +, gnum4 , gfortran +, pkg-config , fftw , blas , lapack -, useMpi ? false +, scalapack +, wannier90 +, hdf5 +, libmbd +, libxc +, enableMpi ? true , mpi }: +assert ! blas.isILP64; +assert ! lapack.isILP64; + +let + # "rev"s must exactly match the git submodule commits in the QE repo + gitSubmodules = { + devxlib = fetchFromGitLab { + group = "max-centre"; + owner = "components"; + repo = "devicexlib"; + rev = "a6b89ef77b1ceda48e967921f1f5488d2df9226d"; + hash = "sha256-p3fRplVG4YSN6ILNlOwf+aSEhpTJPXqiS1+wnzWVA2U="; + }; + + pw2qmcpack = fetchFromGitHub { + owner = "QMCPACK"; + repo = "pw2qmcpack"; + rev = "f72ab25fa4ea755c1b4b230ae8074b47d5509c70"; + hash = "sha256-K1Z90xexsUvk4SdEb8FGryRal0GAFoLz3j1h/RT2nYw="; + }; + }; + +in stdenv.mkDerivation rec { - version = "6.6"; + version = "7.2"; pname = "quantum-espresso"; src = fetchFromGitLab { owner = "QEF"; repo = "q-e"; rev = "qe-${version}"; - sha256 = "1mkfmw0fq1dabplzdn6v1abhw0ds55gzlvbx3a9brv493whk21yp"; + hash = "sha256-0q0QWX4BVjVHjcbKOBpjbBADuL+2S5LAALyrxmjVs4c="; }; - passthru = { - inherit mpi; - }; + # add git submodules manually and fix pkg-config file + prePatch = '' + chmod -R +rwx external/ + + substituteInPlace external/devxlib.cmake \ + --replace "qe_git_submodule_update(external/devxlib)" "" + substituteInPlace external/CMakeLists.txt \ + --replace "qe_git_submodule_update(external/pw2qmcpack)" "" \ + --replace "qe_git_submodule_update(external/d3q)" "" \ + --replace "qe_git_submodule_update(external/qe-gipaw)" "" - preConfigure = '' - patchShebangs configure + ${builtins.toString (builtins.attrValues + (builtins.mapAttrs + (name: val: '' + cp -r ${val}/* external/${name}/. + chmod -R +rwx external/${name} + '') + gitSubmodules + ) + )} + + substituteInPlace cmake/quantum_espresso.pc.in \ + --replace 'libdir="''${prefix}/@CMAKE_INSTALL_LIBDIR@"' 'libdir="@CMAKE_INSTALL_FULL_LIBDIR@"' ''; - nativeBuildInputs = [ gfortran ]; + passthru = { inherit mpi; }; + + nativeBuildInputs = [ + cmake + gfortran + git + pkg-config + ]; - buildInputs = [ fftw blas lapack ] - ++ (lib.optionals useMpi [ mpi ]); + buildInputs = [ + fftw + blas + lapack + wannier90 + libmbd + libxc + hdf5 + ] ++ lib.optional enableMpi scalapack; - configureFlags = if useMpi then [ "LD=${mpi}/bin/mpif90" ] else [ "LD=${gfortran}/bin/gfortran" ]; + propagatedBuildInputs = lib.optional enableMpi mpi; + propagatedUserEnvPkgs = lib.optional enableMpi mpi; - makeFlags = [ "all" ]; + cmakeFlags = [ + "-DBUILD_SHARED_LIBS=ON" + "-DWANNIER90_ROOT=${wannier90}" + "-DMBD_ROOT=${libmbd}" + "-DQE_ENABLE_OPENMP=ON" + "-DQE_ENABLE_LIBXC=ON" + "-DQE_ENABLE_HDF5=ON" + "-DQE_ENABLE_PLUGINS=pw2qmcpack" + ] ++ lib.optionals enableMpi [ + "-DQE_ENABLE_MPI=ON" + "-DQE_ENABLE_MPI_MODULE=ON" + "-DQE_ENABLE_SCALAPACK=ON" + ]; meta = with lib; { description = "Electronic-structure calculations and materials modeling at the nanoscale"; |