1{
2 buildPythonPackage,
3 lib,
4 fetchFromGitHub,
5 cmake,
6 blas,
7 libcint,
8 libxc,
9 xcfun,
10 cppe,
11 h5py,
12 numpy,
13 scipy,
14 pytestCheckHook,
15}:
16
17buildPythonPackage rec {
18 pname = "pyscf";
19 version = "2.9.0";
20 format = "setuptools";
21
22 src = fetchFromGitHub {
23 owner = "pyscf";
24 repo = pname;
25 tag = "v${version}";
26 hash = "sha256-UTeZXlNuSWDOcBRVbUUWJ3mQnZZQr17aTw6rRA5DRNI=";
27 };
28
29 # setup.py calls Cmake and passes the arguments in CMAKE_CONFIGURE_ARGS to cmake.
30 build-system = [ 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 dependencies = [
45 cppe
46 h5py
47 numpy
48 scipy
49 ];
50
51 nativeCheckInputs = [ pytestCheckHook ];
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
61 # Numerically slightly off tests
62 disabledTests = [
63 "test_tdhf_singlet"
64 "test_ab_hf"
65 "test_ea"
66 "test_bz"
67 "h2o_vdz"
68 "test_mc2step_4o4e"
69 "test_ks_noimport"
70 "test_jk_hermi0"
71 "test_j_kpts"
72 "test_k_kpts"
73 "test_lda"
74 "high_cost"
75 "skip"
76 "call_in_background"
77 "libxc_cam_beta_bug"
78 "test_finite_diff_rks_eph"
79 "test_finite_diff_uks_eph"
80 "test_finite_diff_roks_grad"
81 "test_finite_diff_df_roks_grad"
82 "test_frac_particles"
83 "test_nosymm_sa4_newton"
84 "test_pipek"
85 "test_n3_cis_ewald"
86 "test_veff"
87 "test_collinear_kgks_gga"
88 "test_libxc_gga_deriv4"
89 "test_sacasscf_grad"
90 ];
91
92 pytestFlagsArray = [
93 "--ignore=pyscf/pbc/tdscf"
94 "--ignore=pyscf/pbc/gw"
95 "--ignore-glob=*_slow.*py"
96 "--ignore-glob=*_kproxy_.*py"
97 "--ignore-glob=test_proxy.py"
98 "--ignore-glob=pyscf/nac/test/test_sacasscf.py"
99 "--ignore-glob=pyscf/grad/test/test_casscf.py"
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 = [
107 "x86_64-linux"
108 "x86_64-darwin"
109 ];
110 maintainers = [ maintainers.sheepforce ];
111 };
112}