1{
2 buildPythonPackage,
3 lib,
4 fetchFromGitHub,
5
6 # build-sysetm
7 cmake,
8
9 # build inputs
10 blas,
11 libcint,
12 libxc,
13 xcfun,
14
15 # dependencies
16 cppe,
17 h5py,
18 numpy,
19 scipy,
20
21 # tests
22 pytestCheckHook,
23}:
24
25buildPythonPackage rec {
26 pname = "pyscf";
27 version = "2.10.0";
28 format = "setuptools";
29
30 src = fetchFromGitHub {
31 owner = "pyscf";
32 repo = "pyscf";
33 tag = "v${version}";
34 hash = "sha256-lFYSWCe5THlivpBB6nFBR2zfCIKJ0YJeuY2rCKoXUq8=";
35 };
36
37 # setup.py calls Cmake and passes the arguments in CMAKE_CONFIGURE_ARGS to cmake.
38 build-system = [ cmake ];
39 dontUseCmakeConfigure = true;
40 preConfigure = ''
41 export CMAKE_CONFIGURE_ARGS="-DBUILD_LIBCINT=0 -DBUILD_LIBXC=0 -DBUILD_XCFUN=0"
42 PYSCF_INC_DIR="${libcint}:${libxc}:${xcfun}";
43 '';
44
45 buildInputs = [
46 blas
47 libcint
48 libxc
49 xcfun
50 ];
51
52 dependencies = [
53 cppe
54 h5py
55 numpy
56 scipy
57 ];
58
59 nativeCheckInputs = [ pytestCheckHook ];
60 pythonImportsCheck = [ "pyscf" ];
61 preCheck = ''
62 # Set config used by tests to ensure reproducibility
63 echo 'pbc_tools_pbc_fft_engine = "NUMPY"' > pyscf/pyscf_config.py
64 export OMP_NUM_THREADS=1
65 ulimit -s 20000
66 export PYSCF_CONFIG_FILE=$(pwd)/pyscf/pyscf_config.py
67 '';
68
69 # Numerically slightly off tests
70 disabledTests = [
71 "test_rdm_trace"
72 "test_tdhf_singlet"
73 "test_ab_hf"
74 "test_ea"
75 "test_bz"
76 "h2o_vdz"
77 "test_mc2step_4o4e"
78 "test_ks_noimport"
79 "test_jk_hermi0"
80 "test_j_kpts"
81 "test_k_kpts"
82 "test_lda"
83 "high_cost"
84 "skip"
85 "call_in_background"
86 "libxc_cam_beta_bug"
87 "test_finite_diff_rks_eph"
88 "test_finite_diff_uks_eph"
89 "test_finite_diff_roks_grad"
90 "test_finite_diff_df_roks_grad"
91 "test_frac_particles"
92 "test_nosymm_sa4_newton"
93 "test_pipek"
94 "test_n3_cis_ewald"
95 "test_veff"
96 "test_collinear_kgks_gga"
97 "test_libxc_gga_deriv4"
98 "test_sacasscf_grad"
99 ];
100
101 disabledTestPaths = [
102 "pyscf/pbc/tdscf"
103 "pyscf/pbc/gw"
104 "pyscf/nac/test/test_sacasscf.py"
105 "pyscf/grad/test/test_casscf.py"
106 ];
107
108 meta = {
109 description = "Python-based simulations of chemistry framework";
110 homepage = "https://github.com/pyscf/pyscf";
111 license = lib.licenses.asl20;
112 platforms = [
113 "x86_64-linux"
114 "x86_64-darwin"
115 "aarch64-darwin"
116 ];
117 maintainers = [ lib.maintainers.sheepforce ];
118 };
119}