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.5.0";
20 format = "setuptools";
21
22 src = fetchFromGitHub {
23 owner = "pyscf";
24 repo = pname;
25 rev = "refs/tags/v${version}";
26 hash = "sha256-UCchzoYsqeIGViewPf4KedmhYktXLmp5Me4lzb1i8p0=";
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 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 ];
90
91 pytestFlagsArray = [
92 "--ignore=pyscf/pbc/tdscf"
93 "--ignore=pyscf/pbc/gw"
94 "--ignore-glob=*_slow.*py"
95 "--ignore-glob=*_kproxy_.*py"
96 "--ignore-glob=test_proxy.py"
97 ];
98
99 meta = with lib; {
100 description = "Python-based simulations of chemistry framework";
101 homepage = "https://github.com/pyscf/pyscf";
102 license = licenses.asl20;
103 platforms = [
104 "x86_64-linux"
105 "x86_64-darwin"
106 ];
107 maintainers = [ maintainers.sheepforce ];
108 };
109}