git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #46667 from costrouc/costrouc/lammps-update

lammps: update, hoomd-blue, dl_poly: init

commit2823b5e698cbf34d8ac210b7321ab996b0e54b2f authormarkuskowa <markus.kowalewski@gmail.com> dateTue 13 Nov 2018, 21:00 (8 years ago) parentccb2deaae66a92
5 files changed+145−41
pkgs/applications/science/molecular-dynamics/dl-poly-classic/default.nix+37 pkgs/applications/science/molecular-dynamics/lammps/default.nix+32−39 pkgs/development/python-modules/hoomd-blue/default.nix+67 pkgs/top-level/all-packages.nix+5−2 pkgs/top-level/python-packages.nix+4
pkgs/applications/science/molecular-dynamics/dl-poly-classic/default.nixnew file+37
@@ -0,0 +1,37 @@
1+{ stdenv, fetchurl
2+, gfortran, mpi
3+}:
4+
5+stdenv.mkDerivation rec {
6+ version = "1.10";
7+ name = "DL_POLY_Classic-${version}";
8+
9+ src = fetchurl {
10+ url = "https://ccpforge.cse.rl.ac.uk/gf/download/frsrelease/574/8924/dl_class_1.10.tar.gz";
11+ sha256 = "1r76zvln3bwycxlmqday0sqzv5j260y7mdh66as2aqny6jzd5ld7";
12+ };
13+
14+ buildInputs = [ mpi gfortran ];
15+
16+ configurePhase = ''
17+ cd source
18+ cp -v ../build/MakePAR Makefile
19+ '';
20+
21+ buildPhase = ''
22+ make dlpoly
23+ '';
24+
25+ installPhase = ''
26+ mkdir -p $out/bin
27+ cp -v ../execute/DLPOLY.X $out/bin
28+ '';
29+
30+ meta = with stdenv.lib; {
31+ homepage = https://www.ccp5.ac.uk/DL_POLY_C;
32+ description = "DL_POLY Classic is a general purpose molecular dynamics simulation package";
33+ license = licenses.bsdOriginal;
34+ platforms = [ "x86_64-linux" ];
35+ maintainers = [ maintainers.costrouc ];
36+ };
37+}
pkgs/applications/science/molecular-dynamics/lammps/default.nix+32−39
@@ -1,63 +1,56 @@
1−{ lib
2−, bash
3−, stdenv
4−, writeText
5−, fetchFromGitHub
6−, libpng
7−, gzip
8−, fftw
9−, openblas
10−, mpiSupport ? false, mpi ? null
1+{ stdenv, fetchFromGitHub
2+, libpng, gzip, fftw, openblas
3+, mpi ? null
114}:
12−
13−assert mpiSupport -> mpi != null;
14−
5+let packages = [
6+ "asphere" "body" "class2" "colloid" "compress" "coreshell"
7+ "dipole" "granular" "kspace" "manybody" "mc" "misc" "molecule"
8+ "opt" "peri" "qeq" "replica" "rigid" "shock" "snap" "srd" "user-reaxc"
9+ ];
10+ lammps_includes = "-DLAMMPS_EXCEPTIONS -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64";
11+ withMPI = (mpi != null);
12+in
1513stdenv.mkDerivation rec {
1614 # LAMMPS has weird versioning converted to ISO 8601 format
17− version = "patch_2Aug2018";
15+ version = "stable_22Aug2018";
1816 name = "lammps-${version}";
1917
20− lammps_packages = "asphere body class2 colloid compress coreshell dipole granular kspace manybody mc misc molecule opt peri qeq replica rigid shock snap srd user-reaxc";
21− lammps_includes = "-DLAMMPS_EXCEPTIONS -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64";
22−
2318 src = fetchFromGitHub {
2419 owner = "lammps";
2520 repo = "lammps";
2621 rev = "${version}";
27− sha256 = "1ph9pr7s11wgmspmnhxa55bh1pq2cyl8iimfi62lbpbpl9pr1ilc";
22+ sha256 = "1dlifm9wm1jcw2zwal3fnzzl41ng08c7v48w6hx2mz84zljg1nsj";
2823 };
2924
3025 passthru = {
3126 inherit mpi;
27+ inherit packages;
3228 };
3329
34− buildInputs = [ fftw libpng openblas gzip bash ]
35− ++ (stdenv.lib.optionals mpiSupport [ mpi ]);
30+ buildInputs = [ fftw libpng openblas gzip ]
31+ ++ (stdenv.lib.optionals withMPI [ mpi ]);
32+
33+ configurePhase = ''
34+ cd src
35+ for pack in ${stdenv.lib.concatStringsSep " " packages}; do make "yes-$pack" SHELL=$SHELL; done
36+ '';
3637
3738 # Must do manual build due to LAMMPS requiring a seperate build for
38− # the libraries and executable
39− builder = writeText "builder.sh" ''
40− source $stdenv/setup
39+ # the libraries and executable. Also non-typical make script
40+ buildPhase = ''
41+ 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
42+ 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
43+ '';
4144
42− mkdir lammps
43− cp -r $src/lib $src/src lammps
44− chmod -R 755 lammps/src/
45− cd lammps/src
46− for pack in ${lammps_packages}; do make "yes-$pack" SHELL=$SHELL; done
47− make mode=exe ${if mpiSupport then "mpi" else "serial"} SHELL=$SHELL LMP_INC="${lammps_includes}" FFT_PATH=-DFFT_FFTW3 FFT_LIB=-lfftw3 JPG_LIB=-lpng
48− make mode=shlib ${if mpiSupport then "mpi" else "serial"} SHELL=$SHELL LMP_INC="${lammps_includes}" FFT_PATH=-DFFT_FFTW3 FFT_LIB=-lfftw3 JPG_LIB=-lpng
45+ installPhase = ''
46+ mkdir -p $out/bin $out/include $out/lib
4947
50− mkdir -p $out/bin
5148 cp -v lmp_* $out/bin/
52−
53− mkdir -p $out/include
5449 cp -v *.h $out/include/
55−
56− mkdir -p $out/lib
5750 cp -v liblammps* $out/lib/
5851 '';
5952
60− meta = {
53+ meta = with stdenv.lib; {
6154 description = "Classical Molecular Dynamics simulation code";
6255 longDescription = ''
6356 LAMMPS is a classical molecular dynamics simulation code designed to
@@ -67,8 +60,8 @@ stdenv.mkDerivation rec {
6760 under the terms of the GNU Public License (GPL).
6861 '';
6962 homepage = http://lammps.sandia.gov;
70− license = stdenv.lib.licenses.gpl2;
71− platforms = stdenv.lib.platforms.linux;
72− maintainers = with lib.maintainers; [ costrouc ];
63+ license = licenses.gpl2;
64+ platforms = platforms.linux;
65+ maintainers = [ maintainers.costrouc ];
7366 };
7467}
pkgs/development/python-modules/hoomd-blue/default.nixnew file+67
@@ -0,0 +1,67 @@
1+{ stdenv, buildPythonPackage, fetchgit
2+, cmake, pkgconfig
3+, python
4+, mpi ? null
5+}:
6+
7+let components = {
8+ cgcmm = true;
9+ depreciated = true;
10+ hpmc = true;
11+ md = true;
12+ metal = true;
13+ testing = false;
14+ };
15+ onOffBool = b: if b then "ON" else "OFF";
16+ withMPI = (mpi != null);
17+in
18+stdenv.mkDerivation rec {
19+ version = "2.3.4";
20+ name = "hoomd-blue-${version}";
21+
22+ src = fetchgit {
23+ url = "https://bitbucket.org/glotzer/hoomd-blue";
24+ rev = "v${version}";
25+ sha256 = "0in49f1dvah33nl5n2qqbssfynb31pw1ds07j8ziryk9w252j1al";
26+ };
27+
28+ passthru = {
29+ inherit components mpi;
30+ };
31+
32+ nativeBuildInputs = [ cmake pkgconfig ];
33+ buildInputs = stdenv.lib.optionals withMPI [ mpi ];
34+ propagatedBuildInputs = [ python.pkgs.numpy ]
35+ ++ stdenv.lib.optionals withMPI [ python.pkgs.mpi4py ];
36+
37+ enableParallelBuilding = true;
38+
39+ dontAddPrefix = true;
40+ cmakeFlags = [
41+ "-DENABLE_MPI=${onOffBool withMPI}"
42+ "-DBUILD_CGCMM=${onOffBool components.cgcmm}"
43+ "-DBUILD_DEPRECIATED=${onOffBool components.depreciated}"
44+ "-DBUILD_HPMC=${onOffBool components.hpmc}"
45+ "-DBUILD_MD=${onOffBool components.md}"
46+ "-DBUILD_METAL=${onOffBool components.metal}"
47+ "-DBUILD_TESTING=${onOffBool components.testing}"
48+ ];
49+
50+ preConfigure = ''
51+ # Since we can't expand $out in `cmakeFlags`
52+ cmakeFlags="$cmakeFlags -DCMAKE_INSTALL_PREFIX=$out/${python.sitePackages}"
53+ '';
54+
55+ # tests fail but have tested that package runs properly
56+ doCheck = false;
57+ checkTarget = "test";
58+
59+ meta = with stdenv.lib; {
60+ homepage = http://glotzerlab.engin.umich.edu/hoomd-blue/;
61+ description = "HOOMD-blue is a general-purpose particle simulation toolkit";
62+ license = licenses.bsdOriginal;
63+ platforms = [ "x86_64-linux" ];
64+ maintainers = [ maintainers.costrouc ];
65+ };
66+
67+}
pkgs/top-level/all-packages.nix+5−2
@@ -21378,12 +21378,15 @@ with pkgs;
2137821378
2137921379 ### SCIENCE/MOLECULAR-DYNAMICS
2138021380
21381+ dl-poly-classic-mpi = callPackage ../applications/science/molecular-dynamics/dl-poly-classic {
21382+ mpi = openmpi;
21383+ };
21384+
2138121385 lammps = callPackage ../applications/science/molecular-dynamics/lammps {
2138221386 fftw = fftw;
2138321387 };
2138421388
21385− lammps-mpi = appendToName "mpi" (lammps.override {
21386− mpiSupport = true;
21389+ lammps-mpi = lowPrio (lammps.override {
2138721390 mpi = openmpi;
2138821391 });
2138921392
pkgs/top-level/python-packages.nix+4
@@ -392,6 +392,10 @@ in {
392392
393393 hdmedians = callPackage ../development/python-modules/hdmedians { };
394394
395+ hoomd-blue = toPythonModule (callPackage ../development/python-modules/hoomd-blue {
396+ inherit python;
397+ });
398+
395399 httpsig = callPackage ../development/python-modules/httpsig { };
396400
397401 i3ipc = callPackage ../development/python-modules/i3ipc { };