2021-12-06 16:07:01 +00:00
|
|
|
{ buildPythonPackage
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
2022-10-30 15:09:59 +00:00
|
|
|
, fetchpatch
|
2021-12-06 16:07:01 +00:00
|
|
|
, cmake
|
|
|
|
, blas
|
|
|
|
, libcint
|
|
|
|
, libxc
|
|
|
|
, xcfun
|
|
|
|
, cppe
|
|
|
|
, h5py
|
|
|
|
, numpy
|
|
|
|
, scipy
|
|
|
|
, nose
|
|
|
|
, nose-exclude
|
2021-06-28 23:13:55 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pyscf";
|
2022-10-21 18:38:19 +00:00
|
|
|
version = "2.1.1";
|
2021-06-28 23:13:55 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pyscf";
|
|
|
|
repo = pname;
|
2021-12-06 16:07:01 +00:00
|
|
|
rev = "v${version}";
|
2022-10-21 18:38:19 +00:00
|
|
|
hash = "sha256-KMxwyAK00Zc0i76zWTMznfXQCVCt+4HOH8SlwuOCORk=";
|
2021-06-28 23:13:55 +00:00
|
|
|
};
|
|
|
|
|
2022-10-30 15:09:59 +00:00
|
|
|
patches = [ (fetchpatch {
|
|
|
|
name = "libxc-6"; # https://github.com/pyscf/pyscf/pull/1467
|
|
|
|
url = "https://github.com/pyscf/pyscf/commit/ebcfacc90e119cd7f9dcdbf0076a84660349fc79.patch";
|
|
|
|
sha256 = "sha256-O+eDlUKJeThxQcHrMGqxjDfRCmCNP+OCgv/L72jAF/o=";
|
|
|
|
})];
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# 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}";
|
|
|
|
'';
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
buildInputs = [
|
2021-12-06 16:07:01 +00:00
|
|
|
blas
|
2021-06-28 23:13:55 +00:00
|
|
|
libcint
|
|
|
|
libxc
|
|
|
|
xcfun
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2021-12-06 16:07:01 +00:00
|
|
|
cppe
|
|
|
|
h5py
|
2021-06-28 23:13:55 +00:00
|
|
|
numpy
|
|
|
|
scipy
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ nose nose-exclude ];
|
2021-06-28 23:13:55 +00:00
|
|
|
|
|
|
|
pythonImportsCheck = [ "pyscf" ];
|
2021-12-06 16:07:01 +00:00
|
|
|
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 \
|
2021-12-19 01:06:50 +00:00
|
|
|
--exclude-dir=pyscf/adc \
|
2021-12-06 16:07:01 +00:00
|
|
|
--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 \
|
2022-10-21 18:38:19 +00:00
|
|
|
-e test_lda \
|
2021-12-06 16:07:01 +00:00
|
|
|
-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
|
|
|
|
'';
|
2021-06-28 23:13:55 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python-based simulations of chemistry framework";
|
|
|
|
homepage = "https://github.com/pyscf/pyscf";
|
|
|
|
license = licenses.asl20;
|
2021-12-19 01:06:50 +00:00
|
|
|
platforms = [ "x86_64-linux" "x86_64-darwin" ];
|
2021-06-28 23:13:55 +00:00
|
|
|
maintainers = [ maintainers.sheepforce ];
|
|
|
|
};
|
|
|
|
}
|