diff options
author | Doron Behar <doron.behar@gmail.com> | 2023-06-03 15:41:16 +0300 |
---|---|---|
committer | Doron Behar <doron.behar@gmail.com> | 2023-06-04 01:29:54 +0300 |
commit | 66c6053b10b6623457b68b2ec7e0fb2a7c651313 (patch) | |
tree | 3aa9ad49bee295d688ddb3f3247d3d143722919f /pkgs/applications/science/molecular-dynamics | |
parent | 4994570ab3bc5a94363cc91d008be773147861d1 (diff) |
lammps: 29Oct2020 -> 23Jun2022_update4
Diffstat (limited to 'pkgs/applications/science/molecular-dynamics')
-rw-r--r-- | pkgs/applications/science/molecular-dynamics/lammps/default.nix | 90 |
1 files changed, 56 insertions, 34 deletions
diff --git a/pkgs/applications/science/molecular-dynamics/lammps/default.nix b/pkgs/applications/science/molecular-dynamics/lammps/default.nix index 5c4550ca7f9b..1707b309cb78 100644 --- a/pkgs/applications/science/molecular-dynamics/lammps/default.nix +++ b/pkgs/applications/science/molecular-dynamics/lammps/default.nix @@ -1,54 +1,76 @@ -{ lib, stdenv, fetchFromGitHub -, libpng, gzip, fftw, blas, lapack +{ lib +, stdenv +, fetchFromGitHub +, libpng +, gzip +, fftw +, blas +, lapack , withMPI ? false , mpi +, cmake +# Available list of packages can be found near here: +# https://github.com/lammps/lammps/blob/develop/cmake/CMakeLists.txt#L222 +, 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; +} }: -let packages = [ - "asphere" "body" "class2" "colloid" "compress" "coreshell" - "dipole" "granular" "kspace" "manybody" "mc" "misc" "molecule" - "opt" "peri" "qeq" "replica" "rigid" "shock" "snap" "srd" "user-reaxc" - ]; - lammps_includes = "-DLAMMPS_EXCEPTIONS -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64"; -in + stdenv.mkDerivation rec { # LAMMPS has weird versioning converted to ISO 8601 format - version = "stable_29Oct2020"; + version = "23Jun2022_update4"; pname = "lammps"; src = fetchFromGitHub { owner = "lammps"; repo = "lammps"; - rev = version; - sha256 = "1rmi9r5wj2z49wg43xyhqn9sm37n95cyli3g7vrqk3ww35mmh21q"; + rev = "stable_${version}"; + hash = "sha256-zGztc+iUFNIa0KKtfpAhwitInvMmXeTHp1XsOLibfzM="; }; + preConfigure = '' + cd cmake + ''; + nativeBuildInputs = [ + cmake + ]; passthru = { inherit mpi; inherit packages; }; + cmakeFlags = [ + ] ++ (builtins.map (p: "-DPKG_${p}=ON") (builtins.attrNames (lib.filterAttrs (n: v: v) packages))); - buildInputs = [ fftw libpng blas lapack gzip ] - ++ (lib.optionals withMPI [ mpi ]); - - configurePhase = '' - cd src - for pack in ${lib.concatStringsSep " " packages}; do make "yes-$pack" SHELL=$SHELL; done - ''; - - # Must do manual build due to LAMMPS requiring a separate build for - # the libraries and executable. Also non-typical make script - buildPhase = '' - make mode=exe ${if withMPI then "mpi" else "serial"} SHELL=$SHELL LMP_INC="${lammps_includes}" FFT_PATH=-DFFT_FFTW3 FFT_LIB=-lfftw3 JPG_LIB=-lpng - make mode=shlib ${if withMPI then "mpi" else "serial"} SHELL=$SHELL LMP_INC="${lammps_includes}" FFT_PATH=-DFFT_FFTW3 FFT_LIB=-lfftw3 JPG_LIB=-lpng - ''; - - installPhase = '' - mkdir -p $out/bin $out/include $out/lib - - cp -v lmp_* $out/bin/ - cp -v *.h $out/include/ - cp -v liblammps* $out/lib/ - ''; + buildInputs = [ + fftw + libpng + blas + lapack + gzip + ] ++ lib.optionals withMPI [ + mpi + ]; meta = with lib; { description = "Classical Molecular Dynamics simulation code"; |