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, pytestCheckHook
14}:
15
16buildPythonPackage rec {
17 pname = "pyscf";
18 version = "2.4.0";
19
20 src = fetchFromGitHub {
21 owner = "pyscf";
22 repo = pname;
23 rev = "v${version}";
24 hash = "sha256-+dZsXiLqqyRWr1eOEVSHZ1KMM760hrDaT07ylZUcGmo=";
25 };
26
27 # setup.py calls Cmake and passes the arguments in CMAKE_CONFIGURE_ARGS to cmake.
28 nativeBuildInputs = [ cmake ];
29 dontUseCmakeConfigure = true;
30 preConfigure = ''
31 export CMAKE_CONFIGURE_ARGS="-DBUILD_LIBCINT=0 -DBUILD_LIBXC=0 -DBUILD_XCFUN=0"
32 PYSCF_INC_DIR="${libcint}:${libxc}:${xcfun}";
33 '';
34
35 buildInputs = [
36 blas
37 libcint
38 libxc
39 xcfun
40 ];
41
42 propagatedBuildInputs = [
43 cppe
44 h5py
45 numpy
46 scipy
47 ];
48
49 nativeCheckInputs = [ pytestCheckHook ];
50 pythonImportsCheck = [ "pyscf" ];
51 preCheck = ''
52 # Set config used by tests to ensure reproducibility
53 echo 'pbc_tools_pbc_fft_engine = "NUMPY"' > pyscf/pyscf_config.py
54 export OMP_NUM_THREADS=1
55 ulimit -s 20000
56 export PYSCF_CONFIG_FILE=$(pwd)/pyscf/pyscf_config.py
57 '';
58
59 # Numerically slightly off tests
60 disabledTests = [
61 "test_tdhf_singlet"
62 "test_ab_hf"
63 "test_ea"
64 "test_bz"
65 "h2o_vdz"
66 "test_mc2step_4o4e"
67 "test_ks_noimport"
68 "test_jk_hermi0"
69 "test_j_kpts"
70 "test_k_kpts"
71 "test_lda"
72 "high_cost"
73 "skip"
74 "call_in_background"
75 "libxc_cam_beta_bug"
76 "test_finite_diff_rks_eph"
77 "test_finite_diff_uks_eph"
78 "test_finite_diff_roks_grad"
79 "test_finite_diff_df_roks_grad"
80 "test_frac_particles"
81 "test_nosymm_sa4_newton"
82 "test_pipek"
83 "test_n3_cis_ewald"
84 "test_veff"
85 "test_collinear_kgks_gga"
86 ];
87
88 pytestFlagsArray = [
89 "--ignore=pyscf/pbc/tdscf"
90 "--ignore=pyscf/pbc/gw"
91 "--ignore-glob=*_slow.*py"
92 "--ignore-glob=*_kproxy_.*py"
93 "--ignore-glob=test_proxy.py"
94 ];
95
96 meta = with lib; {
97 description = "Python-based simulations of chemistry framework";
98 homepage = "https://github.com/pyscf/pyscf";
99 license = licenses.asl20;
100 platforms = [ "x86_64-linux" "x86_64-darwin" ];
101 maintainers = [ maintainers.sheepforce ];
102 };
103}