1{ buildPythonPackage
2, lib
3, fetchFromGitHub
4, cmake
5, blas
6, libcint
7, libxc
8, xcfun
9, cppe
10, h5py
11, numpy
12, scipy
13, nose
14, nose-exclude
15}:
16
17buildPythonPackage rec {
18 pname = "pyscf";
19 version = "2.2.0";
20
21 src = fetchFromGitHub {
22 owner = "pyscf";
23 repo = pname;
24 rev = "v${version}";
25 hash = "sha256-3ylFz5j176hBQLklLmVKltE8whynzojsoBEWjEL2M14=";
26 };
27
28 # setup.py calls Cmake and passes the arguments in CMAKE_CONFIGURE_ARGS to cmake.
29 nativeBuildInputs = [ cmake ];
30 dontUseCmakeConfigure = true;
31 preConfigure = ''
32 export CMAKE_CONFIGURE_ARGS="-DBUILD_LIBCINT=0 -DBUILD_LIBXC=0 -DBUILD_XCFUN=0"
33 PYSCF_INC_DIR="${libcint}:${libxc}:${xcfun}";
34 '';
35
36 buildInputs = [
37 blas
38 libcint
39 libxc
40 xcfun
41 ];
42
43 propagatedBuildInputs = [
44 cppe
45 h5py
46 numpy
47 scipy
48 ];
49
50 nativeCheckInputs = [ nose nose-exclude ];
51
52 pythonImportsCheck = [ "pyscf" ];
53 preCheck = ''
54 # Set config used by tests to ensure reproducibility
55 echo 'pbc_tools_pbc_fft_engine = "NUMPY"' > pyscf/pyscf_config.py
56 export OMP_NUM_THREADS=1
57 ulimit -s 20000
58 export PYSCF_CONFIG_FILE=$(pwd)/pyscf/pyscf_config.py
59 '';
60 # As defined for the PySCF CI at https://github.com/pyscf/pyscf/blob/master/.github/workflows/run_tests.sh
61 # minus some additionally numerically instable tests, that are sensitive to BLAS, FFTW, etc.
62 checkPhase = ''
63 runHook preCheck
64
65 nosetests pyscf/ -v \
66 --exclude-dir=examples --exclude-dir=pyscf/pbc/grad \
67 --exclude-dir=pyscf/x2c \
68 --exclude-dir=pyscf/adc \
69 --exclude-dir=pyscf/pbc/tdscf \
70 -e test_bz \
71 -e h2o_vdz \
72 -e test_mc2step_4o4e \
73 -e test_ks_noimport \
74 -e test_jk_hermi0 \
75 -e test_j_kpts \
76 -e test_k_kpts \
77 -e test_lda \
78 -e high_cost \
79 -e skip \
80 -e call_in_background \
81 -e libxc_cam_beta_bug \
82 -e test_finite_diff_rks_eph \
83 -e test_finite_diff_uks_eph \
84 -e test_pipek \
85 -e test_n3_cis_ewald \
86 -e test_veff \
87 -I test_kuccsd_supercell_vs_kpts\.py \
88 -I test_kccsd_ghf\.py \
89 -I test_h_.*\.py \
90 --exclude-test=pyscf/pbc/gw/test/test_kgw_slow_supercell.DiamondTestSupercell3 \
91 --exclude-test=pyscf/pbc/gw/test/test_kgw_slow_supercell.DiamondKSTestSupercell3 \
92 --exclude-test=pyscf/pbc/gw/test/test_kgw_slow.DiamondTestSupercell3 \
93 --exclude-test=pyscf/pbc/gw/test/test_kgw_slow.DiamondKSTestSupercell3 \
94 --exclude-test=pyscf/pbc/tdscf/test/test_krhf_slow_supercell.DiamondTestSupercell3 \
95 --exclude-test=pyscf/pbc/tdscf/test/test_kproxy_hf.DiamondTestSupercell3 \
96 --exclude-test=pyscf/pbc/tdscf/test/test_kproxy_ks.DiamondTestSupercell3 \
97 --exclude-test=pyscf/pbc/tdscf/test/test_kproxy_supercell_hf.DiamondTestSupercell3 \
98 --exclude-test=pyscf/pbc/tdscf/test/test_kproxy_supercell_ks.DiamondTestSupercell3 \
99 -I .*_slow.*py -I .*_kproxy_.*py -I test_proxy.py tdscf/*_slow.py gw/*_slow.py
100
101 runHook postCheck
102 '';
103
104 meta = with lib; {
105 description = "Python-based simulations of chemistry framework";
106 homepage = "https://github.com/pyscf/pyscf";
107 license = licenses.asl20;
108 platforms = [ "x86_64-linux" "x86_64-darwin" ];
109 maintainers = [ maintainers.sheepforce ];
110 };
111}