lammps and python312Packages.lammps related fixes (#342532)

This commit is contained in:
Doron Behar 2024-09-30 11:56:17 +03:00 committed by GitHub
commit 546d75c16a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 57 additions and 56 deletions

View File

@ -1,46 +1,49 @@
{ lib
, stdenv
, fetchFromGitHub
, libpng
, gzip
, fftw
, blas
, lapack
, 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;
}
# 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: {
@ -74,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
@ -87,8 +90,7 @@ stdenv.mkDerivation (finalAttrs: {
blas
lapack
gzip
] ++ extraBuildInputs
;
] ++ lib.optionals packages.PYTHON [ python3 ] ++ extraBuildInputs;
postInstall = ''
# For backwards compatibility
@ -108,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;

View File

@ -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

View File

@ -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