From dd7f587346aa6f57e25628643149982041e02655 Mon Sep 17 00:00:00 2001 From: Phillip Seeber Date: Tue, 9 Nov 2021 18:04:04 +0100 Subject: [PATCH 1/6] libcint: 4.4.0 -> 4.4.6 libcint: formatting and features libcint: platforms --- pkgs/development/libraries/libcint/default.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/libcint/default.nix b/pkgs/development/libraries/libcint/default.nix index a6f2e05d73614d..1ff5eb338a9efd 100644 --- a/pkgs/development/libraries/libcint/default.nix +++ b/pkgs/development/libraries/libcint/default.nix @@ -9,13 +9,13 @@ stdenv.mkDerivation rec { pname = "libcint"; - version = "4.4.0"; + version = "4.4.6"; src = fetchFromGitHub { owner = "sunqm"; repo = "libcint"; rev = "v${version}"; - hash = "sha256-nsIyosn8dBf217UmjXSKLTM2RhIQHCSvPlrvlqo5KLc="; + sha256 = "sha256-eWUuORMZs6Bl/zFGYZkpgNAgJPIei+k0cQoWl+v+zxo="; }; nativeBuildInputs = [ cmake ]; @@ -24,6 +24,9 @@ stdenv.mkDerivation rec { "-DENABLE_TEST=1" "-DQUICK_TEST=1" "-DCMAKE_INSTALL_PREFIX=" # ends up double-adding /nix/store/... prefix, this avoids issue + "-DWITH_RANGE_COULOMB:STRING=1" + "-DWITH_FORTRAN:STRING=1" + "-DMIN_EXPCUTOFF:STRING=20" ]; strictDeps = true; From 2a9baed9062f60d06849aabd41bae916f714f508 Mon Sep 17 00:00:00 2001 From: Phillip Seeber Date: Wed, 10 Nov 2021 12:29:53 +0100 Subject: [PATCH 2/6] libxc: force 3rd and 4th derivatives compilation libxc: formatting libxc: platforms --- pkgs/development/libraries/libxc/default.nix | 12 ++++++++++-- .../libraries/science/chemistry/xcfun/default.nix | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/libxc/default.nix b/pkgs/development/libraries/libxc/default.nix index 653f4376468250..046d630888c458 100644 --- a/pkgs/development/libraries/libxc/default.nix +++ b/pkgs/development/libraries/libxc/default.nix @@ -17,7 +17,15 @@ stdenv.mkDerivation rec { patchShebangs ./ ''; - cmakeFlags = [ "-DENABLE_FORTRAN=ON" "-DBUILD_SHARED_LIBS=ON" ]; + cmakeFlags = [ + "-DENABLE_FORTRAN=ON" + "-DBUILD_SHARED_LIBS=ON" + # Force compilation of higher derivatives + "-DDISABLE_VXC=0" + "-DDISABLE_FXC=0" + "-DDISABLE_KXC=0" + "-DDISABLE_LXC=0" + ]; preCheck = '' export LD_LIBRARY_PATH=$(pwd) @@ -29,7 +37,7 @@ stdenv.mkDerivation rec { description = "Library of exchange-correlation functionals for density-functional theory"; homepage = "https://www.tddft.org/programs/Libxc/"; license = licenses.mpl20; - platforms = [ "x86_64-linux" ]; + platforms = platforms.unix; maintainers = with maintainers; [ markuskowa ]; }; } diff --git a/pkgs/development/libraries/science/chemistry/xcfun/default.nix b/pkgs/development/libraries/science/chemistry/xcfun/default.nix index 7f8ef3dc47d7f4..0856168092cbcc 100644 --- a/pkgs/development/libraries/science/chemistry/xcfun/default.nix +++ b/pkgs/development/libraries/science/chemistry/xcfun/default.nix @@ -8,7 +8,7 @@ stdenv.mkDerivation rec { owner = "dftlibs"; repo = pname; rev = "v${version}"; - sha256= "1bj70cnhbh6ziy02x988wwl7cbwaq17ld7qwhswqkgnnx8rpgxid"; + sha256 = "1bj70cnhbh6ziy02x988wwl7cbwaq17ld7qwhswqkgnnx8rpgxid"; }; nativeBuildInputs = [ From dbd7ba5f5f0865f2b2e9ec5c303ee4979a4679a5 Mon Sep 17 00:00:00 2001 From: sheepforce Date: Mon, 22 Nov 2021 12:25:31 +0100 Subject: [PATCH 3/6] python3.pkgs.fields: init at 5.0.0 fields: expose package fields: formatting fields: platforms fields: platforms fields: remove redundant platform --- .../python-modules/fields/default.nix | 20 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 ++ 2 files changed, 22 insertions(+) create mode 100644 pkgs/development/python-modules/fields/default.nix diff --git a/pkgs/development/python-modules/fields/default.nix b/pkgs/development/python-modules/fields/default.nix new file mode 100644 index 00000000000000..35bf686b435305 --- /dev/null +++ b/pkgs/development/python-modules/fields/default.nix @@ -0,0 +1,20 @@ +{ buildPythonPackage, lib, fetchPypi }: + +buildPythonPackage rec { + pname = "fields"; + version = "5.0.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256-MdSqA9jUTjXfE8Qx3jUTaZfwR6kkpZfYT3vCCeG+Vyc="; + }; + + pythonImportsCheck = [ "fields" ]; + + meta = with lib; { + description = "Container class boilerplate killer"; + homepage = "https://github.com/ionelmc/python-fields"; + license = licenses.bsd2; + maintainers = [ maintainers.sheepforce ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 9916b8250e9c81..0403baa2c9d654 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2697,6 +2697,8 @@ in { fido2 = callPackage ../development/python-modules/fido2 { }; + fields = callPackage ../development/python-modules/fields { }; + filebrowser_safe = callPackage ../development/python-modules/filebrowser_safe { }; filebytes = callPackage ../development/python-modules/filebytes { }; From a6a5114653c90cf8a4bc779b219a0bb03a647061 Mon Sep 17 00:00:00 2001 From: sheepforce Date: Mon, 22 Nov 2021 12:24:38 +0100 Subject: [PATCH 4/6] python3.pkgs.polarizationsolver: init at 00424ac4 polarizationsolver: expose polyrizationsolver: formatting polarizationsolver: platforms polarizationsolver: platforms polarizationsolver: license polarizationsolver: remove redundant platform --- .../polarizationsolver/default.nix | 38 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 40 insertions(+) create mode 100644 pkgs/development/python-modules/polarizationsolver/default.nix diff --git a/pkgs/development/python-modules/polarizationsolver/default.nix b/pkgs/development/python-modules/polarizationsolver/default.nix new file mode 100644 index 00000000000000..c4710f6901ed77 --- /dev/null +++ b/pkgs/development/python-modules/polarizationsolver/default.nix @@ -0,0 +1,38 @@ +{ buildPythonPackage +, lib +, fetchFromGitLab +, python +, numpy +, scipy +, periodictable +, fields +}: + +buildPythonPackage rec { + pname = "polarizationsolver"; + version = "unstable-2021-11-02"; + + src = fetchFromGitLab { + owner = "reinholdt"; + repo = pname; + rev = "00424ac4d1862257a55e4b16543f63ace3fe8c22"; + sha256 = "sha256-LACf8Xw+o/uJ3+PD/DE/o7nwKY7fv3NyYbpjCrTTnBU="; + }; + + propagatedBuildInputs = [ + numpy + periodictable + scipy + ]; + + checkInputs = [ fields ]; + + pythonImportsCheck = [ "polarizationsolver" ]; + + meta = with lib; { + description = "Multipole moment solver for quantum chemistry and polarisable embedding"; + homepage = "https://gitlab.com/reinholdt/polarizationsolver"; + license = licenses.gpl3Plus; + maintainers = [ maintainers.sheepforce ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 0403baa2c9d654..b68fe9cec78d5a 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5931,6 +5931,8 @@ in { poezio = callPackage ../applications/networking/instant-messengers/poezio { }; + polarizationsolver = callPackage ../development/python-modules/polarizationsolver { }; + polib = callPackage ../development/python-modules/polib { }; policy-sentry = callPackage ../development/python-modules/policy-sentry { }; From 938a9e00c5b253bfb4e3d51c0b63cfc7a8253d24 Mon Sep 17 00:00:00 2001 From: Phillip Seeber Date: Wed, 10 Nov 2021 12:30:09 +0100 Subject: [PATCH 5/6] cppe: init at 0.3.1 cppe: move pytestCheckHook to checkInputs cppe: hash cppe: license and hash cppe: formatting python3.pkgs.cppe: more tests cppe: formatting cppe: formatting cppe: platforms cppe: platforms --- .../science/chemistry/cppe/default.nix | 25 ++++++++++ .../python-modules/cppe/default.nix | 47 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + pkgs/top-level/python-packages.nix | 4 ++ 4 files changed, 78 insertions(+) create mode 100644 pkgs/development/libraries/science/chemistry/cppe/default.nix create mode 100644 pkgs/development/python-modules/cppe/default.nix diff --git a/pkgs/development/libraries/science/chemistry/cppe/default.nix b/pkgs/development/libraries/science/chemistry/cppe/default.nix new file mode 100644 index 00000000000000..51083e5a2ae91f --- /dev/null +++ b/pkgs/development/libraries/science/chemistry/cppe/default.nix @@ -0,0 +1,25 @@ +{ stdenv, lib, fetchFromGitHub, cmake }: + +stdenv.mkDerivation rec { + pname = "cppe"; + version = "0.3.1"; + + src = fetchFromGitHub { + owner = "maxscheurer"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-guM7+ZWDJLcAUJtPkKLvC4LYSA2eBvER7cgwPZ7FxHw="; + }; + + nativeBuildInputs = [ cmake ]; + + cmakeFlags = [ "-DCMAKE_INSTALL_LIBDIR=lib" ]; + + meta = with lib; { + description = "C++ and Python library for Polarizable Embedding"; + homepage = "https://github.com/maxscheurer/cppe"; + license = licenses.lgpl3Only; + platforms = platforms.unix; + maintainers = [ maintainers.sheepforce ]; + }; +} diff --git a/pkgs/development/python-modules/cppe/default.nix b/pkgs/development/python-modules/cppe/default.nix new file mode 100644 index 00000000000000..df00bd8dd120d1 --- /dev/null +++ b/pkgs/development/python-modules/cppe/default.nix @@ -0,0 +1,47 @@ +{ buildPythonPackage +, lib +, cmake +, cppe +, eigen +, python +, pybind11 +, numpy +, h5py +, numba +, scipy +, pandas +, polarizationsolver +, pytest +}: + +buildPythonPackage rec { + inherit (cppe) pname version src meta; + + # The python interface requires eigen3, but builds from a checkout in tree. + # Using the nixpkgs version instead. + postPatch = '' + substituteInPlace setup.py \ + --replace "external/eigen3" "${eigen}/include/eigen3" + ''; + + nativeBuildInputs = [ + cmake + eigen + ]; + + dontUseCmakeConfigure = true; + + buildInputs = [ pybind11 ]; + + checkInputs = [ + pytest + h5py + numba + numpy + pandas + polarizationsolver + scipy + ]; + + pythonImportsCheck = [ "cppe" ]; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index eaf92ebfeffa30..ea1b8735653294 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15923,6 +15923,8 @@ with pkgs; ctpl = callPackage ../development/libraries/ctpl { }; + cppe = callPackage ../development/libraries/science/chemistry/cppe { }; + cppdb = callPackage ../development/libraries/cppdb { }; cpp-utilities = callPackage ../development/libraries/cpp-utilities { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b68fe9cec78d5a..d977580195e3ba 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1765,6 +1765,10 @@ in { cozy = callPackage ../development/python-modules/cozy { }; + cppe = callPackage ../development/python-modules/cppe { + cppe = pkgs.cppe; + }; + cppheaderparser = callPackage ../development/python-modules/cppheaderparser { }; cppy = callPackage ../development/python-modules/cppy { }; From 21ca2dec9ffcfb3bf8c1435eea443b999c7e5193 Mon Sep 17 00:00:00 2001 From: Phillip Seeber Date: Thu, 11 Nov 2021 22:31:47 +0100 Subject: [PATCH 6/6] pyscf: 1.7.6.post1 -> 2.0.1 pyscf: hash pyscf: limit test suite to single core pyscf: adapting test suite pyscf: fix pythonpath for tests pyscf: formatting pyscf: platforms remove log pyscf: enable uadc module pyscf: platforms pyscf: formatting pyscf: disable instable N3 CI test pyscf: formating pyscf: increase ulimit pyscf: ulimit files pyscf: remove ulimit -n --- .../python-modules/pyscf/default.nix | 90 ++++++++++++++++--- .../python-modules/pyscf/h5py.patch | 13 --- 2 files changed, 77 insertions(+), 26 deletions(-) delete mode 100644 pkgs/development/python-modules/pyscf/h5py.patch diff --git a/pkgs/development/python-modules/pyscf/default.nix b/pkgs/development/python-modules/pyscf/default.nix index 0be40b5dfe7c21..cf6f91e74f7dba 100644 --- a/pkgs/development/python-modules/pyscf/default.nix +++ b/pkgs/development/python-modules/pyscf/default.nix @@ -1,45 +1,109 @@ -{ buildPythonPackage, lib, fetchFromGitHub, libcint, libxc, xcfun, blas -, numpy, scipy, h5py +{ buildPythonPackage +, python3 +, lib +, fetchFromGitHub +, cmake +, blas +, libcint +, libxc +, xcfun +, cppe +, h5py +, numpy +, scipy +, nose +, nose-exclude }: buildPythonPackage rec { pname = "pyscf"; - version = "1.7.6.post1"; + version = "2.0.1"; src = fetchFromGitHub { owner = "pyscf"; repo = pname; - rev = "f6c9c6654dd9609c5e467a1edd5c2c076f793acc"; - sha256 = "0xbwkjxxysfpqz72qn6n4a0zr2h6sprbcal8j7kzymh7swjy117w"; + rev = "v${version}"; + sha256 = "sha256-nwnhaqSn/9WHBjUPaEabK4x23fJ83WwEYvz6aCcvsDw="; }; - # Backport from the 2.0.0 alpha releases of PySCF. - # H5Py > 3.3 deprecates the file modes, that PySCF sets. - patches = [ ./h5py.patch ]; + # setup.py calls Cmake and passes the arguments in CMAKE_CONFIGURE_ARGS to cmake. + nativeBuildInputs = [ cmake ]; + dontUseCmakeConfigure = true; + preConfigure = '' + export CMAKE_CONFIGURE_ARGS="-DBUILD_LIBCINT=0 -DBUILD_LIBXC=0 -DBUILD_XCFUN=0" + PYSCF_INC_DIR="${libcint}:${libxc}:${xcfun}"; + ''; buildInputs = [ + blas libcint libxc xcfun - blas ]; propagatedBuildInputs = [ + cppe + h5py numpy scipy - h5py ]; - PYSCF_INC_DIR="${libcint}:${libxc}:${xcfun}"; + checkInputs = [ nose nose-exclude ]; - doCheck = false; pythonImportsCheck = [ "pyscf" ]; + preCheck = '' + # Set config used by tests to ensure reproducibility + echo 'pbc_tools_pbc_fft_engine = "NUMPY"' > pyscf/pyscf_config.py + export OMP_NUM_THREADS=1 + ulimit -s 20000 + export PYSCF_CONFIG_FILE=$(pwd)/pyscf/pyscf_config.py + ''; + # As defined for the PySCF CI at https://github.com/pyscf/pyscf/blob/master/.github/workflows/run_tests.sh + # minus some additionally numerically instable tests, that are sensitive to BLAS, FFTW, etc. + checkPhase = '' + runHook preCheck + + nosetests pyscf/ -v \ + --exclude-dir=examples --exclude-dir=pyscf/pbc/grad \ + --exclude-dir=pyscf/x2c \ + --exclude-dir=pyscf/pbc/tdscf \ + -e test_bz \ + -e h2o_vdz \ + -e test_mc2step_4o4e \ + -e test_ks_noimport \ + -e test_jk_hermi0 \ + -e test_j_kpts \ + -e test_k_kpts \ + -e high_cost \ + -e skip \ + -e call_in_background \ + -e libxc_cam_beta_bug \ + -e test_finite_diff_rks_eph \ + -e test_finite_diff_uks_eph \ + -e test_pipek \ + -e test_n3_cis_ewald \ + -I test_kuccsd_supercell_vs_kpts\.py \ + -I test_kccsd_ghf\.py \ + -I test_h_.*\.py \ + --exclude-test=pyscf/pbc/gw/test/test_kgw_slow_supercell.DiamondTestSupercell3 \ + --exclude-test=pyscf/pbc/gw/test/test_kgw_slow_supercell.DiamondKSTestSupercell3 \ + --exclude-test=pyscf/pbc/gw/test/test_kgw_slow.DiamondTestSupercell3 \ + --exclude-test=pyscf/pbc/gw/test/test_kgw_slow.DiamondKSTestSupercell3 \ + --exclude-test=pyscf/pbc/tdscf/test/test_krhf_slow_supercell.DiamondTestSupercell3 \ + --exclude-test=pyscf/pbc/tdscf/test/test_kproxy_hf.DiamondTestSupercell3 \ + --exclude-test=pyscf/pbc/tdscf/test/test_kproxy_ks.DiamondTestSupercell3 \ + --exclude-test=pyscf/pbc/tdscf/test/test_kproxy_supercell_hf.DiamondTestSupercell3 \ + --exclude-test=pyscf/pbc/tdscf/test/test_kproxy_supercell_ks.DiamondTestSupercell3 \ + -I .*_slow.*py -I .*_kproxy_.*py -I test_proxy.py tdscf/*_slow.py gw/*_slow.py + + runHook postCheck + ''; meta = with lib; { description = "Python-based simulations of chemistry framework"; homepage = "https://github.com/pyscf/pyscf"; license = licenses.asl20; - platforms = platforms.linux; + platforms = platforms.unix; maintainers = [ maintainers.sheepforce ]; }; } diff --git a/pkgs/development/python-modules/pyscf/h5py.patch b/pkgs/development/python-modules/pyscf/h5py.patch deleted file mode 100644 index 160128633208b0..00000000000000 --- a/pkgs/development/python-modules/pyscf/h5py.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/pyscf/lib/misc.py b/pyscf/lib/misc.py -index ed43689ff..a8a0d0e20 100644 ---- a/pyscf/lib/misc.py -+++ b/pyscf/lib/misc.py -@@ -42,8 +42,6 @@ if h5py.version.version[:4] == '2.2.': - sys.stderr.write('h5py-%s is found in your environment. ' - 'h5py-%s has bug in threading mode.\n' - 'Async-IO is disabled.\n' % ((h5py.version.version,)*2)) --if h5py.version.version[:2] == '3.': -- h5py.get_config().default_file_mode = 'a' - - c_double_p = ctypes.POINTER(ctypes.c_double) - c_int_p = ctypes.POINTER(ctypes.c_int)