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