Merge pull request #44752 from costrouc/costrouc/lammps-update

material science packages (init and update): lammps, python - ase, pymatgen-lammps, lammps-cython, dftfit
This commit is contained in:
Frederik Rietdijk 2018-08-25 19:03:36 +02:00 committed by GitHub
commit c71942eb7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 461 additions and 65 deletions

View file

@ -1,25 +1,37 @@
{ stdenv, writeText, fetchurl,
libpng, fftw,
mpiSupport ? false, mpi ? null
{ lib
, bash
, stdenv
, writeText
, fetchFromGitHub
, libpng
, gzip
, fftw
, openblas
, mpiSupport ? false, mpi ? null
}:
assert mpiSupport -> mpi != null;
stdenv.mkDerivation rec {
# LAMMPS has weird versioning converted to ISO 8601 format
version = "2016-02-16";
version = "patch_2Aug2018";
name = "lammps-${version}";
src = fetchurl {
url = "mirror://sourceforge/lammps/lammps-16Feb16.tar.gz";
sha256 = "1yzfbkxma3xa1288rnn66h4w0smbmjkwq1fx1y60pjiw0prmk105";
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";
lammps_includes = "-DLAMMPS_EXCEPTIONS -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64";
src = fetchFromGitHub {
owner = "lammps";
repo = "lammps";
rev = "${version}";
sha256 = "1ph9pr7s11wgmspmnhxa55bh1pq2cyl8iimfi62lbpbpl9pr1ilc";
};
passthru = {
inherit mpi;
};
buildInputs = [ fftw libpng ]
buildInputs = [ fftw libpng openblas gzip bash ]
++ (stdenv.lib.optionals mpiSupport [ mpi ]);
# Must do manual build due to LAMMPS requiring a seperate build for
@ -27,13 +39,19 @@ stdenv.mkDerivation rec {
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 lammps
cp -r $src/lib $src/src lammps
chmod -R 755 lammps/src/
cd lammps/src
for pack in ${lammps_packages}; do make "yes-$pack" SHELL=$SHELL; done
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
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
mkdir -p $out/bin
cp -v lmp_* $out/bin/lammps
cp -v lmp_* $out/bin/
mkdir -p $out/include
cp -v *.h $out/include/
mkdir -p $out/lib
cp -v liblammps* $out/lib/
@ -51,5 +69,6 @@ stdenv.mkDerivation rec {
homepage = http://lammps.sandia.gov;
license = stdenv.lib.licenses.gpl2;
platforms = stdenv.lib.platforms.linux;
maintainers = with lib.maintainers; [ costrouc ];
};
}

View file

@ -0,0 +1,46 @@
{ lib
, fetchFromGitHub
, stdenv
, cmake
, eigen
, nlopt
, ipopt
, boost
, writeText
}:
stdenv.mkDerivation rec {
name = "pagmo2-${version}";
version = "2.8";
src = fetchFromGitHub {
owner = "esa";
repo = "pagmo2";
rev = "v${version}";
sha256 = "1xwxamcn3fkwr62jn6bkanrwy0cvsksf75hfwx4fvl56awnbz41z";
};
buildInputs = [ cmake eigen nlopt ipopt boost ];
preBuild = ''
cp -r $src/* .
'';
cmakeFlags = [ "-DPAGMO_BUILD_TESTS=no"
"-DPAGMO_WITH_EIGEN3=yes" "-DPAGMO_WITH_NLOPT=yes"
"-DNLOPT_LIBRARY=${nlopt}/lib/libnlopt_cxx.so" "-DPAGMO_WITH_IPOPT=yes"
"-DCMAKE_CXX_FLAGS='-fuse-ld=gold'" ];
checkPhase = ''
ctest
'';
# All but one test pass skip for now (tests also take about 30 min to compile)
doCheck = false;
meta = {
homepage = https://esa.github.io/pagmo2/;
description = "Scientific library for massively parallel optimization";
license = stdenv.lib.licenses.gpl3Plus;
};
}

View file

@ -0,0 +1,36 @@
{ lib
, fetchurl
, buildPythonPackage
, numpy
, scipy
, matplotlib
, flask
, pillow
, psycopg2
}:
buildPythonPackage rec {
version = "3.16.2";
pname = "ase";
src = fetchurl {
url = "https://gitlab.com/${pname}/${pname}/-/archive/${version}/${pname}-${version}.tar.gz";
sha256 = "171j3f4a261cfnqjq98px5fldxql65i3jgf60wc945xvh0mbc8ds";
};
propagatedBuildInputs = [ numpy scipy matplotlib flask pillow psycopg2 ];
checkPhase = ''
$out/bin/ase test
'';
# tests just hang most likely due to something with subprocesses and cli
doCheck = false;
meta = {
description = "Atomic Simulation Environment";
homepage = https://wiki.fysik.dtu.dk/ase/;
license = lib.licenses.lgpl21Plus;
maintainers = with lib.maintainers; [ costrouc ];
};
}

View file

@ -0,0 +1,47 @@
{ lib
, fetchPypi
, buildPythonPackage
, pymatgen
, marshmallow
, pyyaml
, pygmo
, pandas
, scipy
, numpy
, scikitlearn
, lammps-cython
, pymatgen-lammps
, pytestrunner
, pytest
, pytestcov
, pytest-benchmark
, isPy3k
, openssh
}:
buildPythonPackage rec {
pname = "dftfit";
version = "0.4.11";
disabled = (!isPy3k);
src = fetchPypi {
inherit pname version;
sha256 = "c6e36a793f9f94746bb8a04fb8316404aeacfa918704de07b15e1b4b8b62242d";
};
buildInputs = [ pytestrunner ];
checkInputs = [ pytest pytestcov pytest-benchmark openssh ];
propagatedBuildInputs = [ pymatgen marshmallow pyyaml pygmo
pandas scipy numpy scikitlearn
lammps-cython pymatgen-lammps ];
# tests require git lfs download. and is quite large so skip tests
doCheck = false;
meta = {
description = "Ab-Initio Molecular Dynamics Potential Development";
homepage = https://gitlab.com/costrouc/dftfit;
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ costrouc ];
};
}

View file

@ -0,0 +1,35 @@
{ lib
, fetchurl
, buildPythonPackage
, isPy3k
, python
}:
buildPythonPackage rec {
pname = "docutils";
version = "0.14";
src = fetchurl {
url = "mirror://sourceforge/docutils/${pname}.tar.gz";
sha256 = "0x22fs3pdmr42kvz6c654756wja305qv6cx1zbhwlagvxgr4xrji";
};
checkPhase = if isPy3k then ''
${python.interpreter} test3/alltests.py
'' else ''
${python.interpreter} test/alltests.py
'';
# Create symlinks lacking a ".py" suffix, many programs depend on these names
postFixup = ''
(cd $out/bin && for f in *.py; do
ln -s $f $(echo $f | sed -e 's/\.py$//')
done)
'';
meta = {
description = "Docutils -- Python Documentation Utilities";
homepage = http://docutils.sourceforge.net/;
maintainers = with lib.maintainers; [ garbas AndersonTorres ];
};
}

View file

@ -0,0 +1,53 @@
{ lib
, fetchurl
, buildPythonPackage
, lammps-mpi
, mpi
, mpi4py
, numpy
, cython
, pymatgen
, ase
, pytestrunner
, pytest
, pytestcov
, isPy3k
, openssh
}:
buildPythonPackage rec {
pname = "lammps-cython";
version = "0.5.7";
disabled = (!isPy3k);
src = fetchurl {
url = "https://gitlab.com/costrouc/${pname}/-/archive/v${version}/${pname}-v${version}.tar.gz";
sha256 = "1wj9scmjdl00af13b5ihfccrjpikrdgkzd88ialam1nkxvxi42bl";
};
buildInputs = [ cython pytestrunner ];
checkInputs = [ pytest pytestcov openssh ];
propagatedBuildInputs = [ mpi4py pymatgen ase numpy ];
preBuild = ''
echo "Creating lammps.cfg file..."
cat << EOF > lammps.cfg
[lammps]
lammps_include_dir = ${lammps-mpi}/include
lammps_library_dir = ${lammps-mpi}/lib
lammps_library = lammps_mpi
[mpi]
mpi_include_dir = ${mpi}/include
mpi_library_dir = ${mpi}/lib
mpi_library = mpi
EOF
'';
meta = {
description = "Pythonic Wrapper to LAMMPS using cython";
homepage = https://gitlab.com/costrouc/lammps-cython;
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ costrouc ];
};
}

View file

@ -0,0 +1,28 @@
{ lib
, buildPythonPackage
, fetchPypi
, python
, pythonAtLeast
}:
buildPythonPackage rec {
pname = "pathlib";
version = "1.0.1";
disabled = pythonAtLeast "3.4"; # Was added to std library in Python 3.4
src = fetchPypi {
inherit pname version;
sha256 = "17zajiw4mjbkkv6ahp3xf025qglkj0805m9s41c45zryzj6p2h39";
};
checkPhase = ''
${python.interpreter} -m unittest discover
'';
meta = {
description = "Object-oriented filesystem paths";
homepage = https://pathlib.readthedocs.org/;
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ costrouc ];
};
}

View file

@ -0,0 +1,23 @@
{ lib
, fetchFromGitHub
, buildPythonPackage
}:
buildPythonPackage rec {
pname = "py-cpuinfo";
version = "4.0.0";
src = fetchFromGitHub {
owner = "workhorsy";
repo = pname;
rev = "v${version}";
sha256 = "1pp561lj80jnvr2038nrzhmks2akxsbdqxvfrqa6n340x81981lm";
};
meta = {
description = "Get CPU info with pure Python 2 & 3";
homepage = https://github.com/workhorsy/py-cpuinfo;
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ costrouc ];
};
}

View file

@ -0,0 +1,48 @@
{ lib
, fetchFromGitHub
, buildPythonPackage
, cmake
, eigen
, nlopt
, ipopt
, boost
, pagmo2
, numpy
, cloudpickle
, ipyparallel
, numba
}:
buildPythonPackage rec {
pname = "pygmo";
version = "2.8";
src = fetchFromGitHub {
owner = "esa";
repo = "pagmo2";
rev = "v${version}";
sha256 = "1xwxamcn3fkwr62jn6bkanrwy0cvsksf75hfwx4fvl56awnbz41z";
};
buildInputs = [ cmake eigen nlopt ipopt boost pagmo2 ];
propagatedBuildInputs = [ numpy cloudpickle ipyparallel numba ];
preBuild = ''
cp -v -r $src/* .
cmake -DCMAKE_INSTALL_PREFIX=$out -DPAGMO_BUILD_TESTS=no -DCMAKE_SYSTEM_NAME=Linux -DPagmo_DIR=${pagmo2} -DPAGMO_BUILD_PYGMO=yes -DPAGMO_BUILD_PAGMO=no -DPAGMO_WITH_EIGEN3=yes -DPAGMO_WITH_NLOPT=yes -DNLOPT_LIBRARY=${nlopt}/lib/libnlopt_cxx.so -DPAGMO_WITH_IPOPT=yes -DIPOPT=${ipopt}
make install
mv $out/lib/python*/site-packages/pygmo wheel
cd wheel
'';
# dont do tests
doCheck = false;
meta = {
description = "Parallel optimisation for Python";
homepage = https://esa.github.io/pagmo2/;
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ costrouc ];
};
}

View file

@ -0,0 +1,31 @@
{ lib
, fetchurl
, buildPythonPackage
, pymatgen
, lammps
, pytestrunner
, pytest
, isPy3k
}:
buildPythonPackage rec {
pname = "pymatgen-lammps";
version = "0.4.5";
disabled = (!isPy3k);
src = fetchurl {
url = "https://gitlab.com/costrouc/${pname}/-/archive/v${version}/${pname}-v${version}.tar.gz";
sha256 = "0shldl8is3195jmji7dr3zsh1bzxlahaqrmpr28niks7nnfj80fx";
};
buildInputs = [ pytestrunner ];
checkInputs = [ pytest ];
propagatedBuildInputs = [ pymatgen ];
meta = {
description = "A LAMMPS wrapper using pymatgen";
homepage = https://gitlab.com/costrouc/pymatgen-lammps;
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ costrouc ];
};
}

View file

@ -0,0 +1,31 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, pytestrunner
, pytest
, py-cpuinfo
, pythonOlder
, pathlib
, statistics
}:
buildPythonPackage rec {
pname = "pytest-benchmark";
version = "3.1.1";
src = fetchFromGitHub {
owner = "ionelmc";
repo = pname;
rev = "v${version}";
sha256 = "1ch079dlc6c9ag74dh4dg6plkmh0h8kn78ari3fgadc75bald71m";
};
propagatedBuildInputs = [ pytest py-cpuinfo ] ++ lib.optional (pythonOlder "3.4") [ pathlib statistics ];
meta = {
description = "Py.test fixture for benchmarking code";
homepage = https://github.com/ionelmc/pytest-benchmark;
license = lib.licenses.bsd2;
maintainers = with lib.maintainers; [ costrouc ];
};
}

View file

@ -0,0 +1,27 @@
{ lib
, fetchPypi
, buildPythonPackage
, docutils
}:
buildPythonPackage rec {
pname = "statistics";
version = "1.0.3.5";
src = fetchPypi {
inherit pname version;
sha256 = "2dc379b80b07bf2ddd5488cad06b2b9531da4dd31edb04dc9ec0dc226486c138";
};
propagatedBuildInputs = [ docutils ];
# statistics package does not have any tests
doCheck = false;
meta = {
description = "A Python 2.* port of 3.4 Statistics Module";
homepage = https://github.com/digitalemagine/py-statistics;
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ costrouc ];
};
}

View file

@ -4444,6 +4444,8 @@ with pkgs;
padthv1 = callPackage ../applications/audio/padthv1 { };
pagmo2 = callPackage ../development/libraries/pagmo2 { };
pakcs = callPackage ../development/compilers/pakcs {};
pal = callPackage ../tools/misc/pal { };

View file

@ -182,6 +182,8 @@ in {
asana = callPackage ../development/python-modules/asana { };
ase = callPackage ../development/python-modules/ase { };
asn1crypto = callPackage ../development/python-modules/asn1crypto { };
aspy-yaml = callPackage ../development/python-modules/aspy.yaml { };
@ -268,6 +270,8 @@ in {
dbus = pkgs.dbus;
};
dftfit = callPackage ../development/python-modules/dftfit { };
discid = callPackage ../development/python-modules/discid { };
discordpy = callPackage ../development/python-modules/discordpy { };
@ -278,6 +282,8 @@ in {
distorm3 = callPackage ../development/python-modules/distorm3 { };
docutils = callPackage ../development/python-modules/docutils { };
dogtail = callPackage ../development/python-modules/dogtail { };
diff-match-patch = callPackage ../development/python-modules/diff-match-patch { };
@ -310,6 +316,10 @@ in {
jira = callPackage ../development/python-modules/jira { };
lammps-cython = callPackage ../development/python-modules/lammps-cython {
mpi = pkgs.openmpi;
};
lmtpd = callPackage ../development/python-modules/lmtpd { };
logster = callPackage ../development/python-modules/logster { };
@ -348,6 +358,8 @@ in {
palettable = callPackage ../development/python-modules/palettable { };
pathlib = callPackage ../development/python-modules/pathlib { };
pdf2image = callPackage ../development/python-modules/pdf2image { };
pdfminer = callPackage ../development/python-modules/pdfminer_six { };
@ -392,6 +404,8 @@ in {
PyChromecast = callPackage ../development/python-modules/pychromecast { };
py-cpuinfo = callPackage ../development/python-modules/py-cpuinfo { };
pydbus = callPackage ../development/python-modules/pydbus { };
pydocstyle = callPackage ../development/python-modules/pydocstyle { };
@ -408,6 +422,8 @@ in {
pygame_sdl2 = callPackage ../development/python-modules/pygame_sdl2 { };
pygmo = callPackage ../development/python-modules/pygmo { };
pygobject2 = callPackage ../development/python-modules/pygobject { };
pygobject3 = callPackage ../development/python-modules/pygobject/3.nix { };
@ -437,6 +453,8 @@ in {
pymatgen = callPackage ../development/python-modules/pymatgen { };
pymatgen-lammps = callPackage ../development/python-modules/pymatgen-lammps { };
pynisher = callPackage ../development/python-modules/pynisher { };
pyparser = callPackage ../development/python-modules/pyparser { };
@ -519,6 +537,8 @@ in {
spglib = callPackage ../development/python-modules/spglib { };
statistics = callPackage ../development/python-modules/statistics { };
sumo = callPackage ../development/python-modules/sumo { };
supervise_api = callPackage ../development/python-modules/supervise_api { };
@ -1845,6 +1865,8 @@ in {
pytest-aiohttp = callPackage ../development/python-modules/pytest-aiohttp { };
pytest-benchmark = callPackage ../development/python-modules/pytest-benchmark { };
pytestcache = callPackage ../development/python-modules/pytestcache { };
pytest-catchlog = callPackage ../development/python-modules/pytest-catchlog { };
@ -4987,37 +5009,6 @@ in {
};
};
docutils = buildPythonPackage rec {
name = "docutils-${version}";
version = "0.14";
src = pkgs.fetchurl {
url = "mirror://sourceforge/docutils/${name}.tar.gz";
sha256 = "0x22fs3pdmr42kvz6c654756wja305qv6cx1zbhwlagvxgr4xrji";
};
checkPhase = if isPy3k then ''
${python.interpreter} test3/alltests.py
'' else ''
${python.interpreter} test/alltests.py
'';
# Create symlinks lacking a ".py" suffix, many programs depend on these names
postFixup = ''
(cd $out/bin && for f in *.py; do
ln -s $f $(echo $f | sed -e 's/\.py$//')
done)
'';
meta = {
description = "An open-source text processing system for processing plaintext documentation into useful formats, such as HTML or LaTeX";
homepage = http://docutils.sourceforge.net/;
maintainers = with maintainers; [ garbas AndersonTorres ];
};
};
dtopt = buildPythonPackage rec {
name = "dtopt-0.1";
@ -9441,27 +9432,6 @@ in {
patator = callPackage ../development/python-modules/patator { };
pathlib = buildPythonPackage rec {
name = "pathlib-${version}";
version = "1.0.1";
disabled = pythonAtLeast "3.4"; # Was added to std library in Python 3.4
src = pkgs.fetchurl {
url = "mirror://pypi/p/pathlib/${name}.tar.gz";
sha256 = "17zajiw4mjbkkv6ahp3xf025qglkj0805m9s41c45zryzj6p2h39";
};
checkPhase = ''
${python.interpreter} -m unittest discover
'';
meta = {
description = "Object-oriented filesystem paths";
homepage = "https://pathlib.readthedocs.org/";
license = licenses.mit;
};
};
pathlib2 = callPackage ../development/python-modules/pathlib2 { };
pathpy = callPackage ../development/python-modules/path.py { };