pyscf 2.6.2__py3-none-macosx_11_0_arm64.whl → 2.7.0__py3-none-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. pyscf/__init__.py +2 -2
  2. pyscf/adc/__init__.py +3 -8
  3. pyscf/adc/dfadc.py +22 -6
  4. pyscf/adc/radc.py +106 -15
  5. pyscf/adc/radc_amplitudes.py +7 -1
  6. pyscf/adc/radc_ao2mo.py +4 -2
  7. pyscf/adc/radc_ea.py +524 -8
  8. pyscf/adc/radc_ip.py +492 -60
  9. pyscf/adc/radc_ip_cvs.py +4 -2
  10. pyscf/adc/uadc.py +116 -27
  11. pyscf/adc/uadc_amplitudes.py +215 -20
  12. pyscf/adc/uadc_ao2mo.py +30 -9
  13. pyscf/adc/uadc_ea.py +34 -44
  14. pyscf/adc/uadc_ip.py +9 -4
  15. pyscf/adc/uadc_ip_cvs.py +4 -1
  16. pyscf/agf2/__init__.py +2 -2
  17. pyscf/agf2/aux_space.py +1 -1
  18. pyscf/agf2/chkfile.py +1 -1
  19. pyscf/ao2mo/outcore.py +6 -4
  20. pyscf/cc/__init__.py +21 -3
  21. pyscf/cc/bccd.py +0 -46
  22. pyscf/cc/ccsd.py +16 -8
  23. pyscf/cc/uccsd.py +1 -1
  24. pyscf/data/elements.py +1 -1
  25. pyscf/df/__init__.py +2 -1
  26. pyscf/df/addons.py +79 -51
  27. pyscf/df/autoaux.py +191 -0
  28. pyscf/df/df.py +5 -1
  29. pyscf/df/grad/casscf.py +0 -41
  30. pyscf/df/hessian/rhf.py +2 -10
  31. pyscf/df/hessian/rks.py +1 -7
  32. pyscf/df/hessian/uhf.py +3 -13
  33. pyscf/df/hessian/uks.py +1 -8
  34. pyscf/df/incore.py +17 -5
  35. pyscf/dft/dks.py +1 -1
  36. pyscf/dft/libxc.py +65 -639
  37. pyscf/dft/numint.py +7 -3
  38. pyscf/dft/radi.py +39 -5
  39. pyscf/dft/rks.py +1 -1
  40. pyscf/dft/xc_deriv.py +1 -1
  41. pyscf/dft/xcfun.py +53 -2
  42. pyscf/eph/eph_fd.py +1 -1
  43. pyscf/eph/rhf.py +6 -36
  44. pyscf/eph/rks.py +0 -4
  45. pyscf/eph/uhf.py +1 -7
  46. pyscf/eph/uks.py +1 -7
  47. pyscf/fci/addons.py +117 -2
  48. pyscf/fci/cistring.py +1 -1
  49. pyscf/fci/direct_nosym.py +3 -3
  50. pyscf/fci/direct_spin0_symm.py +22 -43
  51. pyscf/fci/direct_spin1.py +65 -9
  52. pyscf/fci/direct_spin1_symm.py +49 -14
  53. pyscf/fci/direct_uhf.py +4 -4
  54. pyscf/fci/selected_ci_symm.py +1 -1
  55. pyscf/grad/lagrange.py +11 -3
  56. pyscf/grad/mp2.py +1 -1
  57. pyscf/grad/sacasscf.py +1 -1
  58. pyscf/grad/tdrks.py +1 -1
  59. pyscf/gto/basis/__init__.py +7 -0
  60. pyscf/gto/basis/bse.py +68 -15
  61. pyscf/gto/basis/parse_cp2k_pp.py +1 -1
  62. pyscf/gto/basis/parse_nwchem.py +1 -1
  63. pyscf/gto/basis/parse_nwchem_ecp.py +2 -1
  64. pyscf/gto/basis/sap_grasp_large.dat +2438 -0
  65. pyscf/gto/basis/sap_grasp_small.dat +1434 -0
  66. pyscf/gto/mole.py +99 -44
  67. pyscf/gw/gw_ac.py +2 -2
  68. pyscf/gw/gw_cd.py +2 -2
  69. pyscf/gw/rpa.py +2 -2
  70. pyscf/gw/ugw_ac.py +2 -2
  71. pyscf/gw/urpa.py +1 -1
  72. pyscf/hessian/rhf.py +30 -128
  73. pyscf/hessian/rks.py +1 -6
  74. pyscf/hessian/uhf.py +28 -138
  75. pyscf/hessian/uks.py +1 -8
  76. pyscf/lib/ao2mo/nr_ao2mo.c +1 -1
  77. pyscf/lib/ao2mo/nrr_ao2mo.c +1 -1
  78. pyscf/lib/ao2mo/r_ao2mo.c +1 -1
  79. pyscf/lib/cc/ccsd_pack.c +1 -1
  80. pyscf/lib/cc/ccsd_t.c +6 -6
  81. pyscf/lib/cc/uccsd_t.c +4 -4
  82. pyscf/lib/deps/include/XCFun/XCFunExport.h +1 -0
  83. pyscf/lib/dft/grid_common.c +1 -1
  84. pyscf/lib/dft/libxc_itrf.c +4 -1
  85. pyscf/lib/dft/xcfun_itrf.c +1 -1
  86. pyscf/lib/diis.py +1 -1
  87. pyscf/lib/exceptions.py +3 -0
  88. pyscf/lib/gto/fill_grids_int2c.c +11 -9
  89. pyscf/lib/gto/fill_int2e.c +7 -5
  90. pyscf/lib/gto/fill_r_4c.c +1 -1
  91. pyscf/lib/gto/ft_ao.c +1 -1
  92. pyscf/lib/gto/ft_ao.h +1 -1
  93. pyscf/lib/gto/gto.h +2 -2
  94. pyscf/lib/gto/nr_ecp.c +3 -2
  95. pyscf/lib/libagf2.dylib +0 -0
  96. pyscf/lib/libao2mo.dylib +0 -0
  97. pyscf/lib/libcc.dylib +0 -0
  98. pyscf/lib/libcgto.dylib +0 -0
  99. pyscf/lib/libcvhf.dylib +0 -0
  100. pyscf/lib/libdft.dylib +0 -0
  101. pyscf/lib/libfci.dylib +0 -0
  102. pyscf/lib/libmcscf.dylib +0 -0
  103. pyscf/lib/libnp_helper.dylib +0 -0
  104. pyscf/lib/libpbc.dylib +0 -0
  105. pyscf/lib/libri.dylib +0 -0
  106. pyscf/lib/libxc_itrf.dylib +0 -0
  107. pyscf/lib/libxcfun_itrf.dylib +0 -0
  108. pyscf/lib/linalg_helper.py +112 -192
  109. pyscf/lib/mcscf/fci_contract.c +2 -2
  110. pyscf/lib/misc.py +47 -14
  111. pyscf/lib/numpy_helper.py +1 -1
  112. pyscf/lib/pbc/nr_ecp.c +10 -3
  113. pyscf/lib/pbc/pbc.h +1 -1
  114. pyscf/lib/vhf/nr_sgx_direct.c +8 -6
  115. pyscf/lib/vhf/optimizer.c +2 -2
  116. pyscf/lo/iao.py +1 -1
  117. pyscf/lo/ibo.py +3 -3
  118. pyscf/lo/pipek_jacobi.py +1 -1
  119. pyscf/mcscf/__init__.py +2 -2
  120. pyscf/mcscf/addons.py +3 -3
  121. pyscf/mcscf/apc.py +2 -2
  122. pyscf/mcscf/casci.py +8 -6
  123. pyscf/mcscf/chkfile.py +70 -41
  124. pyscf/mcscf/dmet_cas.py +2 -2
  125. pyscf/mcscf/mc1step.py +62 -38
  126. pyscf/mcscf/newton_casscf.py +5 -5
  127. pyscf/mcscf/ucasci.py +1 -1
  128. pyscf/mcscf/umc1step.py +44 -25
  129. pyscf/md/integrators.py +3 -3
  130. pyscf/mp/mp2.py +6 -5
  131. pyscf/mp/ump2.py +7 -6
  132. pyscf/pbc/adc/kadc_rhf.py +1 -1
  133. pyscf/pbc/adc/kadc_rhf_amplitudes.py +2 -2
  134. pyscf/pbc/ao2mo/eris.py +1 -1
  135. pyscf/pbc/cc/kccsd_rhf.py +3 -3
  136. pyscf/pbc/cc/kccsd_t_rhf.py +2 -2
  137. pyscf/pbc/ci/kcis_rhf.py +2 -2
  138. pyscf/pbc/df/aft.py +2 -2
  139. pyscf/pbc/df/aft_ao2mo.py +1 -1
  140. pyscf/pbc/df/df.py +84 -11
  141. pyscf/pbc/df/df_jk.py +2 -1
  142. pyscf/pbc/df/fft.py +6 -2
  143. pyscf/pbc/df/fft_ao2mo.py +4 -0
  144. pyscf/pbc/df/fft_jk.py +11 -3
  145. pyscf/pbc/df/ft_ao.py +4 -3
  146. pyscf/pbc/df/gdf_builder.py +5 -4
  147. pyscf/pbc/df/incore.py +1 -1
  148. pyscf/pbc/df/mdf.py +6 -3
  149. pyscf/pbc/df/rsdf.py +2 -2
  150. pyscf/pbc/df/rsdf_builder.py +11 -6
  151. pyscf/pbc/df/rsdf_helper.py +1 -1
  152. pyscf/pbc/dft/cdft.py +5 -5
  153. pyscf/pbc/dft/multigrid/multigrid.py +19 -26
  154. pyscf/pbc/dft/multigrid/multigrid_pair.py +1 -1
  155. pyscf/pbc/dft/multigrid/pp.py +1 -1
  156. pyscf/pbc/dft/numint.py +30 -21
  157. pyscf/pbc/eph/eph_fd.py +1 -1
  158. pyscf/pbc/geomopt/geometric_solver.py +1 -1
  159. pyscf/pbc/gto/cell.py +37 -19
  160. pyscf/pbc/gto/ecp.py +12 -12
  161. pyscf/pbc/gto/eval_gto.py +2 -2
  162. pyscf/pbc/gto/pseudo/pp.py +1 -1
  163. pyscf/pbc/gw/krgw_ac.py +4 -4
  164. pyscf/pbc/gw/krgw_cd.py +4 -4
  165. pyscf/pbc/gw/kugw_ac.py +3 -3
  166. pyscf/pbc/lib/kpts_helper.py +4 -3
  167. pyscf/pbc/lib/linalg_helper.py +1 -1
  168. pyscf/pbc/mp/kmp2.py +1 -1
  169. pyscf/pbc/mpitools/mpi.py +1 -1
  170. pyscf/pbc/scf/addons.py +15 -11
  171. pyscf/pbc/scf/cphf.py +1 -1
  172. pyscf/pbc/scf/ghf.py +1 -1
  173. pyscf/pbc/scf/hf.py +21 -24
  174. pyscf/pbc/scf/kghf.py +33 -29
  175. pyscf/pbc/scf/khf.py +71 -26
  176. pyscf/pbc/scf/krohf.py +5 -7
  177. pyscf/pbc/scf/kuhf.py +53 -22
  178. pyscf/pbc/scf/rsjk.py +13 -9
  179. pyscf/pbc/scf/scfint.py +1 -1
  180. pyscf/pbc/scf/stability.py +1 -1
  181. pyscf/pbc/scf/uhf.py +3 -1
  182. pyscf/pbc/symm/symmetry.py +2 -2
  183. pyscf/pbc/tdscf/kproxy.py +1 -1
  184. pyscf/pbc/tdscf/kproxy_supercell.py +2 -2
  185. pyscf/pbc/tdscf/krhf.py +215 -133
  186. pyscf/pbc/tdscf/krhf_slow_supercell.py +1 -1
  187. pyscf/pbc/tdscf/krks.py +1 -45
  188. pyscf/pbc/tdscf/kuhf.py +58 -105
  189. pyscf/pbc/tdscf/kuks.py +0 -56
  190. pyscf/pbc/tdscf/proxy.py +1 -1
  191. pyscf/pbc/tdscf/rhf.py +111 -3
  192. pyscf/pbc/tdscf/rks.py +2 -1
  193. pyscf/pbc/tdscf/uhf.py +203 -1
  194. pyscf/pbc/tdscf/uks.py +2 -1
  195. pyscf/pbc/tools/k2gamma.py +7 -4
  196. pyscf/pbc/tools/pbc.py +63 -56
  197. pyscf/pbc/tools/pyscf_ase.py +0 -1
  198. pyscf/pbc/tools/pywannier90.py +1 -1
  199. pyscf/qmmm/mm_mole.py +1 -1
  200. pyscf/scf/_response_functions.py +2 -2
  201. pyscf/scf/_vhf.py +14 -10
  202. pyscf/scf/addons.py +29 -15
  203. pyscf/scf/cphf.py +14 -52
  204. pyscf/scf/dhf.py +39 -10
  205. pyscf/scf/dispersion.py +9 -8
  206. pyscf/scf/ghf.py +25 -13
  207. pyscf/scf/ghf_symm.py +2 -2
  208. pyscf/scf/hf.py +245 -29
  209. pyscf/scf/rohf.py +37 -5
  210. pyscf/scf/stability.py +142 -112
  211. pyscf/scf/ucphf.py +21 -16
  212. pyscf/scf/uhf.py +95 -58
  213. pyscf/sgx/sgx.py +1 -1
  214. pyscf/sgx/sgx_jk.py +4 -4
  215. pyscf/solvent/_ddcosmo_tdscf_grad.py +1 -1
  216. pyscf/solvent/ddcosmo.py +1 -1
  217. pyscf/solvent/pol_embed.py +1 -1
  218. pyscf/soscf/ciah.py +1 -1
  219. pyscf/soscf/newton_ah.py +1 -1
  220. pyscf/symm/__init__.py +1 -1
  221. pyscf/symm/addons.py +5 -5
  222. pyscf/tdscf/_lr_eig.py +505 -0
  223. pyscf/tdscf/common_slow.py +1 -1
  224. pyscf/tdscf/dhf.py +41 -37
  225. pyscf/tdscf/dks.py +0 -4
  226. pyscf/tdscf/ghf.py +91 -71
  227. pyscf/tdscf/gks.py +16 -16
  228. pyscf/tdscf/proxy.py +2 -2
  229. pyscf/tdscf/rhf.py +143 -96
  230. pyscf/tdscf/rks.py +15 -14
  231. pyscf/tdscf/uhf.py +117 -70
  232. pyscf/tdscf/uks.py +17 -18
  233. pyscf/tools/fcidump.py +3 -0
  234. pyscf/x2c/sfx2c1e.py +1 -1
  235. pyscf/x2c/tdscf.py +4 -4
  236. pyscf/x2c/x2c.py +15 -11
  237. {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/METADATA +24 -24
  238. {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/NOTICE +3 -1
  239. {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/RECORD +242 -240
  240. {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/WHEEL +1 -1
  241. pyscf/dft/gen_libxc_param.py +0 -35
  242. pyscf/dft/gen_xcfun_param.py +0 -209
  243. {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/LICENSE +0 -0
  244. {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/top_level.txt +0 -0
pyscf/df/autoaux.py ADDED
@@ -0,0 +1,191 @@
1
+ #!/usr/bin/env python
2
+ # Copyright 2024 The PySCF Developers. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ '''
18
+ The AutoAux algorithm by ORCA
19
+
20
+ Ref:
21
+ JCTC, 13 (2016), 554
22
+ '''
23
+
24
+ from math import factorial
25
+ import numpy as np
26
+ from pyscf import gto
27
+
28
+ F_LAUX = np.array([20 , 7.0, 4.0, 4.0, 3.5, 2.5, 2.0, 2.0])
29
+ BETA_BIG = np.array([1.8, 2.0, 2.2, 2.2, 2.2, 2.3, 3.0, 3.0])
30
+ BETA_SMALL = 1.8
31
+
32
+ def _primitive_emin_emax(basis):
33
+ l_max = max(b[0] for b in basis)
34
+ emin_by_l = [1e99] * (l_max+1)
35
+ emax_by_l = [0] * (l_max+1)
36
+ e_eff_by_l = [0] * (l_max+1)
37
+
38
+ for b in basis:
39
+ l = b[0]
40
+ if isinstance(b[1], int):
41
+ e_c = np.array(b[2:])
42
+ else:
43
+ e_c = np.array(b[1:])
44
+ es = e_c[:,0]
45
+ emax_by_l[l] = max(es.max(), emax_by_l[l])
46
+ emin_by_l[l] = min(es.min(), emin_by_l[l])
47
+
48
+ cs = e_c[:,1:]
49
+ cs = np.einsum('pi,p->pi', cs, gto.gto_norm(l, es)) # normalize GTOs
50
+ cs = gto.mole._nomalize_contracted_ao(l, es, cs) # prefactors in r_ints
51
+ ee = es[:,None] + es
52
+ r_ints = gto.gaussian_int(l*2+3, ee) # \int \chi^2 r dr
53
+ r_exp = np.einsum('pi,pq,qi->i', cs, r_ints, cs)
54
+
55
+ k = 2**(2*l+1) * factorial(l+1)**2 / factorial(2*l+2)
56
+ # Eq (9) in the paper, e_eff = 2 * k**2 / (np.pi * r_exp) is a typo.
57
+ # See also https://github.com/MolSSI-BSE/basis_set_exchange/issues/317
58
+ # For primitive functions, following expression leads to
59
+ # e_eff = exponent of the basis
60
+ e_eff = 2 * k**2 / (np.pi * r_exp**2)
61
+ # For primitive functions, e_eff may be slightly different to the
62
+ # exponent due to the rounding errors in gaussian_int function.
63
+ # When a particular shell has only one primitive function, one auxiliary
64
+ # function should be generated. This error can introduce an additional
65
+ # auxiliary function.
66
+ # Slightly reduce e_eff to remove the extra auxiliary functions.
67
+ e_eff -= 1e-8
68
+ e_eff_by_l[l] = max(e_eff.max(), e_eff_by_l[l])
69
+ return np.array(emax_by_l), np.array(emin_by_l), np.array(e_eff_by_l)
70
+
71
+ def _auto_aux_element(Z, basis, ecp_core=0):
72
+ a_max_by_l, a_min_by_l, a_eff_by_l = _primitive_emin_emax(basis)
73
+ a_min_prim = a_min_by_l[:,None] + a_min_by_l
74
+ a_max_prim = a_max_by_l[:,None] + a_max_by_l
75
+ a_max_aux = a_eff_by_l[:,None] + a_eff_by_l
76
+
77
+ l_max1 = a_max_by_l.size
78
+ l_max = l_max1 - 1
79
+ # TODO: handle ECP
80
+ if Z <= 2:
81
+ l_val = 0
82
+ elif Z <= 20:
83
+ l_val = 1
84
+ elif Z <= 56:
85
+ l_val = 2
86
+ else:
87
+ l_val = 3
88
+ l_inc = 1
89
+ if Z > 18:
90
+ l_inc = 2
91
+ l_max_aux = min(max(l_val*2, l_max+l_inc), l_max*2)
92
+
93
+ liljsum = np.arange(l_max1)[:,None] + np.arange(l_max1)
94
+ liljsub = abs(np.arange(l_max1)[:,None] - np.arange(l_max1))
95
+ a_min_by_l = [a_min_prim[(liljsub<=ll) & (ll<=liljsum)].min() for ll in range(l_max_aux+1)]
96
+ a_max_by_l = [a_max_prim[(liljsub<=ll) & (ll<=liljsum)].max() for ll in range(l_max_aux+1)]
97
+ a_aux_by_l = [a_max_aux [(liljsub<=ll) & (ll<=liljsum)].max() for ll in range(l_max_aux+1)]
98
+
99
+ a_max_adjust = [min(F_LAUX[l] * a_aux_by_l[l], a_max_by_l[l])
100
+ for l in range(l_val*2+1)]
101
+ a_max_adjust = a_max_adjust + a_aux_by_l[l_val*2+1 : l_max_aux+1]
102
+
103
+ emin = np.array(a_min_by_l)
104
+ emax = np.array(a_max_adjust)
105
+
106
+ ns_small = np.log(a_max_adjust[:l_val*2+1] / emin[:l_val*2+1]) / np.log(BETA_SMALL)
107
+ etb = []
108
+ # ns_small+1 to ensure the largest exponent in etb > emax
109
+ for l, n in enumerate(np.ceil(ns_small).astype(int) + 1):
110
+ if n > 0:
111
+ etb.append((l, n, emin[l], BETA_SMALL))
112
+
113
+ if l_max_aux > l_val*2:
114
+ ns_big = (np.log(emax[l_val*2+1:] / emin[l_val*2+1:])
115
+ / np.log(BETA_BIG[l_val*2+1:l_max_aux+1]))
116
+ for l, n in enumerate(np.ceil(ns_big).astype(int) + 1):
117
+ if n > 0:
118
+ l = l + l_val*2+1
119
+ beta = BETA_BIG[l]
120
+ etb.append((l, n, emin[l], beta))
121
+ return etb
122
+
123
+ def autoaux(mol):
124
+ '''
125
+ Create an auxiliary basis set for the given orbital basis set using
126
+ the Auto-Aux algorithm.
127
+
128
+ See also: G. L. Stoychev, A. A. Auer, and F. Neese
129
+ Automatic Generation of Auxiliary Basis Sets
130
+ J. Chem. Theory Comput. 13, 554 (2017)
131
+ http://doi.org/10.1021/acs.jctc.6b01041
132
+ '''
133
+ from pyscf.gto.basis import bse
134
+
135
+ def expand(symb):
136
+ Z = gto.charge(symb)
137
+ etb = _auto_aux_element(Z, mol._basis[symb])
138
+ if etb:
139
+ return gto.expand_etbs(etb)
140
+ raise RuntimeError(f'Failed to generate even-tempered auxbasis for {symb}')
141
+
142
+ uniq_atoms = {a[0] for a in mol._atom}
143
+ if bse.basis_set_exchange is None:
144
+ return {symb: expand(symb) for symb in uniq_atoms}
145
+
146
+ if isinstance(mol.basis, str):
147
+ try:
148
+ elements = [gto.charge(symb) for symb in uniq_atoms]
149
+ newbasis = bse.autoaux(mol.basis, elements)
150
+ except KeyError:
151
+ newbasis = {symb: expand(symb) for symb in uniq_atoms}
152
+ else:
153
+ newbasis = {}
154
+ for symb in uniq_atoms:
155
+ if symb in mol.basis and isinstance(mol.basis[symb], str):
156
+ try:
157
+ auxbs = bse.autoaux(mol.basis[symb], gto.charge(symb))
158
+ newbasis[symb] = next(iter(auxbs.values()))
159
+ except KeyError:
160
+ newbasis[symb] = expand(symb)
161
+ else:
162
+ newbasis[symb] = expand(symb)
163
+ return newbasis
164
+
165
+ def autoabs(mol):
166
+ '''
167
+ Create a Coulomb fitting basis set for the given orbital basis set.
168
+ See also:
169
+ R. Yang, A. P. Rendell, and M. J. Frisch
170
+ Automatically generated Coulomb fitting basis sets: Design and accuracy for systems containing H to Kr
171
+ J. Chem. Phys. 127, 074102 (2007)
172
+ http://doi.org/10.1063/1.2752807
173
+ '''
174
+ from pyscf.gto.basis import bse
175
+ if bse is None:
176
+ print('Package basis-set-exchange not available')
177
+ raise ImportError
178
+
179
+ uniq_atoms = {a[0] for a in mol._atom}
180
+ if isinstance(mol.basis, str):
181
+ elements = [gto.charge(symb) for symb in uniq_atoms]
182
+ newbasis = bse.autoabs(mol.basis, elements)
183
+ else:
184
+ newbasis = {}
185
+ for symb in uniq_atoms:
186
+ if symb in mol.basis and isinstance(mol.basis[symb], str):
187
+ auxbs = bse.autoabs(mol.basis[symb], gto.charge(symb))
188
+ newbasis[symb] = next(iter(auxbs.values()))
189
+ else:
190
+ raise NotImplementedError
191
+ return newbasis
pyscf/df/df.py CHANGED
@@ -98,6 +98,10 @@ class DF(lib.StreamObject):
98
98
  self._vjopt = None
99
99
  self._rsh_df = {} # Range separated Coulomb DF objects
100
100
 
101
+ __getstate__, __setstate__ = lib.generate_pickle_methods(
102
+ excludes=('_cderi_to_save', '_cderi', '_vjopt', '_rsh_df'),
103
+ reset_state=True)
104
+
101
105
  @property
102
106
  def auxbasis(self):
103
107
  return self._auxbasis
@@ -166,7 +170,7 @@ class DF(lib.StreamObject):
166
170
  max_memory=max_memory, verbose=log)
167
171
  else:
168
172
  # Store DF tensor in blocks. This is to reduce the
169
- # initiailzation overhead
173
+ # initialization overhead
170
174
  outcore.cholesky_eri_b(mol, cderi, dataname=self._dataname,
171
175
  int3c=int3c, int2c=int2c, auxmol=auxmol,
172
176
  max_memory=max_memory, verbose=log)
pyscf/df/grad/casscf.py CHANGED
@@ -227,44 +227,3 @@ class Gradients(casci_grad.Gradients):
227
227
  to_gpu = lib.to_gpu
228
228
 
229
229
  Grad = Gradients
230
-
231
- #from pyscf import mcscf
232
- #mcscf.mc1step.CASSCF.Gradients = lib.class_as_method(Gradients)
233
-
234
-
235
- if __name__ == '__main__':
236
- from pyscf import scf
237
- from pyscf import mcscf
238
- from pyscf import df
239
- #from pyscf.grad import numeric
240
-
241
- mol = gto.Mole()
242
- mol.atom = 'N 0 0 0; N 0 0 1.2; H 1 1 0; H 1 1 1.2'
243
- mol.basis = '631g'
244
- mol.build()
245
- aux = df.aug_etb (mol)
246
- mf = scf.RHF(mol).density_fit (auxbasis=aux).run()
247
- mc = mcscf.CASSCF(mf, 4, 4).run()
248
- mc.conv_tol = 1e-10
249
- de = Gradients (mc).kernel()
250
- #de_num = numeric.Gradients (mc).kernel ()
251
- #print(lib.finger(de) - 0.019602220578635747)
252
- #print(lib.finger(de) - lib.finger (de_num))
253
-
254
- mol = gto.Mole()
255
- mol.verbose = 0
256
- mol.atom = 'N 0 0 0; N 0 0 1.2'
257
- mol.basis = 'sto3g'
258
- mol.build()
259
- mf = scf.RHF(mol).density_fit (auxbasis=aux).run()
260
- mc = mcscf.CASSCF(mf, 4, 4)
261
- mc.conv_tol = 1e-10
262
- mc.kernel ()
263
- de = Gradients (mc).kernel()
264
-
265
- mcs = mc.as_scanner()
266
- mol.set_geom_('N 0 0 0; N 0 0 1.201')
267
- e1 = mcs(mol)
268
- mol.set_geom_('N 0 0 0; N 0 0 1.199')
269
- e2 = mcs(mol)
270
- print(de[1,2], (e1-e2)/0.002*lib.param.BOHR)
pyscf/df/hessian/rhf.py CHANGED
@@ -368,16 +368,8 @@ def make_h1(hessobj, mo_coeff, mo_occ, chkfile=None, atmlst=None, verbose=None):
368
368
  for ia, h1, vj1, vk1 in _gen_jk(hessobj, mo_coeff, mo_occ, chkfile,
369
369
  atmlst, verbose, True):
370
370
  h1 += vj1 - vk1 * .5
371
-
372
- if chkfile is None:
373
- h1ao[ia] = h1
374
- else:
375
- key = 'scf_f1ao/%d' % ia
376
- lib.chkfile.save(chkfile, key, h1)
377
- if chkfile is None:
378
- return h1ao
379
- else:
380
- return chkfile
371
+ h1ao[ia] = h1
372
+ return h1ao
381
373
 
382
374
  def _gen_jk(hessobj, mo_coeff, mo_occ, chkfile=None, atmlst=None,
383
375
  verbose=None, with_k=True):
pyscf/df/hessian/rks.py CHANGED
@@ -109,13 +109,7 @@ def make_h1(hessobj, mo_coeff, mo_occ, chkfile=None, atmlst=None, verbose=None):
109
109
  for ia, h1, vj1, vk1 in df_rhf_hess._gen_jk(
110
110
  hessobj, mo_coeff, mo_occ, chkfile, atmlst, verbose):
111
111
  h1ao[ia] -= .5 * (alpha - hyb) * vk1
112
-
113
- if chkfile is None:
114
- return h1ao
115
- else:
116
- for ia in atmlst:
117
- lib.chkfile.save(chkfile, 'scf_f1ao/%d'%ia, h1ao[ia])
118
- return chkfile
112
+ return h1ao
119
113
 
120
114
 
121
115
  class Hessian(rks_hess.Hessian):
pyscf/df/hessian/uhf.py CHANGED
@@ -398,19 +398,9 @@ def make_h1(hessobj, mo_coeff, mo_occ, chkfile=None, atmlst=None, verbose=None):
398
398
  for ia, h1, vj1, vk1 in _gen_jk(hessobj, mo_coeff, mo_occ, chkfile,
399
399
  atmlst, verbose, True):
400
400
  vk1a, vk1b = vk1
401
- h1a = h1 + vj1 - vk1a
402
- h1b = h1 + vj1 - vk1b
403
-
404
- if chkfile is None:
405
- h1aoa[ia] = h1a
406
- h1aob[ia] = h1b
407
- else:
408
- lib.chkfile.save(chkfile, 'scf_f1ao/0/%d' % ia, h1a)
409
- lib.chkfile.save(chkfile, 'scf_f1ao/1/%d' % ia, h1b)
410
- if chkfile is None:
411
- return (h1aoa,h1aob)
412
- else:
413
- return chkfile
401
+ h1aoa[ia] = h1 + vj1 - vk1a
402
+ h1aob[ia] = h1 + vj1 - vk1b
403
+ return (h1aoa,h1aob)
414
404
 
415
405
  def _gen_jk(hessobj, mo_coeff, mo_occ, chkfile=None, atmlst=None,
416
406
  verbose=None, with_k=True):
pyscf/df/hessian/uks.py CHANGED
@@ -121,14 +121,7 @@ def make_h1(hessobj, mo_coeff, mo_occ, chkfile=None, atmlst=None, verbose=None):
121
121
  vk1a, vk1b = vk1
122
122
  h1aoa[ia] -= (alpha - hyb) * vk1a
123
123
  h1aob[ia] -= (alpha - hyb) * vk1b
124
-
125
- if chkfile is None:
126
- return h1aoa, h1aob
127
- else:
128
- for ia in atmlst:
129
- lib.chkfile.save(chkfile, 'scf_f1ao/0/%d'%ia, h1aoa[ia])
130
- lib.chkfile.save(chkfile, 'scf_f1ao/1/%d'%ia, h1aob[ia])
131
- return chkfile
124
+ return h1aoa, h1aob
132
125
 
133
126
 
134
127
  class Hessian(uks_hess.Hessian):
pyscf/df/incore.py CHANGED
@@ -38,22 +38,34 @@ format_aux_basis = addons.make_auxmol
38
38
 
39
39
 
40
40
  def aux_e2(mol, auxmol_or_auxbasis, intor='int3c2e', aosym='s1', comp=None, out=None,
41
- cintopt=None):
41
+ cintopt=None, shls_slice=None):
42
42
  '''3-center AO integrals (ij|L), where L is the auxiliary basis.
43
43
 
44
44
  Kwargs:
45
- cintopt : Libcint-3.14 and newer version support to compute int3c2e
46
- without the opt for the 3rd index. It can be precomputed to
47
- reduce the overhead of cintopt initialization repeatedly.
45
+ cintopt :
46
+ Precomputing certain pair-shell data. It can be created by
48
47
 
49
48
  cintopt = gto.moleintor.make_cintopt(mol._atm, mol._bas, mol._env, 'int3c2e')
49
+
50
+ shls_slice : 6-element tuple
51
+ Label the start-stop shells for each index in the integral tensor.
52
+ For the (ij|aux) = intor('int3c2e'), the tuple should be given as
53
+ (ish_start, ish_end, jsh_start, jsh_end, aux_start, aux_end)
50
54
  '''
51
55
  if isinstance(auxmol_or_auxbasis, gto.MoleBase):
52
56
  auxmol = auxmol_or_auxbasis
53
57
  else:
54
58
  auxbasis = auxmol_or_auxbasis
55
59
  auxmol = addons.make_auxmol(mol, auxbasis)
56
- shls_slice = (0, mol.nbas, 0, mol.nbas, mol.nbas, mol.nbas+auxmol.nbas)
60
+ if shls_slice is None:
61
+ shls_slice = (0, mol.nbas, 0, mol.nbas,
62
+ mol.nbas, mol.nbas+auxmol.nbas)
63
+ else:
64
+ assert len(shls_slice) == 6
65
+ assert shls_slice[5] < auxmol.nbas
66
+ shls_slice = list(shls_slice)
67
+ shls_slice[4] += mol.nbas
68
+ shls_slice[5] += mol.nbas
57
69
 
58
70
  # Extract the call of the two lines below
59
71
  # pmol = gto.mole.conc_mol(mol, auxmol)
pyscf/dft/dks.py CHANGED
@@ -46,7 +46,7 @@ def energy_elec(ks, dm=None, h1e=None, vhf=None):
46
46
  ks : an instance of DFT class
47
47
 
48
48
  dm : 2D ndarray
49
- one-partical density matrix
49
+ one-particle density matrix
50
50
  h1e : 2D ndarray
51
51
  Core hamiltonian
52
52