From 794bec4609bf82743ad30b8b848dd15b28e2b2a1 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Tue, 17 Sep 2024 15:47:35 +0300 Subject: [PATCH 1/4] python312Packages.lammps: disable tests if GPU package is enabled --- pkgs/development/python-modules/lammps/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/development/python-modules/lammps/default.nix b/pkgs/development/python-modules/lammps/default.nix index b9e0f45402d0..1267792855b0 100644 --- a/pkgs/development/python-modules/lammps/default.nix +++ b/pkgs/development/python-modules/lammps/default.nix @@ -12,8 +12,11 @@ buildPythonPackage { inherit (lammps) pname version src; env = { + # Needed for tests inherit LAMMPS_SHARED_LIB; }; + # Don't perform checks if GPU is enabled - because libcuda.so cannot be opened in the sandbox + doCheck = if lammps.passthru.packages ? GPU then !lammps.passthru.packages.GPU else true; preConfigure = '' cd python # Upstream assumes that the shared library is located in the same directory From b9d665c1fcdff407ee5ae59b4de8c9dda89ec50b Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Tue, 17 Sep 2024 16:08:11 +0300 Subject: [PATCH 2/4] lammps: use PYTHON package by default Makes this warning by PyLammps go away: > WARNING: run thermo data not captured since PYTHON LAMMPS package is not enabled --- .../science/molecular-dynamics/lammps/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/science/molecular-dynamics/lammps/default.nix b/pkgs/applications/science/molecular-dynamics/lammps/default.nix index 40529487b655..bd88387a1ce8 100644 --- a/pkgs/applications/science/molecular-dynamics/lammps/default.nix +++ b/pkgs/applications/science/molecular-dynamics/lammps/default.nix @@ -6,6 +6,7 @@ , fftw , blas , lapack +, python3 , cmake , autoAddDriverRunpath , pkg-config @@ -36,6 +37,7 @@ ML-SNAP = true; SRD = true; REAXFF = true; + PYTHON = true; } # Extra cmakeFlags to add as "-D${attr}=${value}" , extraCmakeFlags ? {} @@ -87,7 +89,7 @@ stdenv.mkDerivation (finalAttrs: { blas lapack gzip - ] ++ extraBuildInputs + ] ++ lib.optionals packages.PYTHON [ python3 ] ++ extraBuildInputs ; postInstall = '' From 6ccf3b79a39a4f6fca8cd4a2de8d1fa7915c2aea Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Tue, 17 Sep 2024 16:18:13 +0300 Subject: [PATCH 3/4] lammps: nixfmt-rfc-style --- .../molecular-dynamics/lammps/default.nix | 108 +++++++++--------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/pkgs/applications/science/molecular-dynamics/lammps/default.nix b/pkgs/applications/science/molecular-dynamics/lammps/default.nix index bd88387a1ce8..2a511cc75949 100644 --- a/pkgs/applications/science/molecular-dynamics/lammps/default.nix +++ b/pkgs/applications/science/molecular-dynamics/lammps/default.nix @@ -1,48 +1,49 @@ -{ lib -, stdenv -, fetchFromGitHub -, libpng -, gzip -, fftw -, blas -, lapack -, python3 -, cmake -, autoAddDriverRunpath -, pkg-config -# Available list of packages can be found near here: -# -# - https://github.com/lammps/lammps/blob/develop/cmake/CMakeLists.txt#L222 -# - https://docs.lammps.org/Build_extras.html -, packages ? { - ASPHERE = true; - BODY = true; - CLASS2 = true; - COLLOID = true; - COMPRESS = true; - CORESHELL = true; - DIPOLE = true; - GRANULAR = true; - KSPACE = true; - MANYBODY = true; - MC = true; - MISC = true; - MOLECULE = true; - OPT = true; - PERI = true; - QEQ = true; - REPLICA = true; - RIGID = true; - SHOCK = true; - ML-SNAP = true; - SRD = true; - REAXFF = true; - PYTHON = true; -} -# Extra cmakeFlags to add as "-D${attr}=${value}" -, extraCmakeFlags ? {} -# Extra `buildInputs` - meant for packages that require more inputs -, extraBuildInputs ? [] +{ + lib, + stdenv, + fetchFromGitHub, + libpng, + gzip, + fftw, + blas, + lapack, + python3, + cmake, + autoAddDriverRunpath, + pkg-config, + # Available list of packages can be found near here: + # + # - https://github.com/lammps/lammps/blob/develop/cmake/CMakeLists.txt#L222 + # - https://docs.lammps.org/Build_extras.html + packages ? { + ASPHERE = true; + BODY = true; + CLASS2 = true; + COLLOID = true; + COMPRESS = true; + CORESHELL = true; + DIPOLE = true; + GRANULAR = true; + KSPACE = true; + MANYBODY = true; + MC = true; + MISC = true; + MOLECULE = true; + OPT = true; + PERI = true; + QEQ = true; + REPLICA = true; + RIGID = true; + SHOCK = true; + ML-SNAP = true; + SRD = true; + REAXFF = true; + PYTHON = true; + }, + # Extra cmakeFlags to add as "-D${attr}=${value}" + extraCmakeFlags ? { }, + # Extra `buildInputs` - meant for packages that require more inputs + extraBuildInputs ? [ ], }: stdenv.mkDerivation (finalAttrs: { @@ -76,12 +77,12 @@ stdenv.mkDerivation (finalAttrs: { inherit extraCmakeFlags; inherit extraBuildInputs; }; - cmakeFlags = [ - (lib.cmakeBool "BUILD_SHARED_LIBS" true) - ] - ++ (lib.mapAttrsToList (n: v: lib.cmakeBool "PKG_${n}" v) packages) - ++ (lib.mapAttrsToList (n: v: "-D${n}=${v}") extraCmakeFlags) - ; + cmakeFlags = + [ + (lib.cmakeBool "BUILD_SHARED_LIBS" true) + ] + ++ (lib.mapAttrsToList (n: v: lib.cmakeBool "PKG_${n}" v) packages) + ++ (lib.mapAttrsToList (n: v: "-D${n}=${v}") extraCmakeFlags); buildInputs = [ fftw @@ -89,8 +90,7 @@ stdenv.mkDerivation (finalAttrs: { blas lapack gzip - ] ++ lib.optionals packages.PYTHON [ python3 ] ++ extraBuildInputs - ; + ] ++ lib.optionals packages.PYTHON [ python3 ] ++ extraBuildInputs; postInstall = '' # For backwards compatibility @@ -110,7 +110,7 @@ stdenv.mkDerivation (finalAttrs: { National Laboratories, a US Department of Energy facility, with funding from the DOE. It is an open-source code, distributed freely under the terms of the GNU Public License (GPL). - ''; + ''; homepage = "https://www.lammps.org"; license = lib.licenses.gpl2Only; platforms = lib.platforms.linux; From 4c7de259dc93d5453e37886293197775c1753402 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Tue, 17 Sep 2024 16:20:09 +0300 Subject: [PATCH 4/4] lammps: move to pkgs/by-name --- .../lammps/default.nix => by-name/la/lammps/package.nix} | 0 pkgs/top-level/all-packages.nix | 4 ---- 2 files changed, 4 deletions(-) rename pkgs/{applications/science/molecular-dynamics/lammps/default.nix => by-name/la/lammps/package.nix} (100%) diff --git a/pkgs/applications/science/molecular-dynamics/lammps/default.nix b/pkgs/by-name/la/lammps/package.nix similarity index 100% rename from pkgs/applications/science/molecular-dynamics/lammps/default.nix rename to pkgs/by-name/la/lammps/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3cba16c1aa9f..ea232b362614 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -36556,10 +36556,6 @@ with pkgs; dl-poly-classic-mpi = callPackage ../applications/science/molecular-dynamics/dl-poly-classic { }; - lammps = callPackage ../applications/science/molecular-dynamics/lammps { - fftw = fftw; - }; - lammps-mpi = lowPrio (lammps.override { extraBuildInputs = [ mpi