2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub
|
2020-04-24 23:36:52 +00:00
|
|
|
, libpng, gzip, fftw, blas, lapack
|
2021-02-05 17:12:51 +00:00
|
|
|
, withMPI ? false
|
|
|
|
, mpi
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
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_22Aug2018";
|
|
|
|
pname = "lammps";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "lammps";
|
|
|
|
repo = "lammps";
|
|
|
|
rev = version;
|
|
|
|
sha256 = "1dlifm9wm1jcw2zwal3fnzzl41ng08c7v48w6hx2mz84zljg1nsj";
|
|
|
|
};
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
inherit mpi;
|
|
|
|
inherit packages;
|
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [ fftw libpng blas lapack gzip ]
|
2021-01-17 00:15:33 +00:00
|
|
|
++ (lib.optionals withMPI [ mpi ]);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
configurePhase = ''
|
|
|
|
cd src
|
2021-01-17 00:15:33 +00:00
|
|
|
for pack in ${lib.concatStringsSep " " packages}; do make "yes-$pack" SHELL=$SHELL; done
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
# Must do manual build due to LAMMPS requiring a seperate 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/
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
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 = licenses.gpl2;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = [ maintainers.costrouc ];
|
|
|
|
};
|
|
|
|
}
|