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