summary refs log tree commit diff
diff options
context:
space:
mode:
authorjoachifm <joachifm@users.noreply.github.com>2016-04-01 23:40:52 +0000
committerjoachifm <joachifm@users.noreply.github.com>2016-04-01 23:40:52 +0000
commit6a4ca7e43a54fccc6ecbb0f195e5123098fc4976 (patch)
treec0b72ce7fec35a2efda2b51161dd4b4723513273
parent1bcbc4994dd3fd46febc25ee665c444729fb0f26 (diff)
parenta32d5d37558d22b2d9ff878336786f315f4681f9 (diff)
downloadnixlib-6a4ca7e43a54fccc6ecbb0f195e5123098fc4976.tar
nixlib-6a4ca7e43a54fccc6ecbb0f195e5123098fc4976.tar.gz
nixlib-6a4ca7e43a54fccc6ecbb0f195e5123098fc4976.tar.bz2
nixlib-6a4ca7e43a54fccc6ecbb0f195e5123098fc4976.tar.lz
nixlib-6a4ca7e43a54fccc6ecbb0f195e5123098fc4976.tar.xz
nixlib-6a4ca7e43a54fccc6ecbb0f195e5123098fc4976.tar.zst
nixlib-6a4ca7e43a54fccc6ecbb0f195e5123098fc4976.zip
Merge pull request #14377 from costrouc/costrouc-additions
lammps: init at 2016-02-16 with serial and mpi builds
-rw-r--r--pkgs/applications/science/molecular-dynamics/lammps/default.nix55
-rw-r--r--pkgs/top-level/all-packages.nix9
2 files changed, 64 insertions, 0 deletions
diff --git a/pkgs/applications/science/molecular-dynamics/lammps/default.nix b/pkgs/applications/science/molecular-dynamics/lammps/default.nix
new file mode 100644
index 000000000000..35ab53483687
--- /dev/null
+++ b/pkgs/applications/science/molecular-dynamics/lammps/default.nix
@@ -0,0 +1,55 @@
+{ stdenv, writeText, fetchurl,
+  libpng, fftw,
+  mpiSupport ? false, mpi ? null
+}:
+
+assert mpiSupport -> mpi != null;
+
+stdenv.mkDerivation rec {
+  # LAMMPS has weird versioning converted to ISO 8601 format
+  version = "2016-02-16";
+  name = "lammps-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/lammps/lammps-16Feb16.tar.gz";
+    sha256 = "1yzfbkxma3xa1288rnn66h4w0smbmjkwq1fx1y60pjiw0prmk105";
+  };
+
+  passthru = {
+    inherit mpi;
+  };
+
+  buildInputs = [ fftw libpng ]
+  ++ (stdenv.lib.optionals mpiSupport [ mpi ]);
+
+  # Must do manual build due to LAMMPS requiring a seperate build for
+  # the libraries and executable
+  builder = writeText "builder.sh" ''
+    source $stdenv/setup
+
+    tar xzf $src
+    cd lammps-*/src
+    make mode=exe ${if mpiSupport then "mpi" else "serial"} SHELL=$SHELL LMP_INC="-DLAMMPS_GZIP -DLAMMPS_PNG" FFT_PATH=-DFFT_FFTW3 FFT_LIB=-lfftw3 JPG_LIB=-lpng
+    make mode=shlib ${if mpiSupport then "mpi" else "serial"} SHELL=$SHELL LMP_INC="-DLAMMPS_GZIP -DLAMMPS_PNG" FFT_PATH=-DFFT_FFTW3 FFT_LIB=-lfftw3 JPG_LIB=-lpng
+
+    mkdir -p $out/bin
+    cp -v lmp_* $out/bin/lammps
+
+    mkdir -p $out/lib
+    cp -v liblammps* $out/lib/
+  '';
+
+  meta = {
+    description = "Classical Molecular Dynamics simulation code";
+    longDescription = ''
+      LAMMPS is a classical molecular dynamics simulation code designed to
+      run efficiently on parallel computers. It was developed at Sandia
+      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 = "http://lammps.sandia.gov";
+    license = stdenv.lib.licenses.gpl2;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index d70da4ebf411..2f583ac5cdec 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -15524,6 +15524,15 @@ in
 
   ### SCIENCE/MOLECULAR-DYNAMICS
 
+  lammps = callPackage ../applications/science/molecular-dynamics/lammps {
+    fftw = fftw;
+  };
+
+  lammps-mpi = appendToName "mpi" (lammps.override {
+    mpiSupport = true;
+    mpi = openmpi;
+  });
+
   gromacs = callPackage ../applications/science/molecular-dynamics/gromacs {
     singlePrec = true;
     mpiEnabled = false;