pyscf 2.5.0__py3-none-macosx_11_0_arm64.whl → 2.6.1__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 (263) hide show
  1. pyscf/__init__.py +1 -1
  2. pyscf/adc/__init__.py +0 -2
  3. pyscf/ao2mo/nrr_outcore.py +3 -3
  4. pyscf/ao2mo/outcore.py +9 -9
  5. pyscf/ao2mo/r_outcore.py +3 -3
  6. pyscf/ao2mo/semi_incore.py +2 -2
  7. pyscf/cc/__init__.py +1 -7
  8. pyscf/cc/ccsd.py +9 -0
  9. pyscf/cc/ccsd_t.py +1 -1
  10. pyscf/cc/ccsd_t_slow.py +1 -1
  11. pyscf/cc/dfccsd.py +2 -0
  12. pyscf/cc/gccsd.py +2 -0
  13. pyscf/cc/qcisd_t_slow.py +1 -1
  14. pyscf/cc/uccsd.py +2 -0
  15. pyscf/ci/cisd.py +2 -0
  16. pyscf/df/addons.py +1 -1
  17. pyscf/df/df.py +2 -4
  18. pyscf/df/df_jk.py +11 -9
  19. pyscf/df/grad/casdm2_util.py +1 -1
  20. pyscf/df/grad/casscf.py +2 -0
  21. pyscf/df/grad/rhf.py +9 -9
  22. pyscf/df/grad/rks.py +6 -9
  23. pyscf/df/grad/sacasscf.py +2 -0
  24. pyscf/df/grad/uhf.py +4 -3
  25. pyscf/df/grad/uks.py +5 -5
  26. pyscf/df/hessian/rhf.py +9 -6
  27. pyscf/df/hessian/rks.py +2 -6
  28. pyscf/df/hessian/uhf.py +3 -3
  29. pyscf/df/hessian/uks.py +2 -2
  30. pyscf/df/incore.py +8 -5
  31. pyscf/df/outcore.py +19 -6
  32. pyscf/dft/LebedevGrid.py +5047 -0
  33. pyscf/dft/__init__.py +1 -10
  34. pyscf/dft/dft_parser.py +24 -0
  35. pyscf/dft/dks.py +10 -1
  36. pyscf/dft/gen_grid.py +3 -44
  37. pyscf/dft/gks.py +2 -3
  38. pyscf/dft/gks_symm.py +3 -0
  39. pyscf/dft/libxc.py +14 -3
  40. pyscf/dft/numint.py +5 -4
  41. pyscf/dft/rks.py +39 -13
  42. pyscf/dft/rks_symm.py +6 -1
  43. pyscf/dft/roks.py +1 -8
  44. pyscf/dft/uks.py +2 -8
  45. pyscf/dft/uks_symm.py +3 -0
  46. pyscf/dft/xc_deriv.py +4 -3
  47. pyscf/dft/xcfun.py +9 -0
  48. pyscf/fci/addons.py +17 -14
  49. pyscf/fci/direct_nosym.py +45 -56
  50. pyscf/fci/direct_spin0.py +4 -2
  51. pyscf/fci/direct_spin1.py +9 -5
  52. pyscf/geomopt/__init__.py +1 -1
  53. pyscf/grad/__init__.py +1 -1
  54. pyscf/grad/casci.py +2 -0
  55. pyscf/grad/casscf.py +2 -0
  56. pyscf/grad/ccsd.py +2 -0
  57. pyscf/grad/cisd.py +2 -0
  58. pyscf/grad/dhf.py +2 -0
  59. pyscf/grad/dispersion.py +34 -27
  60. pyscf/grad/mp2.py +2 -0
  61. pyscf/grad/rhf.py +9 -6
  62. pyscf/grad/rks.py +4 -11
  63. pyscf/grad/tdrhf.py +2 -0
  64. pyscf/grad/uhf.py +0 -3
  65. pyscf/grad/uks.py +2 -6
  66. pyscf/gto/__init__.py +0 -1
  67. pyscf/gto/basis/__init__.py +0 -1
  68. pyscf/gto/eval_gto.py +11 -2
  69. pyscf/gto/mole.py +35 -31
  70. pyscf/gto/moleintor.py +1 -0
  71. pyscf/gw/rpa.py +235 -94
  72. pyscf/gw/urpa.py +135 -127
  73. pyscf/hessian/__init__.py +1 -1
  74. pyscf/hessian/dispersion.py +43 -33
  75. pyscf/hessian/rhf.py +12 -9
  76. pyscf/hessian/rks.py +2 -5
  77. pyscf/hessian/uhf.py +2 -4
  78. pyscf/hessian/uks.py +1 -4
  79. pyscf/lib/CMakeLists.txt +46 -1
  80. pyscf/lib/chkfile.py +3 -2
  81. pyscf/lib/dft/CMakeLists.txt +9 -5
  82. pyscf/lib/dft/grid_collocate.c +655 -0
  83. pyscf/lib/dft/grid_common.c +660 -0
  84. pyscf/lib/dft/grid_common.h +109 -0
  85. pyscf/lib/dft/grid_integrate.c +1358 -0
  86. pyscf/lib/dft/libxc_itrf.c +252 -38
  87. pyscf/lib/dft/multigrid.c +744 -0
  88. pyscf/lib/dft/multigrid.h +72 -0
  89. pyscf/lib/dft/utils.c +71 -0
  90. pyscf/lib/dft/utils.h +27 -0
  91. pyscf/lib/diis.py +2 -0
  92. pyscf/lib/libagf2.dylib +0 -0
  93. pyscf/lib/libao2mo.dylib +0 -0
  94. pyscf/lib/libcc.dylib +0 -0
  95. pyscf/lib/libcgto.dylib +0 -0
  96. pyscf/lib/libcvhf.dylib +0 -0
  97. pyscf/lib/libdft.dylib +0 -0
  98. pyscf/lib/libfci.dylib +0 -0
  99. pyscf/lib/libmcscf.dylib +0 -0
  100. pyscf/lib/libnp_helper.dylib +0 -0
  101. pyscf/lib/libpbc.dylib +0 -0
  102. pyscf/lib/libri.dylib +0 -0
  103. pyscf/lib/libxc_itrf.dylib +0 -0
  104. pyscf/lib/libxcfun_itrf.dylib +0 -0
  105. pyscf/lib/linalg_helper.py +1 -1
  106. pyscf/lib/mcscf/fci_string.c +1 -6
  107. pyscf/lib/misc.py +179 -24
  108. pyscf/lib/np_helper/np_helper.h +7 -0
  109. pyscf/lib/numpy_helper.py +9 -2
  110. pyscf/lib/parameters.py +1 -0
  111. pyscf/lib/pbc/CMakeLists.txt +11 -1
  112. pyscf/lib/pbc/cell.c +280 -0
  113. pyscf/lib/pbc/cell.h +29 -0
  114. pyscf/lib/pbc/fft.c +147 -0
  115. pyscf/lib/pbc/fft.h +26 -0
  116. pyscf/lib/pbc/fill_ints.c +3 -3
  117. pyscf/lib/pbc/fill_ints.h +29 -0
  118. pyscf/lib/pbc/fill_ints_screened.c +1012 -0
  119. pyscf/lib/pbc/hf_grad.c +95 -0
  120. pyscf/lib/pbc/neighbor_list.c +206 -0
  121. pyscf/lib/pbc/neighbor_list.h +41 -0
  122. pyscf/lib/pbc/optimizer.c +37 -1
  123. pyscf/lib/pbc/optimizer.h +3 -3
  124. pyscf/lib/pbc/pp.c +448 -0
  125. pyscf/lib/solvent/CMakeLists.txt +38 -0
  126. pyscf/mcscf/__init__.py +9 -23
  127. pyscf/mcscf/casci.py +3 -1
  128. pyscf/mcscf/casci_symm.py +3 -1
  129. pyscf/mcscf/chkfile.py +3 -2
  130. pyscf/mcscf/mc1step.py +8 -6
  131. pyscf/mcscf/newton_casscf_symm.py +1 -1
  132. pyscf/mcscf/ucasci.py +1 -1
  133. pyscf/mcscf/umc1step.py +1 -1
  134. pyscf/mp/__init__.py +1 -1
  135. pyscf/mp/dfgmp2.py +2 -2
  136. pyscf/mp/dfmp2.py +2 -2
  137. pyscf/mp/dfmp2_native.py +2 -0
  138. pyscf/mp/dfump2_native.py +2 -0
  139. pyscf/mp/gmp2.py +4 -2
  140. pyscf/mp/mp2.py +44 -12
  141. pyscf/mp/ump2.py +50 -19
  142. pyscf/mrpt/nevpt2.py +1 -1
  143. pyscf/pbc/adc/__init__.py +0 -1
  144. pyscf/pbc/cc/kccsd.py +2 -0
  145. pyscf/pbc/cc/kccsd_rhf.py +2 -0
  146. pyscf/pbc/cc/kccsd_t_rhf.py +1 -1
  147. pyscf/pbc/cc/kccsd_uhf.py +2 -0
  148. pyscf/pbc/df/aft.py +1 -1
  149. pyscf/pbc/df/aft_jk.py +1 -1
  150. pyscf/pbc/df/df.py +5 -0
  151. pyscf/pbc/df/df_jk.py +4 -7
  152. pyscf/pbc/df/fft.py +5 -0
  153. pyscf/pbc/df/incore.py +244 -0
  154. pyscf/pbc/df/mdf.py +3 -0
  155. pyscf/pbc/df/mdf_jk.py +0 -3
  156. pyscf/pbc/df/outcore.py +4 -4
  157. pyscf/pbc/df/rsdf.py +7 -4
  158. pyscf/pbc/df/rsdf_builder.py +3 -4
  159. pyscf/pbc/df/rsdf_helper.py +2 -2
  160. pyscf/pbc/dft/__init__.py +0 -12
  161. pyscf/pbc/dft/gen_grid.py +4 -0
  162. pyscf/pbc/dft/gks.py +4 -2
  163. pyscf/pbc/dft/kgks.py +16 -4
  164. pyscf/pbc/dft/krks.py +15 -25
  165. pyscf/pbc/dft/krks_ksymm.py +5 -5
  166. pyscf/pbc/dft/kroks.py +9 -19
  167. pyscf/pbc/dft/kuks.py +14 -24
  168. pyscf/pbc/dft/kuks_ksymm.py +5 -5
  169. pyscf/pbc/dft/multigrid/__init__.py +57 -0
  170. pyscf/pbc/dft/{multigrid.py → multigrid/multigrid.py} +86 -93
  171. pyscf/pbc/dft/multigrid/multigrid_pair.py +1405 -0
  172. pyscf/pbc/dft/multigrid/pp.py +290 -0
  173. pyscf/pbc/dft/multigrid/utils.py +70 -0
  174. pyscf/pbc/dft/numint.py +5 -1
  175. pyscf/pbc/dft/numint2c.py +1 -0
  176. pyscf/pbc/dft/rks.py +8 -7
  177. pyscf/pbc/dft/roks.py +2 -0
  178. pyscf/pbc/dft/uks.py +6 -4
  179. pyscf/pbc/grad/__init__.py +5 -2
  180. pyscf/pbc/grad/krhf.py +7 -1
  181. pyscf/pbc/grad/rhf.py +167 -0
  182. pyscf/pbc/grad/rks.py +24 -0
  183. pyscf/pbc/grad/uhf.py +92 -0
  184. pyscf/pbc/grad/uks.py +24 -0
  185. pyscf/pbc/gto/__init__.py +1 -0
  186. pyscf/pbc/gto/_pbcintor.py +14 -7
  187. pyscf/pbc/gto/cell.py +218 -20
  188. pyscf/pbc/gto/ewald_methods.py +293 -0
  189. pyscf/pbc/gto/neighborlist.py +199 -0
  190. pyscf/pbc/gto/pseudo/pp_int.py +350 -17
  191. pyscf/pbc/lib/kpts.py +1 -1
  192. pyscf/pbc/mp/kmp2.py +2 -0
  193. pyscf/pbc/scf/__init__.py +0 -10
  194. pyscf/pbc/scf/addons.py +11 -5
  195. pyscf/pbc/scf/ghf.py +3 -0
  196. pyscf/pbc/scf/hf.py +30 -19
  197. pyscf/pbc/scf/kghf.py +4 -0
  198. pyscf/pbc/scf/khf.py +9 -6
  199. pyscf/pbc/scf/khf_ksymm.py +5 -3
  200. pyscf/pbc/scf/krohf.py +1 -0
  201. pyscf/pbc/scf/kuhf.py +5 -2
  202. pyscf/pbc/scf/kuhf_ksymm.py +4 -2
  203. pyscf/pbc/scf/rohf.py +1 -0
  204. pyscf/pbc/scf/rsjk.py +2 -0
  205. pyscf/pbc/scf/uhf.py +7 -3
  206. pyscf/pbc/symm/geom.py +1 -1
  207. pyscf/pbc/symm/pyscf_spglib.py +1 -1
  208. pyscf/pbc/symm/symmetry.py +1 -1
  209. pyscf/pbc/tools/pbc.py +51 -8
  210. pyscf/qmmm/itrf.py +12 -0
  211. pyscf/scf/__init__.py +1 -7
  212. pyscf/scf/_response_functions.py +3 -3
  213. pyscf/scf/addons.py +12 -6
  214. pyscf/scf/atom_hf.py +15 -2
  215. pyscf/scf/atom_hf_pp.py +154 -0
  216. pyscf/scf/chkfile.py +2 -1
  217. pyscf/scf/dhf.py +5 -7
  218. pyscf/scf/diis.py +4 -8
  219. pyscf/scf/dispersion.py +136 -39
  220. pyscf/scf/ghf.py +3 -7
  221. pyscf/scf/ghf_symm.py +1 -2
  222. pyscf/scf/hf.py +46 -31
  223. pyscf/scf/hf_symm.py +2 -4
  224. pyscf/scf/rohf.py +1 -3
  225. pyscf/scf/ucphf.py +1 -1
  226. pyscf/scf/uhf.py +7 -8
  227. pyscf/scf/uhf_symm.py +1 -2
  228. pyscf/sgx/sgx.py +5 -0
  229. pyscf/solvent/__init__.py +25 -1
  230. pyscf/solvent/_attach_solvent.py +49 -3
  231. pyscf/solvent/_ddcosmo_tdscf_grad.py +1 -1
  232. pyscf/solvent/ddcosmo.py +5 -4
  233. pyscf/solvent/ddpcm.py +1 -0
  234. pyscf/solvent/grad/__init__.py +17 -0
  235. pyscf/solvent/grad/pcm.py +384 -0
  236. pyscf/solvent/grad/smd.py +176 -0
  237. pyscf/solvent/grad/smd_experiment.py +216 -0
  238. pyscf/solvent/hessian/__init__.py +0 -0
  239. pyscf/solvent/hessian/pcm.py +230 -0
  240. pyscf/solvent/hessian/smd.py +171 -0
  241. pyscf/solvent/hessian/smd_experiment.py +208 -0
  242. pyscf/solvent/pcm.py +137 -56
  243. pyscf/solvent/smd.py +433 -0
  244. pyscf/solvent/smd_experiment.py +273 -0
  245. pyscf/soscf/newton_ah.py +3 -0
  246. pyscf/symm/geom.py +3 -7
  247. pyscf/tdscf/common_slow.py +1 -4
  248. pyscf/tdscf/dhf.py +1 -1
  249. pyscf/tdscf/ghf.py +1 -1
  250. pyscf/tdscf/rhf.py +8 -1
  251. pyscf/tdscf/uhf.py +5 -1
  252. pyscf/tools/chgcar.py +1 -5
  253. pyscf/x2c/sfx2c1e.py +7 -2
  254. pyscf/x2c/tdscf.py +1 -1
  255. pyscf/x2c/x2c.py +8 -0
  256. pyscf-2.6.1.dist-info/METADATA +140 -0
  257. {pyscf-2.5.0.dist-info → pyscf-2.6.1.dist-info}/NOTICE +4 -0
  258. {pyscf-2.5.0.dist-info → pyscf-2.6.1.dist-info}/RECORD +262 -220
  259. {pyscf-2.5.0.dist-info → pyscf-2.6.1.dist-info}/WHEEL +1 -1
  260. pyscf-2.5.0.dist-info/METADATA +0 -81
  261. /pyscf/solvent/{ddcosmo_grad.py → grad/ddcosmo_grad.py} +0 -0
  262. {pyscf-2.5.0.dist-info → pyscf-2.6.1.dist-info}/LICENSE +0 -0
  263. {pyscf-2.5.0.dist-info → pyscf-2.6.1.dist-info}/top_level.txt +0 -0
pyscf/__init__.py CHANGED
@@ -35,7 +35,7 @@ to try out the package::
35
35
 
36
36
  '''
37
37
 
38
- __version__ = '2.5.0'
38
+ __version__ = '2.6.1'
39
39
 
40
40
  import os
41
41
  import sys
pyscf/adc/__init__.py CHANGED
@@ -70,8 +70,6 @@ def UADC(mf, frozen=None, mo_coeff=None, mo_occ=None):
70
70
  UADC.__doc__ = uadc.UADC.__doc__
71
71
 
72
72
  def RADC(mf, frozen=None, mo_coeff=None, mo_occ=None):
73
- __doc__ = radc.RADC.__doc__
74
-
75
73
  if not (frozen is None or frozen == 0):
76
74
  raise NotImplementedError
77
75
 
@@ -95,11 +95,11 @@ def general(mol, mo_coeffs, erifile, dataname='eri_mo',
95
95
 
96
96
  if isinstance(erifile, str):
97
97
  if h5py.is_hdf5(erifile):
98
- feri = h5py.File(erifile, 'a')
98
+ feri = lib.H5FileWrap(erifile, 'a')
99
99
  if dataname in feri:
100
100
  del(feri[dataname])
101
101
  else:
102
- feri = h5py.File(erifile, 'w')
102
+ feri = lib.H5FileWrap(erifile, 'w')
103
103
  else:
104
104
  assert(isinstance(erifile, h5py.Group))
105
105
  feri = erifile
@@ -250,7 +250,7 @@ def half_e1(mol, mo_coeffs, swapfile,
250
250
  log.debug('step1: (ij,kl) = (%d,%d), mem cache %.8g MB, iobuf %.8g MB',
251
251
  nij_pair, nao_pair, mem_words*16/1e6, iobuf_words*16/1e6)
252
252
 
253
- fswap = h5py.File(swapfile, 'w')
253
+ fswap = lib.H5FileWrap(swapfile, 'w')
254
254
  for icomp in range(comp):
255
255
  fswap.create_group(str(icomp)) # for h5py old version
256
256
 
pyscf/ao2mo/outcore.py CHANGED
@@ -238,11 +238,11 @@ def general(mol, mo_coeffs, erifile, dataname='eri_mo',
238
238
 
239
239
  if isinstance(erifile, str):
240
240
  if h5py.is_hdf5(erifile):
241
- feri = h5py.File(erifile, 'a')
241
+ feri = lib.H5FileWrap(erifile, 'a')
242
242
  if dataname in feri:
243
243
  del (feri[dataname])
244
244
  else:
245
- feri = h5py.File(erifile, 'w')
245
+ feri = lib.H5FileWrap(erifile, 'w')
246
246
  else:
247
247
  assert (isinstance(erifile, h5py.Group))
248
248
  feri = erifile
@@ -431,7 +431,7 @@ def half_e1(mol, mo_coeffs, swapfile,
431
431
  if isinstance(swapfile, h5py.Group):
432
432
  fswap = swapfile
433
433
  else:
434
- fswap = lib.H5TmpFile(swapfile)
434
+ fswap = lib.H5FileWrap(swapfile, 'a')
435
435
  for icomp in range(comp):
436
436
  fswap.create_group(str(icomp)) # for h5py old version
437
437
 
@@ -486,16 +486,16 @@ def _load_from_h5g(h5group, row0, row1, out=None):
486
486
  out = numpy.ndarray((row1-row0, ncol), dat.dtype, buffer=out)
487
487
  col1 = 0
488
488
  for key in range(nkeys):
489
- dat = h5group[str(key)][row0:row1]
490
- col0, col1 = col1, col1 + dat.shape[1]
491
- out[:,col0:col1] = dat
489
+ col0, col1 = col1, col1 + h5group[str(key)].shape[1]
490
+ h5group[str(key)].read_direct(out, dest_sel=numpy.s_[:,col0:col1],
491
+ source_sel=numpy.s_[row0:row1])
492
492
  else: # multiple components
493
493
  out = numpy.ndarray((dat.shape[0], row1-row0, ncol), dat.dtype, buffer=out)
494
494
  col1 = 0
495
495
  for key in range(nkeys):
496
- dat = h5group[str(key)][:,row0:row1]
497
- col0, col1 = col1, col1 + dat.shape[2]
498
- out[:,:,col0:col1] = dat
496
+ col0, col1 = col1, col1 + h5group[str(key)].shape[2]
497
+ h5group[str(key)].read_direct(out, dest_sel=numpy.s_[:,:,col0:col1],
498
+ source_sel=numpy.s_[:,row0:row1])
499
499
  return out
500
500
 
501
501
  def _transpose_to_h5g(h5group, key, dat, blksize, chunks=None):
pyscf/ao2mo/r_outcore.py CHANGED
@@ -74,11 +74,11 @@ def general(mol, mo_coeffs, erifile, dataname='eri_mo',
74
74
 
75
75
  if isinstance(erifile, str):
76
76
  if h5py.is_hdf5(erifile):
77
- feri = h5py.File(erifile, 'a')
77
+ feri = lib.H5FileWrap(erifile, 'a')
78
78
  if dataname in feri:
79
79
  del (feri[dataname])
80
80
  else:
81
- feri = h5py.File(erifile, 'w')
81
+ feri = lib.H5FileWrap(erifile, 'w')
82
82
  else:
83
83
  assert (isinstance(erifile, h5py.Group))
84
84
  feri = erifile
@@ -214,7 +214,7 @@ def half_e1(mol, mo_coeffs, swapfile,
214
214
  log.debug('step1: (ij,kl) = (%d,%d), mem cache %.8g MB, iobuf %.8g MB',
215
215
  nij_pair, nao_pair, mem_words*16/1e6, iobuf_words*16/1e6)
216
216
 
217
- fswap = h5py.File(swapfile, 'w')
217
+ fswap = lib.H5FileWrap(swapfile, 'w')
218
218
  for icomp in range(comp):
219
219
  fswap.create_group(str(icomp)) # for h5py old version
220
220
 
@@ -140,11 +140,11 @@ def general(eri, mo_coeffs, erifile, dataname='eri_mo',
140
140
 
141
141
  if isinstance(erifile, str):
142
142
  if h5py.is_hdf5(erifile):
143
- feri = h5py.File(erifile, 'a')
143
+ feri = lib.H5FileWrap(erifile, 'a')
144
144
  if dataname in feri:
145
145
  del (feri[dataname])
146
146
  else:
147
- feri = h5py.File(erifile,'w',libver='latest')
147
+ feri = lib.H5FileWrap(erifile,'w', libver='latest')
148
148
  else:
149
149
  assert (isinstance(erifile, h5py.Group))
150
150
  feri = erifile
pyscf/cc/__init__.py CHANGED
@@ -194,15 +194,9 @@ def FNOCCSD(mf, thresh=1e-6, pct_occ=None, nvir_act=None, frozen=None):
194
194
  Number of virtual NOs to keep. Default is None. If present, overrides `thresh` and `pct_occ`.
195
195
  """
196
196
  import numpy
197
- if frozen is None:
198
- frozenocc = 0
199
- else:
200
- assert(isinstance(frozen, (int,numpy.int64)))
201
- frozenocc = frozen
202
197
  from pyscf import mp
203
- pt = mp.MP2(mf).set(verbose=0).run()
198
+ pt = mp.MP2(mf, frozen=frozen).set(verbose=0).run()
204
199
  frozen, no_coeff = pt.make_fno(thresh=thresh, pct_occ=pct_occ, nvir_act=nvir_act)
205
- frozen = numpy.hstack([numpy.arange(frozenocc),frozen])
206
200
  if len(frozen) == 0: frozen = None
207
201
  pt_no = mp.MP2(mf, frozen=frozen, mo_coeff=no_coeff).set(verbose=0).run()
208
202
  mycc = CCSD(mf, frozen=frozen, mo_coeff=no_coeff)
pyscf/cc/ccsd.py CHANGED
@@ -1240,6 +1240,15 @@ class CCSDBase(lib.StreamObject):
1240
1240
  def nuc_grad_method(self):
1241
1241
  raise NotImplementedError
1242
1242
 
1243
+ # to_gpu can be reused only when __init__ still takes mf
1244
+ def to_gpu(self):
1245
+ mf = self.base.to_gpu()
1246
+ from importlib import import_module
1247
+ mod = import_module(self.__module__.replace('pyscf', 'gpu4pyscf'))
1248
+ cls = getattr(mod, self.__class__.__name__)
1249
+ obj = cls(mf)
1250
+ return obj
1251
+
1243
1252
  class CCSD(CCSDBase):
1244
1253
  __doc__ = CCSDBase.__doc__
1245
1254
 
pyscf/cc/ccsd_t.py CHANGED
@@ -176,7 +176,7 @@ def _sort_eri(mycc, eris, nocc, nvir, vvop, log):
176
176
 
177
177
  def _sort_t2_vooo_(mycc, orbsym, t1, t2, eris):
178
178
  assert (t2.flags.c_contiguous)
179
- vooo = numpy.asarray(eris.ovoo).transpose(1,0,3,2).conj().copy()
179
+ vooo = numpy.asarray(eris.ovoo).transpose(1,0,2,3).conj().copy()
180
180
  nocc, nvir = t1.shape
181
181
  if mycc.mol.symmetry:
182
182
  orbsym = numpy.asarray(orbsym, dtype=numpy.int32)
pyscf/cc/ccsd_t_slow.py CHANGED
@@ -45,7 +45,7 @@ def kernel(mycc, eris, t1=None, t2=None, verbose=logger.NOTE):
45
45
  eijk = lib.direct_sum('i,j,k->ijk', e_occ, e_occ, e_occ)
46
46
 
47
47
  eris_vvov = eris.get_ovvv().conj().transpose(1,3,0,2)
48
- eris_vooo = numpy.asarray(eris.ovoo).conj().transpose(1,0,3,2)
48
+ eris_vooo = numpy.asarray(eris.ovoo).conj().transpose(1,0,2,3)
49
49
  eris_vvoo = numpy.asarray(eris.ovov).conj().transpose(1,3,0,2)
50
50
  fvo = eris.fock[nocc:,:nocc]
51
51
  def get_w(a, b, c):
pyscf/cc/dfccsd.py CHANGED
@@ -48,6 +48,8 @@ class RCCSD(ccsd.CCSD):
48
48
  assert (not self.direct)
49
49
  return ccsd.CCSD._add_vvvv(self, t1, t2, eris, out, with_ovvv, t2sym)
50
50
 
51
+ to_gpu = lib.to_gpu
52
+
51
53
 
52
54
  def _contract_vvvv_t2(mycc, mol, vvL, t2, out=None, verbose=None):
53
55
  '''Ht2 = numpy.einsum('ijcd,acdb->ijab', t2, vvvv)
pyscf/cc/gccsd.py CHANGED
@@ -289,6 +289,8 @@ class GCCSD(ccsd.CCSDBase):
289
289
  orbspin = orbspin[self.get_frozen_mask()]
290
290
  return spin2spatial(tx, orbspin)
291
291
 
292
+ to_gpu = lib.to_gpu
293
+
292
294
  CCSD = GCCSD
293
295
 
294
296
 
pyscf/cc/qcisd_t_slow.py CHANGED
@@ -47,7 +47,7 @@ def kernel(mycc, eris, t1=None, t2=None, verbose=logger.NOTE):
47
47
  eijk = lib.direct_sum('i,j,k->ijk', e_occ, e_occ, e_occ)
48
48
 
49
49
  eris_vvov = eris.get_ovvv().conj().transpose(1,3,0,2)
50
- eris_vooo = numpy.asarray(eris.ovoo).conj().transpose(1,0,3,2)
50
+ eris_vooo = numpy.asarray(eris.ovoo).conj().transpose(1,0,2,3)
51
51
  eris_vvoo = numpy.asarray(eris.ovov).conj().transpose(1,3,0,2)
52
52
  fvo = eris.fock[nocc:,:nocc]
53
53
  def get_w(a, b, c):
pyscf/cc/uccsd.py CHANGED
@@ -758,6 +758,8 @@ class UCCSD(ccsd.CCSDBase):
758
758
  def amplitudes_from_rccsd(self, t1, t2):
759
759
  return amplitudes_from_rccsd(t1, t2)
760
760
 
761
+ to_gpu = lib.to_gpu
762
+
761
763
  CCSD = UCCSD
762
764
 
763
765
 
pyscf/ci/cisd.py CHANGED
@@ -1131,6 +1131,8 @@ class CISD(lib.StreamObject):
1131
1131
  from pyscf.grad import cisd
1132
1132
  return cisd.Gradients(self)
1133
1133
 
1134
+ to_gpu = lib.to_gpu
1135
+
1134
1136
  class RCISD(CISD):
1135
1137
  pass
1136
1138
 
pyscf/df/addons.py CHANGED
@@ -152,7 +152,7 @@ def make_auxbasis(mol, mp2fit=False):
152
152
  _basis.update(mol.basis)
153
153
  del (_basis['default'])
154
154
  else:
155
- _basis = mol._basis
155
+ _basis = mol._basis or {}
156
156
 
157
157
  auxbasis = {}
158
158
  for k in _basis:
pyscf/df/df.py CHANGED
@@ -284,7 +284,7 @@ class DF(lib.StreamObject):
284
284
  else:
285
285
  rsh_df = self._rsh_df[key] = self.copy().reset()
286
286
  if hasattr(self, '_dataname'):
287
- rsh_df._dataname = f'{self._dataname}/lr/{key}'
287
+ rsh_df._dataname = f'{self._dataname}-lr/{key}'
288
288
  logger.info(self, 'Create RSH-DF object %s for omega=%s', rsh_df, omega)
289
289
 
290
290
  mol = self.mol
@@ -308,9 +308,7 @@ class DF(lib.StreamObject):
308
308
  if auxmol_omega is not None:
309
309
  auxmol.omega = auxmol_omega
310
310
 
311
- def to_gpu(self):
312
- from gpu4pyscf.df.df import DF as DF
313
- return lib.to_gpu(self.__class__.reset(self.view(DF)))
311
+ to_gpu = lib.to_gpu
314
312
 
315
313
  GDF = DF
316
314
 
pyscf/df/df_jk.py CHANGED
@@ -200,6 +200,8 @@ class _DFHF:
200
200
  return uks.Hessian(self)
201
201
  else:
202
202
  return uhf.Hessian(self)
203
+ elif isinstance(self, scf.rohf.ROHF):
204
+ raise NotImplementedError
203
205
  elif isinstance(self, scf.rhf.RHF):
204
206
  if isinstance(self, scf.hf.KohnShamDFT):
205
207
  return rks.Hessian(self)
@@ -228,8 +230,7 @@ class _DFHF:
228
230
 
229
231
  def to_gpu(self):
230
232
  obj = self.undo_df().to_gpu().density_fit()
231
- obj.__dict__.update(self.__dict__)
232
- return lib.to_gpu(obj)
233
+ return lib.to_gpu(self, obj)
233
234
 
234
235
 
235
236
  def get_jk(dfobj, dm, hermi=1, with_j=True, with_k=True, direct_scf_tol=1e-13):
@@ -261,8 +262,9 @@ def get_jk(dfobj, dm, hermi=1, with_j=True, with_k=True, direct_scf_tol=1e-13):
261
262
 
262
263
  if not with_k:
263
264
  for eri1 in dfobj.loop():
264
- rho = numpy.einsum('ix,px->ip', dmtril, eri1)
265
- vj += numpy.einsum('ip,px->ix', rho, eri1)
265
+ # uses numpy.matmul
266
+ vj += (dmtril @ eri1.T) @ eri1
267
+
266
268
 
267
269
  elif getattr(dm, 'mo_coeff', None) is not None:
268
270
  #TODO: test whether dm.mo_coeff matching dm
@@ -291,9 +293,8 @@ def get_jk(dfobj, dm, hermi=1, with_j=True, with_k=True, direct_scf_tol=1e-13):
291
293
  naux, nao_pair = eri1.shape
292
294
  assert (nao_pair == nao*(nao+1)//2)
293
295
  if with_j:
294
- rho = numpy.einsum('ix,px->ip', dmtril, eri1)
295
- vj += numpy.einsum('ip,px->ix', rho, eri1)
296
-
296
+ # uses numpy.matmul
297
+ vj += (dmtril @ eri1.T) @ eri1
297
298
  for k in range(nset):
298
299
  nocc = orbo[k].shape[1]
299
300
  if nocc > 0:
@@ -319,8 +320,9 @@ def get_jk(dfobj, dm, hermi=1, with_j=True, with_k=True, direct_scf_tol=1e-13):
319
320
  for eri1 in dfobj.loop(blksize):
320
321
  naux, nao_pair = eri1.shape
321
322
  if with_j:
322
- rho = numpy.einsum('ix,px->ip', dmtril, eri1)
323
- vj += numpy.einsum('ip,px->ix', rho, eri1)
323
+ # uses numpy.matmul
324
+ vj += (dmtril @ eri1.T) @ eri1
325
+
324
326
 
325
327
  for k in range(nset):
326
328
  buf1 = buf[0,:naux]
@@ -476,7 +476,7 @@ def grad_elec_dferi (mc_grad, mo_cas=None, ci=None, dfcasdm2=None, casdm2=None,
476
476
 
477
477
  aoslices = mol.aoslice_by_atom ()
478
478
  dE = np.array ([dE[:,p0:p1].sum (axis=1) for p0, p1 in aoslices[:,2:]]).transpose (1,0,2)
479
- return np.ascontiguousarray (dE)
479
+ return np.ascontiguousarray (dE)[:,atmlst,:]
480
480
 
481
481
  if __name__ == '__main__':
482
482
  from pyscf.tools import molden
pyscf/df/grad/casscf.py CHANGED
@@ -224,6 +224,8 @@ class Gradients(casci_grad.Gradients):
224
224
 
225
225
  as_scanner = as_scanner
226
226
 
227
+ to_gpu = lib.to_gpu
228
+
227
229
  Grad = Gradients
228
230
 
229
231
  #from pyscf import mcscf
pyscf/df/grad/rhf.py CHANGED
@@ -38,8 +38,9 @@ from functools import reduce
38
38
  from itertools import product
39
39
  from pyscf.ao2mo import _ao2mo
40
40
  from pyscf.df import df_jk
41
+ from pyscf.df.incore import LINEAR_DEP_THR
41
42
 
42
- LINEAR_DEP_THRESHOLD = 1e-9
43
+ LINEAR_DEP_THRESHOLD = LINEAR_DEP_THR
43
44
 
44
45
  def get_jk(mf_grad, mol=None, dm=None, hermi=0, with_j=True, with_k=True,
45
46
  decompose_j2c='CD', lindep=LINEAR_DEP_THRESHOLD):
@@ -482,12 +483,15 @@ class Gradients(rhf_grad.Gradients):
482
483
  _keys = {'with_df', 'auxbasis_response'}
483
484
 
484
485
  def __init__(self, mf):
485
- assert isinstance(mf, df.df_jk._DFHF)
486
- # Whether to include the response of DF auxiliary basis when computing
487
- # nuclear gradients of J/K matrices
488
- self.auxbasis_response = True
489
486
  rhf_grad.Gradients.__init__(self, mf)
490
487
 
488
+ # Whether to include the response of DF auxiliary basis when computing
489
+ # nuclear gradients of J/K matrices
490
+ auxbasis_response = True
491
+
492
+ def check_sanity(self):
493
+ assert isinstance(self.base, df.df_jk._DFHF)
494
+
491
495
  def get_jk(self, mol=None, dm=None, hermi=0, with_j=True, with_k=True,
492
496
  omega=None):
493
497
  if omega is None:
@@ -521,8 +525,4 @@ class Gradients(rhf_grad.Gradients):
521
525
  else:
522
526
  return 0
523
527
 
524
- def to_gpu(self):
525
- from gpu4pyscf.df.grad.rhf import Gradients
526
- return lib.to_gpu(self.view(Gradients))
527
-
528
528
  Grad = Gradients
pyscf/df/grad/rks.py CHANGED
@@ -46,7 +46,7 @@ def get_veff(ks_grad, mol=None, dm=None):
46
46
  exc, vxc = rks_grad.get_vxc_full_response(
47
47
  ni, mol, grids, mf.xc, dm,
48
48
  max_memory=max_memory, verbose=ks_grad.verbose)
49
- if mf.nlc or ni.libxc.is_nlc(mf.xc):
49
+ if mf.do_nlc():
50
50
  if ni.libxc.is_nlc(mf.xc):
51
51
  xc = mf.xc
52
52
  else:
@@ -61,7 +61,7 @@ def get_veff(ks_grad, mol=None, dm=None):
61
61
  exc, vxc = rks_grad.get_vxc(
62
62
  ni, mol, grids, mf.xc, dm,
63
63
  max_memory=max_memory, verbose=ks_grad.verbose)
64
- if mf.nlc or ni.libxc.is_nlc(mf.xc):
64
+ if mf.do_nlc():
65
65
  if ni.libxc.is_nlc(mf.xc):
66
66
  xc = mf.xc
67
67
  else:
@@ -107,11 +107,12 @@ class Gradients(rks_grad.Gradients):
107
107
  _keys = {'with_df', 'auxbasis_response'}
108
108
 
109
109
  def __init__(self, mf):
110
- # Whether to include the response of DF auxiliary basis when computing
111
- # nuclear gradients of J/K matrices
112
- self.auxbasis_response = True
113
110
  rks_grad.Gradients.__init__(self, mf)
114
111
 
112
+ # Whether to include the response of DF auxiliary basis when computing
113
+ # nuclear gradients of J/K matrices
114
+ auxbasis_response = True
115
+
115
116
  get_jk = df_rhf_grad.Gradients.get_jk
116
117
  get_j = df_rhf_grad.Gradients.get_j
117
118
  get_k = df_rhf_grad.Gradients.get_k
@@ -123,8 +124,4 @@ class Gradients(rks_grad.Gradients):
123
124
  e1 += envs['vhf'].aux[atom_id]
124
125
  return e1
125
126
 
126
- def to_gpu(self):
127
- from gpu4pyscf.df.grad.rks import Gradients
128
- return lib.to_gpu(self.view(Gradients))
129
-
130
127
  Grad = Gradients
pyscf/df/grad/sacasscf.py CHANGED
@@ -370,3 +370,5 @@ class Gradients (sacasscf_grad.Gradients):
370
370
  def get_LdotJnuc (self, Lvec, **kwargs):
371
371
  with lib.temporary_env (sacasscf_grad, Lci_dot_dgci_dx=Lci_dot_dgci_dx, Lorb_dot_dgorb_dx=Lorb_dot_dgorb_dx):
372
372
  return sacasscf_grad.Gradients.get_LdotJnuc (self, Lvec, **kwargs)
373
+
374
+ to_gpu = lib.to_gpu
pyscf/df/grad/uhf.py CHANGED
@@ -35,11 +35,12 @@ class Gradients(uhf_grad.Gradients):
35
35
  _keys = {'with_df', 'auxbasis_response'}
36
36
 
37
37
  def __init__(self, mf):
38
- # Whether to include the response of DF auxiliary basis when computing
39
- # nuclear gradients of J/K matrices
40
- self.auxbasis_response = True
41
38
  uhf_grad.Gradients.__init__(self, mf)
42
39
 
40
+ # Whether to include the response of DF auxiliary basis when computing
41
+ # nuclear gradients of J/K matrices
42
+ auxbasis_response = True
43
+
43
44
  get_jk = df_rhf_grad.Gradients.get_jk
44
45
  get_j = df_rhf_grad.Gradients.get_j
45
46
  get_k = df_rhf_grad.Gradients.get_k
pyscf/df/grad/uks.py CHANGED
@@ -48,7 +48,7 @@ def get_veff(ks_grad, mol=None, dm=None):
48
48
  exc, vxc = uks_grad.get_vxc_full_response(
49
49
  ni, mol, grids, mf.xc, dm,
50
50
  max_memory=max_memory, verbose=ks_grad.verbose)
51
- if mf.nlc or ni.libxc.is_nlc(mf.xc):
51
+ if mf.do_nlc():
52
52
  if ni.libxc.is_nlc(mf.xc):
53
53
  xc = mf.xc
54
54
  else:
@@ -63,7 +63,7 @@ def get_veff(ks_grad, mol=None, dm=None):
63
63
  exc, vxc = uks_grad.get_vxc(
64
64
  ni, mol, grids, mf.xc, dm,
65
65
  max_memory=max_memory, verbose=ks_grad.verbose)
66
- if mf.nlc or ni.libxc.is_nlc(mf.xc):
66
+ if mf.do_nlc():
67
67
  if ni.libxc.is_nlc(mf.xc):
68
68
  xc = mf.xc
69
69
  else:
@@ -108,11 +108,11 @@ class Gradients(uks_grad.Gradients):
108
108
  _keys = {'with_df', 'auxbasis_response'}
109
109
 
110
110
  def __init__(self, mf):
111
- # Whether to include the response of DF auxiliary basis when computing
112
- # nuclear gradients of J/K matrices
113
- self.auxbasis_response = True
114
111
  uks_grad.Gradients.__init__(self, mf)
115
112
 
113
+ # Whether to include the response of DF auxiliary basis when computing
114
+ # nuclear gradients of J/K matrices
115
+ auxbasis_response = True
116
116
  get_jk = df_rhf_grad.Gradients.get_jk
117
117
  get_j = df_rhf_grad.Gradients.get_j
118
118
  get_k = df_rhf_grad.Gradients.get_k
pyscf/df/hessian/rhf.py CHANGED
@@ -43,6 +43,13 @@ from pyscf.hessian import rhf as rhf_hess
43
43
  from pyscf.df.grad.rhf import (_int3c_wrapper, _gen_metric_solver,
44
44
  LINEAR_DEP_THRESHOLD)
45
45
 
46
+ def _pinv(a, lindep=LINEAR_DEP_THRESHOLD):
47
+ '''Similar to pinv (v1.7.0) with atol=lindep and rtol=0'''
48
+ w, v = scipy.linalg.eigh(a)
49
+ mask = w > lindep
50
+ v1 = v[:, mask]
51
+ return lib.dot(v1/w[mask], v1.conj().T)
52
+
46
53
  def partial_hess_elec(hessobj, mo_energy=None, mo_coeff=None, mo_occ=None,
47
54
  atmlst=None, max_memory=4000, verbose=None):
48
55
  e1, ej, ek = _partial_hess_ejk(hessobj, mo_energy, mo_coeff, mo_occ,
@@ -174,7 +181,7 @@ def _partial_hess_ejk(hessobj, mo_energy=None, mo_coeff=None, mo_occ=None,
174
181
  get_int3c_ipip2 = _int3c_wrapper(mol, auxmol, 'int3c2e_ipip2', 's1')
175
182
  rhok0_P__ = lib.einsum('plj,li->pij', rhok0_Pl_, mocc_2)
176
183
  rho2c_0 = lib.einsum('pij,qji->pq', rhok0_P__, rhok0_P__)
177
- int2c_inv = numpy.linalg.pinv(int2c, rcond=LINEAR_DEP_THRESHOLD)
184
+ int2c_inv = _pinv(int2c, lindep=LINEAR_DEP_THRESHOLD)
178
185
  int2c_ipip1 = auxmol.intor('int2c2e_ipip1', aosym='s1')
179
186
  int2c_ip_ip = lib.einsum('xpq,qr,ysr->xyps', int2c_ip1, int2c_inv, int2c_ip1)
180
187
  int2c_ip_ip -= auxmol.intor('int2c2e_ip1ip2', aosym='s1').reshape(3,3,naux,naux)
@@ -475,16 +482,12 @@ def _load_dim0(dat, p0, p1):
475
482
  class Hessian(rhf_hess.Hessian):
476
483
  '''Non-relativistic restricted Hartree-Fock hessian'''
477
484
  def __init__(self, mf):
478
- self.auxbasis_response = 1
479
485
  rhf_hess.Hessian.__init__(self, mf)
480
486
 
487
+ auxbasis_response = 1
481
488
  partial_hess_elec = partial_hess_elec
482
489
  make_h1 = make_h1
483
490
 
484
- def to_gpu(self):
485
- from gpu4pyscf.df.hessian.rhf import Hessian
486
- return lib.to_gpu(self.view(Hessian))
487
-
488
491
  #TODO: Insert into DF class
489
492
 
490
493
 
pyscf/df/hessian/rks.py CHANGED
@@ -42,7 +42,7 @@ def partial_hess_elec(hessobj, mo_energy=None, mo_coeff=None, mo_occ=None,
42
42
  mol = hessobj.mol
43
43
  mf = hessobj.base
44
44
  ni = mf._numint
45
- if mf.nlc or ni.libxc.is_nlc(mf.xc):
45
+ if mf.do_nlc():
46
46
  raise NotImplementedError('RKS Hessian for NLC functional')
47
47
 
48
48
  if mo_energy is None: mo_energy = mf.mo_energy
@@ -121,16 +121,12 @@ def make_h1(hessobj, mo_coeff, mo_occ, chkfile=None, atmlst=None, verbose=None):
121
121
  class Hessian(rks_hess.Hessian):
122
122
  '''Non-relativistic RKS hessian'''
123
123
  def __init__(self, mf):
124
- self.auxbasis_response = 1
125
124
  rks_hess.Hessian.__init__(self, mf)
126
125
 
126
+ auxbasis_response = 1
127
127
  partial_hess_elec = partial_hess_elec
128
128
  make_h1 = make_h1
129
129
 
130
- def to_gpu(self):
131
- from gpu4pyscf.df.hessian.rks import Hessian
132
- return lib.to_gpu(self.view(Hessian))
133
-
134
130
 
135
131
  if __name__ == '__main__':
136
132
  from pyscf import gto
pyscf/df/hessian/uhf.py CHANGED
@@ -35,7 +35,7 @@ from pyscf.lib import logger
35
35
  from pyscf import ao2mo
36
36
  from pyscf.hessian import rhf as rhf_hess
37
37
  from pyscf.hessian import uhf as uhf_hess
38
- from pyscf.df.hessian.rhf import _load_dim0
38
+ from pyscf.df.hessian.rhf import _load_dim0, _pinv
39
39
  from pyscf.df.grad.rhf import (_int3c_wrapper, _gen_metric_solver,
40
40
  LINEAR_DEP_THRESHOLD)
41
41
 
@@ -197,7 +197,7 @@ def _partial_hess_ejk(hessobj, mo_energy=None, mo_coeff=None, mo_occ=None,
197
197
  rhok0b_P__ = lib.einsum('plj,li->pij', rhok0b_Pl_, moccb)
198
198
  rho2c_0 = lib.einsum('pij,qij->pq', rhok0a_P__, rhok0a_P__)
199
199
  rho2c_0 += lib.einsum('pij,qij->pq', rhok0b_P__, rhok0b_P__)
200
- int2c_inv = numpy.linalg.pinv(int2c, rcond=LINEAR_DEP_THRESHOLD)
200
+ int2c_inv = _pinv(int2c, lindep=LINEAR_DEP_THRESHOLD)
201
201
  int2c_ipip1 = auxmol.intor('int2c2e_ipip1', aosym='s1')
202
202
  int2c_ip_ip = lib.einsum('xpq,qr,ysr->xyps', int2c_ip1, int2c_inv, int2c_ip1)
203
203
  int2c_ip_ip -= auxmol.intor('int2c2e_ip1ip2', aosym='s1').reshape(3,3,naux,naux)
@@ -526,9 +526,9 @@ def _gen_jk(hessobj, mo_coeff, mo_occ, chkfile=None, atmlst=None,
526
526
  class Hessian(uhf_hess.Hessian):
527
527
  '''Non-relativistic UHF hessian'''
528
528
  def __init__(self, mf):
529
- self.auxbasis_response = 1
530
529
  uhf_hess.Hessian.__init__(self, mf)
531
530
 
531
+ auxbasis_response = 1
532
532
  partial_hess_elec = partial_hess_elec
533
533
  make_h1 = make_h1
534
534
 
pyscf/df/hessian/uks.py CHANGED
@@ -42,7 +42,7 @@ def partial_hess_elec(hessobj, mo_energy=None, mo_coeff=None, mo_occ=None,
42
42
  mol = hessobj.mol
43
43
  mf = hessobj.base
44
44
  ni = mf._numint
45
- if mf.nlc or ni.libxc.is_nlc(mf.xc):
45
+ if mf.do_nlc():
46
46
  raise NotImplementedError('RKS Hessian for NLC functional')
47
47
 
48
48
  if mo_energy is None: mo_energy = mf.mo_energy
@@ -134,9 +134,9 @@ def make_h1(hessobj, mo_coeff, mo_occ, chkfile=None, atmlst=None, verbose=None):
134
134
  class Hessian(uks_hess.Hessian):
135
135
  '''Non-relativistic RKS hessian'''
136
136
  def __init__(self, mf):
137
- self.auxbasis_response = 1
138
137
  uks_hess.Hessian.__init__(self, mf)
139
138
 
139
+ auxbasis_response = 1
140
140
  partial_hess_elec = partial_hess_elec
141
141
  make_h1 = make_h1
142
142
 
pyscf/df/incore.py CHANGED
@@ -28,7 +28,9 @@ from pyscf import __config__
28
28
 
29
29
 
30
30
  MAX_MEMORY = getattr(__config__, 'df_outcore_max_memory', 2000) # 2GB
31
- LINEAR_DEP_THR = getattr(__config__, 'df_df_DF_lindep', 1e-12)
31
+ # LINEAR_DEP_THR cannot be below 1e-7,
32
+ # see qchem default setting in https://manual.q-chem.com/5.4/sec_Basis_Customization.html
33
+ LINEAR_DEP_THR = getattr(__config__, 'df_df_DF_lindep', 1e-7)
32
34
 
33
35
 
34
36
  # This function is aliased for backward compatibility.
@@ -179,10 +181,11 @@ def cholesky_eri(mol, auxbasis='weigend+etb', auxmol=None,
179
181
  p0, p1 = p1, p1 + nrow
180
182
  if decompose_j2c == 'cd':
181
183
  if ints.flags.c_contiguous:
182
- ints = lib.transpose(ints, out=bufs2).T
183
- bufs1, bufs2 = bufs2, bufs1
184
- dat = scipy.linalg.solve_triangular(low, ints, lower=True,
185
- overwrite_b=True, check_finite=False)
184
+ trsm, = scipy.linalg.get_blas_funcs(('trsm',), (low, ints))
185
+ dat = trsm(1.0, low, ints.T, lower=True, trans_a = 1, side = 1, overwrite_b=True).T
186
+ else:
187
+ dat = scipy.linalg.solve_triangular(low, ints, lower=True,
188
+ overwrite_b=True, check_finite=False)
186
189
  if dat.flags.f_contiguous:
187
190
  dat = lib.transpose(dat.T, out=bufs2)
188
191
  cderi[:,p0:p1] = dat