pyscf 2.6.2__py3-none-macosx_11_0_arm64.whl → 2.8.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 (360) 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/__init__.py +13 -2
  20. pyscf/ao2mo/_ao2mo.py +10 -1
  21. pyscf/ao2mo/incore.py +3 -0
  22. pyscf/ao2mo/nrr_outcore.py +2 -2
  23. pyscf/ao2mo/outcore.py +9 -7
  24. pyscf/ao2mo/r_outcore.py +2 -2
  25. pyscf/cc/__init__.py +21 -3
  26. pyscf/cc/bccd.py +0 -46
  27. pyscf/cc/ccsd.py +29 -13
  28. pyscf/cc/ccsd_rdm.py +6 -1
  29. pyscf/cc/gccsd.py +2 -2
  30. pyscf/cc/uccsd.py +7 -7
  31. pyscf/cc/uccsd_rdm.py +2 -2
  32. pyscf/data/elements.py +1 -1
  33. pyscf/df/__init__.py +2 -1
  34. pyscf/df/addons.py +79 -51
  35. pyscf/df/autoaux.py +195 -0
  36. pyscf/df/df.py +5 -1
  37. pyscf/df/df_jk.py +27 -25
  38. pyscf/df/grad/casscf.py +0 -41
  39. pyscf/df/grad/rhf.py +31 -1
  40. pyscf/df/hessian/rhf.py +2 -10
  41. pyscf/df/hessian/rks.py +1 -7
  42. pyscf/df/hessian/uhf.py +3 -13
  43. pyscf/df/hessian/uks.py +1 -8
  44. pyscf/df/incore.py +18 -6
  45. pyscf/df/outcore.py +6 -6
  46. pyscf/dft/dks.py +1 -1
  47. pyscf/dft/gks.py +25 -21
  48. pyscf/dft/libxc.py +91 -645
  49. pyscf/dft/numint.py +40 -19
  50. pyscf/dft/radi.py +48 -7
  51. pyscf/dft/rks.py +29 -25
  52. pyscf/dft/roks.py +7 -1
  53. pyscf/dft/uks.py +34 -25
  54. pyscf/dft/xc_deriv.py +1 -1
  55. pyscf/dft/xcfun.py +53 -2
  56. pyscf/eph/eph_fd.py +1 -1
  57. pyscf/eph/rhf.py +6 -36
  58. pyscf/eph/rks.py +0 -4
  59. pyscf/eph/uhf.py +1 -7
  60. pyscf/eph/uks.py +1 -7
  61. pyscf/fci/addons.py +117 -2
  62. pyscf/fci/cistring.py +1 -1
  63. pyscf/fci/direct_nosym.py +3 -3
  64. pyscf/fci/direct_spin0_symm.py +22 -43
  65. pyscf/fci/direct_spin1.py +65 -10
  66. pyscf/fci/direct_spin1_symm.py +49 -14
  67. pyscf/fci/direct_uhf.py +4 -4
  68. pyscf/fci/selected_ci_symm.py +1 -1
  69. pyscf/grad/ccsd.py +3 -7
  70. pyscf/grad/ccsd_slow.py +2 -3
  71. pyscf/grad/lagrange.py +11 -3
  72. pyscf/grad/mp2.py +13 -4
  73. pyscf/grad/sacasscf.py +1 -1
  74. pyscf/grad/tdrks.py +1 -1
  75. pyscf/grad/uccsd.py +3 -7
  76. pyscf/grad/ump2.py +2 -4
  77. pyscf/gto/basis/__init__.py +17 -4
  78. pyscf/gto/basis/bse.py +68 -15
  79. pyscf/gto/basis/def2-mtzvp.dat +4719 -0
  80. pyscf/gto/basis/def2-mtzvpp.dat +4739 -0
  81. pyscf/gto/basis/dyall-basis/__init__.py +0 -0
  82. pyscf/gto/basis/dyall-basis/dyall_2zp.py +6492 -0
  83. pyscf/gto/basis/dyall-basis/dyall_3zp.py +8343 -0
  84. pyscf/gto/basis/dyall-basis/dyall_4zp.py +10055 -0
  85. pyscf/gto/basis/dyall-basis/dyall_aae2z.py +1818 -0
  86. pyscf/gto/basis/dyall-basis/dyall_aae3z.py +2521 -0
  87. pyscf/gto/basis/dyall-basis/dyall_aae4z.py +3351 -0
  88. pyscf/gto/basis/dyall-basis/dyall_acv2z.py +1790 -0
  89. pyscf/gto/basis/dyall-basis/dyall_acv3z.py +2417 -0
  90. pyscf/gto/basis/dyall-basis/dyall_acv4z.py +3085 -0
  91. pyscf/gto/basis/dyall-basis/dyall_ae2z.py +6619 -0
  92. pyscf/gto/basis/dyall-basis/dyall_ae3z.py +9027 -0
  93. pyscf/gto/basis/dyall-basis/dyall_ae4z.py +11839 -0
  94. pyscf/gto/basis/dyall-basis/dyall_av2z.py +1742 -0
  95. pyscf/gto/basis/dyall-basis/dyall_av3z.py +2318 -0
  96. pyscf/gto/basis/dyall-basis/dyall_av4z.py +2905 -0
  97. pyscf/gto/basis/dyall-basis/dyall_cv2z.py +6558 -0
  98. pyscf/gto/basis/dyall-basis/dyall_cv3z.py +8767 -0
  99. pyscf/gto/basis/dyall-basis/dyall_cv4z.py +11098 -0
  100. pyscf/gto/basis/dyall-basis/dyall_v2z.py +6472 -0
  101. pyscf/gto/basis/dyall-basis/dyall_v3z.py +8539 -0
  102. pyscf/gto/basis/dyall-basis/dyall_v4z.py +10658 -0
  103. pyscf/gto/basis/ma-def2-qzvp.dat +5959 -0
  104. pyscf/gto/basis/ma-def2-qzvpp.dat +6195 -0
  105. pyscf/gto/basis/ma-def2-svp.dat +3504 -0
  106. pyscf/gto/basis/ma-def2-svpp.dat +3504 -0
  107. pyscf/gto/basis/ma-def2-tzvp.dat +4347 -0
  108. pyscf/gto/basis/ma-def2-tzvpp.dat +4549 -0
  109. pyscf/gto/basis/parse_cp2k.py +8 -7
  110. pyscf/gto/basis/parse_cp2k_pp.py +1 -1
  111. pyscf/gto/basis/parse_nwchem.py +26 -11
  112. pyscf/gto/basis/parse_nwchem_ecp.py +2 -1
  113. pyscf/gto/basis/sap_grasp_large.dat +2438 -0
  114. pyscf/gto/basis/sap_grasp_small.dat +1434 -0
  115. pyscf/gto/eval_gto.py +1 -1
  116. pyscf/gto/ft_ao.py +6 -6
  117. pyscf/gto/mole.py +123 -71
  118. pyscf/gto/moleintor.py +1 -1
  119. pyscf/gw/gw_ac.py +2 -2
  120. pyscf/gw/gw_cd.py +2 -2
  121. pyscf/gw/rpa.py +135 -246
  122. pyscf/gw/ugw_ac.py +2 -2
  123. pyscf/gw/urpa.py +80 -131
  124. pyscf/hessian/rhf.py +30 -128
  125. pyscf/hessian/rks.py +1 -6
  126. pyscf/hessian/uhf.py +28 -138
  127. pyscf/hessian/uks.py +1 -8
  128. pyscf/lib/CMakeLists.txt +6 -2
  129. pyscf/lib/ao2mo/nr_ao2mo.c +1 -1
  130. pyscf/lib/ao2mo/nrr_ao2mo.c +1 -1
  131. pyscf/lib/ao2mo/r_ao2mo.c +1 -1
  132. pyscf/lib/cc/ccsd_pack.c +1 -1
  133. pyscf/lib/cc/ccsd_t.c +6 -6
  134. pyscf/lib/cc/uccsd_t.c +4 -4
  135. pyscf/lib/config.h +0 -1
  136. pyscf/lib/config.h.in +0 -1
  137. pyscf/lib/deps/include/XCFun/XCFunExport.h +1 -0
  138. pyscf/lib/deps/include/xc.h +28 -18
  139. pyscf/lib/deps/include/xc_funcs.h +50 -2
  140. pyscf/lib/deps/include/xc_version.h +3 -3
  141. pyscf/lib/deps/lib/libcint.6.dylib +0 -0
  142. pyscf/lib/deps/lib/{libxc.12.dylib → libxc.15.dylib} +0 -0
  143. pyscf/lib/deps/lib/libxcfun.2.dylib +0 -0
  144. pyscf/lib/dft/grid_common.c +1 -1
  145. pyscf/lib/dft/libxc_itrf.c +10 -7
  146. pyscf/lib/dft/nr_numint_sparse.c +3 -3
  147. pyscf/lib/dft/xcfun_itrf.c +1 -1
  148. pyscf/lib/diis.py +2 -2
  149. pyscf/lib/exceptions.py +6 -0
  150. pyscf/lib/gto/fill_grids_int2c.c +11 -9
  151. pyscf/lib/gto/fill_int2e.c +7 -5
  152. pyscf/lib/gto/fill_r_4c.c +1 -1
  153. pyscf/lib/gto/ft_ao.c +1 -1
  154. pyscf/lib/gto/ft_ao.h +1 -1
  155. pyscf/lib/gto/gto.h +2 -2
  156. pyscf/lib/gto/nr_ecp.c +3 -2
  157. pyscf/lib/libagf2.dylib +0 -0
  158. pyscf/lib/libao2mo.dylib +0 -0
  159. pyscf/lib/libcc.dylib +0 -0
  160. pyscf/lib/libcgto.dylib +0 -0
  161. pyscf/lib/libcvhf.dylib +0 -0
  162. pyscf/lib/libdft.dylib +0 -0
  163. pyscf/lib/libfci.dylib +0 -0
  164. pyscf/lib/libmcscf.dylib +0 -0
  165. pyscf/lib/libmp.dylib +0 -0
  166. pyscf/lib/libnp_helper.dylib +0 -0
  167. pyscf/lib/libpbc.dylib +0 -0
  168. pyscf/lib/libri.dylib +0 -0
  169. pyscf/lib/libxc_itrf.dylib +0 -0
  170. pyscf/lib/libxcfun_itrf.dylib +0 -0
  171. pyscf/lib/linalg_helper.py +117 -198
  172. pyscf/lib/logger.py +2 -1
  173. pyscf/lib/mcscf/fci_contract.c +10 -3
  174. pyscf/lib/misc.py +63 -22
  175. pyscf/lib/mp/CMakeLists.txt +22 -0
  176. pyscf/lib/mp/mp2.c +518 -0
  177. pyscf/lib/mp/mp2.h +44 -0
  178. pyscf/lib/np_helper/CMakeLists.txt +1 -1
  179. pyscf/lib/np_helper/imatcopy.c +360 -0
  180. pyscf/lib/np_helper/np_helper.c +94 -0
  181. pyscf/lib/np_helper/np_helper.h +26 -0
  182. pyscf/lib/numpy_helper.py +195 -11
  183. pyscf/lib/pbc/nr_direct.c +2 -7
  184. pyscf/lib/pbc/nr_ecp.c +10 -3
  185. pyscf/lib/pbc/pbc.h +1 -1
  186. pyscf/lib/vhf/fblas.h +3 -0
  187. pyscf/lib/vhf/nr_sgx_direct.c +8 -6
  188. pyscf/lib/vhf/nr_sr_vhf.c +8 -12
  189. pyscf/lib/vhf/optimizer.c +2 -2
  190. pyscf/lib/vhf/rkb_screen.c +139 -0
  191. pyscf/lo/iao.py +1 -1
  192. pyscf/lo/ibo.py +3 -3
  193. pyscf/lo/pipek_jacobi.py +1 -1
  194. pyscf/mcscf/__init__.py +2 -2
  195. pyscf/mcscf/addons.py +3 -3
  196. pyscf/mcscf/apc.py +2 -2
  197. pyscf/mcscf/casci.py +13 -7
  198. pyscf/mcscf/chkfile.py +69 -41
  199. pyscf/mcscf/dmet_cas.py +2 -2
  200. pyscf/mcscf/mc1step.py +72 -44
  201. pyscf/mcscf/newton_casscf.py +5 -5
  202. pyscf/mcscf/ucasci.py +1 -1
  203. pyscf/mcscf/umc1step.py +49 -28
  204. pyscf/md/integrators.py +3 -3
  205. pyscf/mp/__init__.py +1 -0
  206. pyscf/mp/dfmp2.py +498 -59
  207. pyscf/mp/dfmp2_native.py +11 -1
  208. pyscf/mp/dfmp2_slow.py +133 -0
  209. pyscf/mp/dfump2.py +672 -0
  210. pyscf/mp/dfump2_native.py +9 -0
  211. pyscf/mp/dfump2_slow.py +161 -0
  212. pyscf/mp/gmp2.py +6 -47
  213. pyscf/mp/mp2.py +25 -10
  214. pyscf/mp/ump2.py +30 -24
  215. pyscf/pbc/adc/kadc_rhf.py +1 -1
  216. pyscf/pbc/adc/kadc_rhf_amplitudes.py +2 -2
  217. pyscf/pbc/ao2mo/eris.py +1 -1
  218. pyscf/pbc/cc/kccsd_rhf.py +3 -3
  219. pyscf/pbc/cc/kccsd_t_rhf.py +2 -2
  220. pyscf/pbc/ci/kcis_rhf.py +2 -2
  221. pyscf/pbc/df/aft.py +8 -9
  222. pyscf/pbc/df/aft_ao2mo.py +1 -1
  223. pyscf/pbc/df/df.py +85 -12
  224. pyscf/pbc/df/df_jk.py +6 -2
  225. pyscf/pbc/df/fft.py +9 -5
  226. pyscf/pbc/df/fft_ao2mo.py +4 -0
  227. pyscf/pbc/df/fft_jk.py +18 -10
  228. pyscf/pbc/df/ft_ao.py +4 -3
  229. pyscf/pbc/df/gdf_builder.py +5 -4
  230. pyscf/pbc/df/incore.py +2 -2
  231. pyscf/pbc/df/mdf.py +6 -3
  232. pyscf/pbc/df/mdf_jk.py +2 -1
  233. pyscf/pbc/df/outcore.py +10 -10
  234. pyscf/pbc/df/rsdf.py +2 -2
  235. pyscf/pbc/df/rsdf_builder.py +13 -8
  236. pyscf/pbc/df/rsdf_helper.py +6 -6
  237. pyscf/pbc/df/rsdf_jk.py +2 -1
  238. pyscf/pbc/dft/cdft.py +5 -5
  239. pyscf/pbc/dft/gen_grid.py +3 -2
  240. pyscf/pbc/dft/gks.py +14 -3
  241. pyscf/pbc/dft/kgks.py +15 -4
  242. pyscf/pbc/dft/krks.py +28 -10
  243. pyscf/pbc/dft/krks_ksymm.py +21 -9
  244. pyscf/pbc/dft/krkspu.py +1 -30
  245. pyscf/pbc/dft/krkspu_ksymm.py +0 -30
  246. pyscf/pbc/dft/kuks.py +30 -13
  247. pyscf/pbc/dft/kuks_ksymm.py +22 -10
  248. pyscf/pbc/dft/kukspu.py +0 -27
  249. pyscf/pbc/dft/kukspu_ksymm.py +0 -30
  250. pyscf/pbc/dft/multigrid/multigrid.py +36 -33
  251. pyscf/pbc/dft/multigrid/multigrid_pair.py +7 -2
  252. pyscf/pbc/dft/multigrid/pp.py +1 -1
  253. pyscf/pbc/dft/numint.py +56 -31
  254. pyscf/pbc/dft/rks.py +16 -24
  255. pyscf/pbc/dft/uks.py +21 -4
  256. pyscf/pbc/eph/eph_fd.py +1 -1
  257. pyscf/pbc/geomopt/geometric_solver.py +1 -1
  258. pyscf/pbc/gto/_pbcintor.py +1 -0
  259. pyscf/pbc/gto/cell.py +194 -23
  260. pyscf/pbc/gto/ecp.py +12 -12
  261. pyscf/pbc/gto/eval_gto.py +3 -3
  262. pyscf/pbc/gto/neighborlist.py +4 -1
  263. pyscf/pbc/gto/pseudo/pp.py +1 -1
  264. pyscf/pbc/gw/krgw_ac.py +4 -4
  265. pyscf/pbc/gw/krgw_cd.py +4 -4
  266. pyscf/pbc/gw/kugw_ac.py +3 -3
  267. pyscf/pbc/lib/kpts_helper.py +4 -3
  268. pyscf/pbc/lib/linalg_helper.py +1 -1
  269. pyscf/pbc/mp/kmp2.py +1 -1
  270. pyscf/pbc/mpitools/mpi.py +1 -1
  271. pyscf/pbc/scf/_response_functions.py +141 -34
  272. pyscf/pbc/scf/addons.py +15 -11
  273. pyscf/pbc/scf/cphf.py +1 -1
  274. pyscf/pbc/scf/ghf.py +1 -1
  275. pyscf/pbc/scf/hf.py +21 -32
  276. pyscf/pbc/scf/kghf.py +33 -29
  277. pyscf/pbc/scf/khf.py +103 -29
  278. pyscf/pbc/scf/khf_ksymm.py +15 -1
  279. pyscf/pbc/scf/krohf.py +5 -7
  280. pyscf/pbc/scf/kuhf.py +54 -23
  281. pyscf/pbc/scf/kuhf_ksymm.py +1 -1
  282. pyscf/pbc/scf/rsjk.py +14 -10
  283. pyscf/pbc/scf/scfint.py +1 -1
  284. pyscf/pbc/scf/stability.py +27 -15
  285. pyscf/pbc/scf/uhf.py +3 -1
  286. pyscf/pbc/symm/symmetry.py +2 -2
  287. pyscf/pbc/tdscf/krhf.py +238 -154
  288. pyscf/pbc/tdscf/krks.py +1 -45
  289. pyscf/pbc/tdscf/kuhf.py +319 -171
  290. pyscf/pbc/tdscf/kuks.py +0 -56
  291. pyscf/pbc/tdscf/rhf.py +116 -3
  292. pyscf/pbc/tdscf/rks.py +2 -1
  293. pyscf/pbc/tdscf/uhf.py +214 -1
  294. pyscf/pbc/tdscf/uks.py +2 -1
  295. pyscf/pbc/tools/k2gamma.py +20 -6
  296. pyscf/pbc/tools/lattice.py +3 -3
  297. pyscf/pbc/tools/pbc.py +111 -91
  298. pyscf/pbc/tools/pyscf_ase.py +0 -1
  299. pyscf/pbc/tools/pywannier90.py +1 -1
  300. pyscf/qmmm/mm_mole.py +1 -1
  301. pyscf/scf/_response_functions.py +87 -46
  302. pyscf/scf/_vhf.py +15 -10
  303. pyscf/scf/addons.py +29 -15
  304. pyscf/scf/cphf.py +14 -52
  305. pyscf/scf/dhf.py +121 -38
  306. pyscf/scf/dispersion.py +10 -9
  307. pyscf/scf/ghf.py +25 -13
  308. pyscf/scf/ghf_symm.py +2 -2
  309. pyscf/scf/hf.py +262 -30
  310. pyscf/scf/rohf.py +37 -5
  311. pyscf/scf/stability.py +142 -112
  312. pyscf/scf/ucphf.py +21 -16
  313. pyscf/scf/uhf.py +104 -61
  314. pyscf/sgx/sgx.py +1 -1
  315. pyscf/sgx/sgx_jk.py +4 -4
  316. pyscf/solvent/__init__.py +2 -2
  317. pyscf/solvent/_attach_solvent.py +2 -0
  318. pyscf/solvent/_ddcosmo_tdscf_grad.py +1 -1
  319. pyscf/solvent/cosmors.py +366 -0
  320. pyscf/solvent/ddcosmo.py +1 -1
  321. pyscf/solvent/pcm.py +4 -4
  322. pyscf/solvent/pol_embed.py +1 -1
  323. pyscf/solvent/smd.py +5 -3
  324. pyscf/soscf/ciah.py +3 -11
  325. pyscf/soscf/newton_ah.py +5 -2
  326. pyscf/symm/__init__.py +1 -1
  327. pyscf/symm/addons.py +5 -5
  328. pyscf/symm/geom.py +1 -5
  329. pyscf/tdscf/_lr_eig.py +1002 -0
  330. pyscf/tdscf/dhf.py +84 -87
  331. pyscf/tdscf/dks.py +0 -4
  332. pyscf/tdscf/ghf.py +139 -127
  333. pyscf/tdscf/gks.py +27 -25
  334. pyscf/tdscf/rhf.py +194 -147
  335. pyscf/tdscf/rks.py +26 -22
  336. pyscf/tdscf/uhf.py +166 -118
  337. pyscf/tdscf/uks.py +32 -31
  338. pyscf/tools/fcidump.py +3 -0
  339. pyscf/tools/qcschema.py +265 -0
  340. pyscf/x2c/sfx2c1e.py +1 -1
  341. pyscf/x2c/tdscf.py +41 -41
  342. pyscf/x2c/x2c.py +15 -11
  343. {pyscf-2.6.2.dist-info → pyscf-2.8.0.dist-info}/METADATA +39 -36
  344. {pyscf-2.6.2.dist-info → pyscf-2.8.0.dist-info}/NOTICE +14 -1
  345. {pyscf-2.6.2.dist-info → pyscf-2.8.0.dist-info}/RECORD +348 -316
  346. {pyscf-2.6.2.dist-info → pyscf-2.8.0.dist-info}/WHEEL +1 -1
  347. pyscf/dft/gen_libxc_param.py +0 -35
  348. pyscf/dft/gen_xcfun_param.py +0 -209
  349. pyscf/pbc/tdscf/kproxy.py +0 -189
  350. pyscf/pbc/tdscf/kproxy_supercell.py +0 -664
  351. pyscf/pbc/tdscf/krhf_slow.py +0 -300
  352. pyscf/pbc/tdscf/krhf_slow_gamma.py +0 -175
  353. pyscf/pbc/tdscf/krhf_slow_supercell.py +0 -250
  354. pyscf/pbc/tdscf/proxy.py +0 -39
  355. pyscf/pbc/tdscf/rhf_slow.py +0 -35
  356. pyscf/tdscf/common_slow.py +0 -799
  357. pyscf/tdscf/proxy.py +0 -258
  358. pyscf/tdscf/rhf_slow.py +0 -181
  359. {pyscf-2.6.2.dist-info → pyscf-2.8.0.dist-info}/LICENSE +0 -0
  360. {pyscf-2.6.2.dist-info → pyscf-2.8.0.dist-info}/top_level.txt +0 -0
pyscf/pbc/scf/khf.py CHANGED
@@ -35,7 +35,6 @@ from pyscf.pbc.scf import hf as pbchf
35
35
  from pyscf import lib
36
36
  from pyscf.scf import hf as mol_hf
37
37
  from pyscf.lib import logger
38
- from pyscf.pbc.gto import ecp
39
38
  from pyscf.pbc.scf import addons
40
39
  from pyscf.pbc.scf import chkfile # noqa
41
40
  from pyscf.pbc import tools
@@ -79,6 +78,7 @@ def get_hcore(mf, cell=None, kpts=None):
79
78
  else:
80
79
  nuc = lib.asarray(mf.with_df.get_nuc(kpts))
81
80
  if len(cell._ecpbas) > 0:
81
+ from pyscf.pbc.gto import ecp
82
82
  nuc += lib.asarray(ecp.ecp_int(cell, kpts))
83
83
  t = lib.asarray(cell.pbc_intor('int1e_kin', 1, 1, kpts))
84
84
  return nuc + t
@@ -249,7 +249,7 @@ def energy_elec(mf, dm_kpts=None, h1e_kpts=None, vhf_kpts=None):
249
249
  mf.scf_summary['e1'] = e1.real
250
250
  mf.scf_summary['e2'] = e_coul.real
251
251
  logger.debug(mf, 'E1 = %s E_coul = %s', e1, e_coul)
252
- if CHECK_COULOMB_IMAG and abs(e_coul.imag > mf.cell.precision*10):
252
+ if CHECK_COULOMB_IMAG and abs(e_coul.imag) > mf.cell.precision*10:
253
253
  logger.warn(mf, "Coulomb energy has imaginary part %s. "
254
254
  "Coulomb integrals (e-e, e-N) may not converge !",
255
255
  e_coul.imag)
@@ -278,31 +278,36 @@ def analyze(mf, verbose=None, with_meta_lowdin=WITH_META_LOWDIN,
278
278
  #return mf.mulliken_pop(mf.cell, dm, s=ovlp_ao, verbose=verbose)
279
279
 
280
280
 
281
- def mulliken_meta(cell, dm_ao_kpts, verbose=logger.DEBUG,
281
+ def _make_rdm1_meta(cell, dm_ao_kpts, kpts, pre_orth_method, s):
282
+ from pyscf.lo import orth
283
+ from pyscf.pbc.tools import k2gamma
284
+
285
+ kmesh = k2gamma.kpts_to_kmesh(cell, kpts-kpts[0])
286
+ nkpts, nao = dm_ao_kpts.shape[:2]
287
+ scell, phase = k2gamma.get_phase(cell, kpts, kmesh)
288
+ s_sc = k2gamma.to_supercell_ao_integrals(cell, kpts, s, kmesh=kmesh, force_real=False)
289
+ orth_coeff = orth.orth_ao(scell, 'meta_lowdin', pre_orth_method, s=s_sc)[:,:nao] # cell 0 only
290
+ c_inv = np.dot(orth_coeff.T.conj(), s_sc)
291
+ c_inv = lib.einsum('aRp,Rk->kap', c_inv.reshape(nao,nkpts,nao), phase)
292
+ dm = lib.einsum('kap,kpq,kbq->ab', c_inv, dm_ao_kpts, c_inv.conj())
293
+
294
+ return dm
295
+
296
+
297
+ def mulliken_meta(cell, dm_ao_kpts, kpts, verbose=logger.DEBUG,
282
298
  pre_orth_method=PRE_ORTH_METHOD, s=None):
283
299
  '''A modified Mulliken population analysis, based on meta-Lowdin AOs.
284
-
285
- Note this function only computes the Mulliken population for the gamma
286
- point density matrix.
300
+ The results are equivalent to the corresponding supercell calculation.
287
301
  '''
288
- from pyscf.lo import orth
289
- if s is None:
290
- s = get_ovlp(cell)
291
302
  log = logger.new_logger(cell, verbose)
292
- log.note('Analyze output for *gamma point*')
293
- log.info(' To include the contributions from k-points, transform to a '
294
- 'supercell then run the population analysis on the supercell\n'
295
- ' from pyscf.pbc.tools import k2gamma\n'
296
- ' k2gamma.k2gamma(mf).mulliken_meta()')
297
- log.note("KRHF mulliken_meta")
298
- dm_ao_gamma = dm_ao_kpts[0,:,:].real
299
- s_gamma = s[0,:,:].real
300
- orth_coeff = orth.orth_ao(cell, 'meta_lowdin', pre_orth_method, s=s_gamma)
301
- c_inv = np.dot(orth_coeff.T, s_gamma)
302
- dm = reduce(np.dot, (c_inv, dm_ao_gamma, c_inv.T.conj()))
303
+
304
+ if s is None:
305
+ s = get_ovlp(None, cell=cell, kpts=kpts)
306
+
307
+ dm = _make_rdm1_meta(cell, dm_ao_kpts, kpts, pre_orth_method, s)
303
308
 
304
309
  log.note(' ** Mulliken pop on meta-lowdin orthogonal AOs **')
305
- return mol_hf.mulliken_pop(cell, dm, np.eye(orth_coeff.shape[0]), log)
310
+ return mol_hf.mulliken_pop(cell, dm, np.eye(dm.shape[0]), log)
306
311
 
307
312
 
308
313
  def canonicalize(mf, mo_coeff_kpts, mo_occ_kpts, fock=None):
@@ -469,6 +474,61 @@ class KSCF(pbchf.SCF):
469
474
  def mo_occ_kpts(self):
470
475
  return self.mo_occ
471
476
 
477
+ @property
478
+ def kpts(self):
479
+ if 'kpts' in self.__dict__:
480
+ # To handle the attribute kpt loaded from chkfile
481
+ self.kpts = self.__dict__.pop('kpts')
482
+ return self.with_df.kpts
483
+
484
+ @kpts.setter
485
+ def kpts(self, x):
486
+ self.with_df.kpts = np.reshape(x, (-1,3))
487
+ if self.rsjk:
488
+ self.rsjk.kpts = self.with_df.kpts
489
+
490
+ @property
491
+ def kmesh(self):
492
+ '''The number of k-points along each axis in the first Brillouin zone'''
493
+ from pyscf.pbc.tools.k2gamma import kpts_to_kmesh
494
+ kpts = self.kpts
495
+ kmesh = kpts_to_kmesh(kpts)
496
+ if len(kpts) != np.prod(kmesh):
497
+ logger.WARN(self, 'K-points specified in %s are not Monkhorst-Pack %s grids',
498
+ self, kmesh)
499
+ return kmesh
500
+
501
+ @kmesh.setter
502
+ def kmesh(self, x):
503
+ self.kpts = self.cell.make_kpts(x)
504
+
505
+ def build(self, cell=None):
506
+ # To handle the attribute kpt or kpts loaded from chkfile
507
+ if 'kpts' in self.__dict__:
508
+ self.kpts = self.__dict__.pop('kpts')
509
+
510
+ # "vcut_ws" precomputing is triggered by pbc.tools.pbc.get_coulG
511
+ #if self.exxdiv == 'vcut_ws':
512
+ # if self.exx_built is False:
513
+ # self.precompute_exx()
514
+ # logger.info(self, 'WS alpha = %s', self.exx_alpha)
515
+
516
+ kpts = self.kpts
517
+ if self.rsjk:
518
+ if not np.all(self.rsjk.kpts == kpts):
519
+ self.rsjk = self.rsjk.__class__(cell, kpts)
520
+
521
+ # for GDF and MDF
522
+ with_df = self.with_df
523
+ if len(kpts) > 1 and getattr(with_df, '_j_only', False):
524
+ logger.warn(self, 'df.j_only cannot be used with k-point HF')
525
+ with_df._j_only = False
526
+ with_df.reset()
527
+
528
+ if self.verbose >= logger.WARN:
529
+ self.check_sanity()
530
+ return self
531
+
472
532
  def dump_flags(self, verbose=None):
473
533
  mol_hf.SCF.dump_flags(self, verbose)
474
534
  logger.info(self, '\n')
@@ -611,9 +671,21 @@ class KSCF(pbchf.SCF):
611
671
  def from_chk(self, chk=None, project=None, kpts=None):
612
672
  return self.init_guess_by_chkfile(chk, project, kpts)
613
673
 
614
- def dump_chk(self, envs):
615
- if self.chkfile:
616
- mol_hf.SCF.dump_chk(self, envs)
674
+ def dump_chk(self, envs_or_file):
675
+ '''Serialize the SCF object and save it to the specified chkfile.
676
+
677
+ Args:
678
+ envs_or_file:
679
+ If this argument is a file path, the serialized SCF object is
680
+ saved to the file specified by this argument.
681
+ If this attribute is a dict (created by locals()), the necessary
682
+ variables are saved to the file specified by the attribute mf.chkfile.
683
+ '''
684
+ mol_hf.SCF.dump_chk(self, envs_or_file)
685
+ if isinstance(envs_or_file, str):
686
+ with lib.H5FileWrap(envs_or_file, 'a') as fh5:
687
+ fh5['scf/kpts'] = self.kpts
688
+ elif self.chkfile:
617
689
  with lib.H5FileWrap(self.chkfile, 'a') as fh5:
618
690
  fh5['scf/kpts'] = self.kpts
619
691
  return self
@@ -621,7 +693,7 @@ class KSCF(pbchf.SCF):
621
693
  def analyze(mf, verbose=None, with_meta_lowdin=WITH_META_LOWDIN, **kwargs):
622
694
  raise NotImplementedError
623
695
 
624
- def mulliken_meta(self, cell=None, dm=None, verbose=logger.DEBUG,
696
+ def mulliken_meta(self, cell=None, dm=None, kpts=None, verbose=logger.DEBUG,
625
697
  pre_orth_method=PRE_ORTH_METHOD, s=None):
626
698
  raise NotImplementedError
627
699
 
@@ -726,12 +798,13 @@ class KRHF(KSCF):
726
798
  return dm_kpts
727
799
 
728
800
  @lib.with_doc(mulliken_meta.__doc__)
729
- def mulliken_meta(self, cell=None, dm=None, verbose=logger.DEBUG,
801
+ def mulliken_meta(self, cell=None, dm=None, kpts=None, verbose=logger.DEBUG,
730
802
  pre_orth_method=PRE_ORTH_METHOD, s=None):
731
803
  if cell is None: cell = self.cell
732
804
  if dm is None: dm = self.make_rdm1()
805
+ if kpts is None: kpts = self.kpts
733
806
  if s is None: s = self.get_ovlp(cell)
734
- return mulliken_meta(cell, dm, s=s, verbose=verbose,
807
+ return mulliken_meta(cell, dm, kpts, s=s, verbose=verbose,
735
808
  pre_orth_method=pre_orth_method)
736
809
 
737
810
  def nuc_grad_method(self):
@@ -741,9 +814,10 @@ class KRHF(KSCF):
741
814
  def stability(self,
742
815
  internal=getattr(__config__, 'pbc_scf_KSCF_stability_internal', True),
743
816
  external=getattr(__config__, 'pbc_scf_KSCF_stability_external', False),
744
- verbose=None):
817
+ verbose=None,
818
+ return_status=False):
745
819
  from pyscf.pbc.scf.stability import rhf_stability
746
- return rhf_stability(self, internal, external, verbose)
820
+ return rhf_stability(self, internal, external, verbose, return_status)
747
821
 
748
822
  def to_ks(self, xc='HF'):
749
823
  '''Convert to RKS object.
@@ -76,7 +76,7 @@ def energy_elec(mf, dm_kpts=None, h1e_kpts=None, vhf_kpts=None):
76
76
  mf.scf_summary['e1'] = e1.real
77
77
  mf.scf_summary['e2'] = e_coul.real
78
78
  logger.debug(mf, 'E1 = %s E_coul = %s', e1, e_coul)
79
- if khf.CHECK_COULOMB_IMAG and abs(e_coul.imag > mf.cell.precision*10):
79
+ if khf.CHECK_COULOMB_IMAG and abs(e_coul.imag) > mf.cell.precision*10:
80
80
  logger.warn(mf, "Coulomb energy has imaginary part %s. "
81
81
  "Coulomb integrals (e-e, e-N) may not converge !",
82
82
  e_coul.imag)
@@ -166,6 +166,20 @@ class KsymAdaptedKSCF(khf.KSCF):
166
166
  self.with_df.kpts = np.reshape(kpts_bz, (-1,3))
167
167
  self._kpts = kpts
168
168
 
169
+ @property
170
+ def kmesh(self):
171
+ from pyscf.pbc.tools.k2gamma import kpts_to_kmesh
172
+ kpts_bz = self._kpts.kpts
173
+ kmesh = kpts_to_kmesh(kpts_bz)
174
+ if len(kpts_bz) != np.prod(kmesh):
175
+ logger.WARN(self, 'K-points specified in %s are not Monkhorst-Pack %s grids',
176
+ self, kmesh)
177
+ return kmesh
178
+
179
+ @kmesh.setter
180
+ def kmesh(self, x):
181
+ self.kpts = self.cell.make_kpts(x)
182
+
169
183
  def dump_flags(self, verbose=None):
170
184
  mol_hf.SCF.dump_flags(self, verbose)
171
185
  logger.info(self, '\n')
pyscf/pbc/scf/krohf.py CHANGED
@@ -211,15 +211,12 @@ get_rho = kuhf.get_rho
211
211
 
212
212
 
213
213
  @lib.with_doc(khf.mulliken_meta.__doc__)
214
- def mulliken_meta(cell, dm_ao_kpts, verbose=logger.DEBUG,
214
+ def mulliken_meta(cell, dm_ao_kpts, kpts, verbose=logger.DEBUG,
215
215
  pre_orth_method=PRE_ORTH_METHOD, s=None):
216
216
  '''Mulliken population analysis, based on meta-Lowdin AOs.
217
-
218
- Note this function only computes the Mulliken population for the gamma
219
- point density matrix.
220
217
  '''
221
218
  dm = dm_ao_kpts[0] + dm_ao_kpts[1]
222
- return khf.mulliken_meta(cell, dm, verbose, pre_orth_method, s)
219
+ return khf.mulliken_meta(cell, dm, kpts, verbose, pre_orth_method, s)
223
220
 
224
221
 
225
222
  def canonicalize(mf, mo_coeff_kpts, mo_occ_kpts, fock=None):
@@ -362,12 +359,13 @@ class KROHF(khf.KRHF):
362
359
  if kpts is None: kpts = self.kpts
363
360
  return init_guess_by_chkfile(self.cell, chk, project, kpts)
364
361
 
365
- def mulliken_meta(self, cell=None, dm=None, verbose=logger.DEBUG,
362
+ def mulliken_meta(self, cell=None, dm=None, kpts=None, verbose=logger.DEBUG,
366
363
  pre_orth_method=PRE_ORTH_METHOD, s=None):
367
364
  if cell is None: cell = self.cell
368
365
  if dm is None: dm = self.make_rdm1()
366
+ if kpts is None: kpts = self.kpts
369
367
  if s is None: s = self.get_ovlp(cell)
370
- return mulliken_meta(cell, dm, s=s, verbose=verbose,
368
+ return mulliken_meta(cell, dm, kpts, s=s, verbose=verbose,
371
369
  pre_orth_method=pre_orth_method)
372
370
 
373
371
  def stability(self,
pyscf/pbc/scf/kuhf.py CHANGED
@@ -209,39 +209,59 @@ def energy_elec(mf, dm_kpts=None, h1e_kpts=None, vhf_kpts=None):
209
209
  mf.scf_summary['e1'] = e1.real
210
210
  mf.scf_summary['e2'] = e_coul.real
211
211
  logger.debug(mf, 'E1 = %s E_coul = %s', e1, e_coul)
212
- if CHECK_COULOMB_IMAG and abs(e_coul.imag > mf.cell.precision*10):
212
+ if CHECK_COULOMB_IMAG and abs(e_coul.imag) > mf.cell.precision*10:
213
213
  logger.warn(mf, "Coulomb energy has imaginary part %s. "
214
214
  "Coulomb integrals (e-e, e-N) may not converge !",
215
215
  e_coul.imag)
216
216
  return (e1+e_coul).real, e_coul.real
217
217
 
218
218
 
219
- def mulliken_meta(cell, dm_ao_kpts, verbose=logger.DEBUG,
219
+ def _make_rdm1_meta(cell, dm_ao_kpts, kpts, pre_orth_method, s):
220
+ from pyscf.lo import orth
221
+ from pyscf.pbc.tools import k2gamma
222
+
223
+ kmesh = k2gamma.kpts_to_kmesh(cell, kpts-kpts[0])
224
+ nkpts, nao = dm_ao_kpts[0].shape[:2]
225
+ scell, phase = k2gamma.get_phase(cell, kpts, kmesh)
226
+ s_sc = k2gamma.to_supercell_ao_integrals(cell, kpts, s, kmesh=kmesh, force_real=False)
227
+ orth_coeff = orth.orth_ao(scell, 'meta_lowdin', pre_orth_method, s=s_sc)[:,:nao] # cell 0 only
228
+ c_inv = np.dot(orth_coeff.T.conj(), s_sc)
229
+ c_inv = lib.einsum('aRp,Rk->kap', c_inv.reshape(nao,nkpts,nao), phase)
230
+ dm_a = lib.einsum('kap,kpq,kbq->ab', c_inv, dm_ao_kpts[0], c_inv.conj())
231
+ dm_b = lib.einsum('kap,kpq,kbq->ab', c_inv, dm_ao_kpts[1], c_inv.conj())
232
+
233
+ return (dm_a, dm_b)
234
+
235
+
236
+ def mulliken_meta(cell, dm_ao_kpts, kpts, verbose=logger.DEBUG,
220
237
  pre_orth_method=PRE_ORTH_METHOD, s=None):
221
238
  '''A modified Mulliken population analysis, based on meta-Lowdin AOs.
222
-
223
- Note this function only computes the Mulliken population for the gamma
224
- point density matrix.
239
+ The results are equivalent to the corresponding supercell calculation.
225
240
  '''
226
- from pyscf.lo import orth
241
+ log = logger.new_logger(cell, verbose)
242
+
227
243
  if s is None:
228
- s = khf.get_ovlp(cell)
244
+ s = khf.get_ovlp(None, cell=cell, kpts=kpts)
245
+
246
+ dm_a, dm_b = _make_rdm1_meta(cell, dm_ao_kpts, kpts, pre_orth_method, s)
247
+
248
+ log.note(' ** Mulliken pop alpha/beta on meta-lowdin orthogonal AOs **')
249
+ return mol_uhf.mulliken_pop(cell, (dm_a,dm_b), np.eye(dm_a.shape[0]), log)
250
+
251
+
252
+ def mulliken_meta_spin(cell, dm_ao_kpts, kpts, verbose=logger.DEBUG,
253
+ pre_orth_method=PRE_ORTH_METHOD, s=None):
254
+ '''A modified Mulliken population analysis, based on meta-Lowdin AOs.
255
+ '''
229
256
  log = logger.new_logger(cell, verbose)
230
- log.note('Analyze output for *gamma point*.')
231
- log.info(' To include the contributions from k-points, transform to a '
232
- 'supercell then run the population analysis on the supercell\n'
233
- ' from pyscf.pbc.tools import k2gamma\n'
234
- ' k2gamma.k2gamma(mf).mulliken_meta()')
235
- log.note("KUHF mulliken_meta")
236
- dm_ao_gamma = dm_ao_kpts[:,0,:,:].real
237
- s_gamma = s[0,:,:].real
238
- orth_coeff = orth.orth_ao(cell, 'meta_lowdin', pre_orth_method, s=s_gamma)
239
- c_inv = np.dot(orth_coeff.T, s_gamma)
240
- dm_a = reduce(np.dot, (c_inv, dm_ao_gamma[0], c_inv.T.conj()))
241
- dm_b = reduce(np.dot, (c_inv, dm_ao_gamma[1], c_inv.T.conj()))
257
+
258
+ if s is None:
259
+ s = khf.get_ovlp(None, cell=cell, kpts=kpts)
260
+
261
+ dm_a, dm_b = _make_rdm1_meta(cell, dm_ao_kpts, kpts, pre_orth_method, s)
242
262
 
243
263
  log.note(' ** Mulliken pop alpha/beta on meta-lowdin orthogonal AOs **')
244
- return mol_uhf.mulliken_pop(cell, (dm_a,dm_b), np.eye(orth_coeff.shape[0]), log)
264
+ return mol_uhf.mulliken_spin_pop(cell, (dm_a,dm_b), np.eye(dm_a.shape[0]), log)
245
265
 
246
266
 
247
267
  def canonicalize(mf, mo_coeff_kpts, mo_occ_kpts, fock=None):
@@ -369,6 +389,7 @@ class KUHF(khf.KSCF):
369
389
  '''UHF class with k-point sampling.
370
390
  '''
371
391
  conv_tol_grad = getattr(__config__, 'pbc_scf_KSCF_conv_tol_grad', None)
392
+ init_guess_breaksym = getattr(__config__, 'scf_uhf_init_guess_breaksym', 1)
372
393
 
373
394
  _keys = {"init_guess_breaksym"}
374
395
 
@@ -390,7 +411,6 @@ class KUHF(khf.KSCF):
390
411
  exxdiv=getattr(__config__, 'pbc_scf_SCF_exxdiv', 'ewald')):
391
412
  khf.KSCF.__init__(self, cell, kpts, exxdiv)
392
413
  self.nelec = None
393
- self.init_guess_breaksym = None
394
414
 
395
415
  @property
396
416
  def nelec(self):
@@ -509,14 +529,25 @@ class KUHF(khf.KSCF):
509
529
  return init_guess_by_chkfile(self.cell, chk, project, kpts)
510
530
 
511
531
  @lib.with_doc(mulliken_meta.__doc__)
512
- def mulliken_meta(self, cell=None, dm=None, verbose=logger.DEBUG,
532
+ def mulliken_meta(self, cell=None, dm=None, kpts=None, verbose=logger.DEBUG,
513
533
  pre_orth_method=PRE_ORTH_METHOD, s=None):
514
534
  if cell is None: cell = self.cell
515
535
  if dm is None: dm = self.make_rdm1()
536
+ if kpts is None: kpts = self.kpts
516
537
  if s is None: s = self.get_ovlp(cell)
517
- return mulliken_meta(cell, dm, s=s, verbose=verbose,
538
+ return mulliken_meta(cell, dm, kpts, s=s, verbose=verbose,
518
539
  pre_orth_method=pre_orth_method)
519
540
 
541
+ @lib.with_doc(mulliken_meta_spin.__doc__)
542
+ def mulliken_meta_spin(self, cell=None, dm=None, kpts=None, verbose=logger.DEBUG,
543
+ pre_orth_method=PRE_ORTH_METHOD, s=None):
544
+ if cell is None: cell = self.cell
545
+ if dm is None: dm = self.make_rdm1()
546
+ if kpts is None: kpts = self.kpts
547
+ if s is None: s = self.get_ovlp(cell)
548
+ return mulliken_meta_spin(cell, dm, kpts, s=s, verbose=verbose,
549
+ pre_orth_method=pre_orth_method)
550
+
520
551
  def mulliken_pop(self):
521
552
  raise NotImplementedError
522
553
 
@@ -102,7 +102,7 @@ def energy_elec(mf, dm_kpts=None, h1e_kpts=None, vhf_kpts=None):
102
102
  mf.scf_summary['e1'] = e1.real
103
103
  mf.scf_summary['e2'] = e_coul.real
104
104
  logger.debug(mf, 'E1 = %s E_coul = %s', e1, e_coul)
105
- if kuhf.CHECK_COULOMB_IMAG and abs(e_coul.imag > mf.cell.precision*10):
105
+ if kuhf.CHECK_COULOMB_IMAG and abs(e_coul.imag) > mf.cell.precision*10:
106
106
  logger.warn(mf, "Coulomb energy has imaginary part %s. "
107
107
  "Coulomb integrals (e-e, e-N) may not converge !",
108
108
  e_coul.imag)
pyscf/pbc/scf/rsjk.py CHANGED
@@ -96,6 +96,11 @@ class RangeSeparatedJKBuilder(lib.StreamObject):
96
96
  self._last_vs = (0, 0)
97
97
  self._qindex = None
98
98
 
99
+ __getstate__, __setstate__ = lib.generate_pickle_methods(
100
+ excludes=('rs_cell', 'cell_d', 'supmol_sr', 'supmol_ft', 'supmol_d',
101
+ '_sr_without_dddd', '_last_vs', '_qindex'),
102
+ reset_state=True)
103
+
99
104
  def has_long_range(self):
100
105
  '''Whether to add the long-range part computed with AFT/FFT integrals'''
101
106
  return self.omega is None or abs(self.cell.omega) < self.omega
@@ -123,8 +128,7 @@ class RangeSeparatedJKBuilder(lib.StreamObject):
123
128
  self.supmol_sr = None
124
129
  self.supmol_ft = None
125
130
  self.supmol_d = None
126
- self.exclude_dd_block = True
127
- self.approx_vk_lr_missing_mo = False
131
+ self._sr_without_dddd = None
128
132
  self._last_vs = (0, 0)
129
133
  self._qindex = None
130
134
  return self
@@ -361,7 +365,7 @@ class RangeSeparatedJKBuilder(lib.StreamObject):
361
365
 
362
366
  cache_size = _get_cache_size(cell, 'int2e_sph')
363
367
  cell0_dims = cell0_ao_loc[1:] - cell0_ao_loc[:-1]
364
- cache_size += cell0_dims.max()**4 * comp * 2
368
+ cache_size += int(cell0_dims.max())**4 * comp * 2
365
369
 
366
370
  if hermi:
367
371
  fdot_suffix = 's2kl'
@@ -422,7 +426,7 @@ class RangeSeparatedJKBuilder(lib.StreamObject):
422
426
  subset_only = intersection(kpts, kpts_band).size == len(kpts_band)
423
427
  if not subset_only:
424
428
  log.warn('Approximate J/K matrices at kpts_band '
425
- 'with the bvk-cell dervied from kpts')
429
+ 'with the bvk-cell derived from kpts')
426
430
  expLk = np.exp(1j*np.dot(supmol.bvkmesh_Ls, kpts_band.T))
427
431
  vs = lib.einsum('snpRq,Rk->snkpq', vs, expLk)
428
432
  vs = np.asarray(vs, order='C')
@@ -595,10 +599,10 @@ class RangeSeparatedJKBuilder(lib.StreamObject):
595
599
 
596
600
  if (cell.dimension == 3 or
597
601
  (cell.dimension == 2 and cell.low_dim_ft_type != 'inf_vacuum')):
598
- G0_idx = 0 # due to np.fft.fftfreq convension
602
+ G0_idx = 0 # due to np.fft.fftfreq convention
599
603
  # G=0 associated to 2e integrals in real-space
600
604
  coulG_SR_at_G0 = np.pi/self.omega**2
601
- # For cell.dimension = 2, coulG is computed with truncated coulomb
605
+ # For cell.dimension = 2, coulG is computed with truncated Coulomb
602
606
  # interactions. The 3d coulG_SR below is to remove the analytical
603
607
  # SR from get_jk_sr (which was computed with full Coulomb) then to
604
608
  # add truncated Coulomb for AFT part.
@@ -1084,7 +1088,7 @@ class RangeSeparatedJKBuilder(lib.StreamObject):
1084
1088
 
1085
1089
  if self._sr_without_dddd and naod > 0:
1086
1090
  # (DD|DD) with full coulG, rest terms with coulG_LR
1087
- log.debug1('ft_aopair dd-blcok for dddd-block ERI')
1091
+ log.debug1('ft_aopair dd-block for dddd-block ERI')
1088
1092
  if cell.dimension < 2:
1089
1093
  raise NotImplementedError
1090
1094
  if cell.dimension == 2 and cell.low_dim_ft_type == 'inf_vacuum':
@@ -1271,7 +1275,7 @@ def _guess_omega(cell, kpts, mesh=None):
1271
1275
  nk = (cell.nao/25 * nkpts)**(1./3)
1272
1276
  ke_cutoff = 50 / (.7+.25*nk+.05*nk**3)
1273
1277
  ke_cutoff = max(ke_cutoff, ke_min)
1274
- # avoid large omega since nuermical issues were found in Rys
1278
+ # avoid large omega since numerical issues were found in Rys
1275
1279
  # polynomials when computing SR integrals with nroots > 3
1276
1280
  exps = [e for l, e in zip(cell._bas[:,gto.ANG_OF], cell.bas_exps()) if l != 0]
1277
1281
  if exps:
@@ -1299,11 +1303,11 @@ def estimate_ke_cutoff_for_omega(cell, omega, precision=None):
1299
1303
  return Ecut
1300
1304
 
1301
1305
  def estimate_omega_for_ke_cutoff(cell, ke_cutoff, precision=None):
1302
- '''The minimal omega in attenuated Coulombl given energy cutoff
1306
+ '''The minimal omega in attenuated Coulomb given energy cutoff
1303
1307
  '''
1304
1308
  if precision is None:
1305
1309
  precision = cell.precision
1306
- # # esitimation based on \int dk 4pi/k^2 exp(-k^2/4omega) sometimes is not
1310
+ # # estimation based on \int dk 4pi/k^2 exp(-k^2/4omega) sometimes is not
1307
1311
  # # enough to converge the 2-electron integrals. A penalty term here is to
1308
1312
  # # reduce the error in integrals
1309
1313
  # precision *= 1e-2
pyscf/pbc/scf/scfint.py CHANGED
@@ -31,7 +31,7 @@ import numpy as np
31
31
  import pyscf.pbc.scf
32
32
  from pyscf.pbc import gto as pgto
33
33
 
34
- print('This module is deporacted and will be removed in future release. '
34
+ print('This module is deprecated and will be removed in future release. '
35
35
  'Please use cell.pbc_intor and pbc.hf.get_hcore.')
36
36
 
37
37
  def get_hcore(cell, kpt=None):
@@ -33,13 +33,17 @@ from pyscf.lib import logger
33
33
  from pyscf.pbc.scf import newton_ah
34
34
  from pyscf.pbc.scf import _response_functions # noqa
35
35
 
36
- def rhf_stability(mf, internal=True, external=False, verbose=None):
36
+ def rhf_stability(mf, internal=True, external=False, verbose=None, return_status=False):
37
37
  mo_i = mo_e = None
38
+ stable_i = stable_e = None
38
39
  if internal:
39
- mo_i = rhf_internal(mf, verbose=verbose)
40
+ mo_i, stable_i = rhf_internal(mf, verbose=verbose, return_status=True)
40
41
  if external:
41
- mo_e = rhf_external(mf, verbose=verbose)
42
- return mo_i, mo_e
42
+ mo_e, stable_e = rhf_external(mf, verbose=verbose, return_status=True)
43
+ if return_status:
44
+ return mo_i, mo_e, stable_i, stable_e
45
+ else:
46
+ return mo_i, mo_e
43
47
 
44
48
  def uhf_stability(mf, internal=True, external=False, verbose=None):
45
49
  mo_i = mo_e = None
@@ -49,7 +53,7 @@ def uhf_stability(mf, internal=True, external=False, verbose=None):
49
53
  mo_e = uhf_external(mf, verbose=verbose)
50
54
  return mo_i, mo_e
51
55
 
52
- def rhf_internal(mf, verbose=None):
56
+ def rhf_internal(mf, verbose=None, return_status=False):
53
57
  log = logger.new_logger(mf, verbose)
54
58
  g, hop, hdiag = newton_ah.gen_g_hop_rhf(mf, mf.mo_coeff, mf.mo_occ)
55
59
  def precond(dx, e, x0):
@@ -59,7 +63,7 @@ def rhf_internal(mf, verbose=None):
59
63
  # The results of hop(x) corresponds to a displacement that reduces
60
64
  # gradients g. It is the vir-occ block of the matrix vector product
61
65
  # (Hessian*x). The occ-vir block equals to x2.T.conj(). The overall
62
- # Hessian for internal reotation is x2 + x2.T.conj(). This is
66
+ # Hessian for internal rotation is x2 + x2.T.conj(). This is
63
67
  # the reason we apply (.real * 2) below
64
68
  def hessian_x(x):
65
69
  return hop(x).real * 2
@@ -67,13 +71,17 @@ def rhf_internal(mf, verbose=None):
67
71
  x0 = numpy.zeros_like(g)
68
72
  x0[g!=0] = 1. / hdiag[g!=0]
69
73
  e, v = lib.davidson(hessian_x, x0, precond, tol=1e-4, verbose=log)
70
- if e < -1e-5:
74
+ stable = not (e < -1e-5)
75
+ if stable:
76
+ log.log('KRHF/KRKS wavefunction is stable in the internal stability analysis')
77
+ mo = mf.mo_coeff
78
+ else:
71
79
  log.log('KRHF/KRKS wavefunction has an internal instability')
72
80
  mo = _rotate_mo(mf.mo_coeff, mf.mo_occ, v)
81
+ if return_status:
82
+ return mo, stable
73
83
  else:
74
- log.log('KRHF/KRKS wavefunction is stable in the internal stability analysis')
75
- mo = mf.mo_coeff
76
- return mo
84
+ return mo
77
85
 
78
86
  def _rotate_mo(mo_coeff, mo_occ, dx):
79
87
  mo = []
@@ -142,7 +150,7 @@ def _gen_hop_rhf_external(mf, verbose=None):
142
150
  return hop_rhf2uhf, hdiag
143
151
 
144
152
 
145
- def rhf_external(mf, verbose=None):
153
+ def rhf_external(mf, verbose=None, return_status=False):
146
154
  log = logger.new_logger(mf, verbose)
147
155
  hop2, hdiag2 = _gen_hop_rhf_external(mf)
148
156
 
@@ -153,13 +161,17 @@ def rhf_external(mf, verbose=None):
153
161
  x0 = numpy.zeros_like(hdiag2)
154
162
  x0[hdiag2>1e-5] = 1. / hdiag2[hdiag2>1e-5]
155
163
  e3, v3 = lib.davidson(hop2, x0, precond, tol=1e-4, verbose=log)
156
- if e3 < -1e-5:
164
+ stable = not (e3 < -1e-5)
165
+ if stable:
166
+ log.log('KRHF/KRKS wavefunction is stable in the KRHF/KRKS -> KUHF/KUKS stability analysis')
167
+ mo = (mf.mo_coeff, mf.mo_coeff)
168
+ else:
157
169
  log.log('KRHF/KRKS wavefunction has an KRHF/KRKS -> KUHF/KUKS instability.')
158
170
  mo = (_rotate_mo(mf.mo_coeff, mf.mo_occ, v3), mf.mo_coeff)
171
+ if return_status:
172
+ return mo, stable
159
173
  else:
160
- log.log('KRHF/KRKS wavefunction is stable in the KRHF/KRKS -> KUHF/KUKS stability analysis')
161
- mo = (mf.mo_coeff, mf.mo_coeff)
162
- return mo
174
+ return mo
163
175
 
164
176
  def uhf_internal(mf, verbose=None):
165
177
  log = logger.new_logger(mf, verbose)
pyscf/pbc/scf/uhf.py CHANGED
@@ -107,6 +107,8 @@ get_rho = pbchf.get_rho
107
107
  class UHF(pbchf.SCF):
108
108
  '''UHF class for PBCs.
109
109
  '''
110
+ init_guess_breaksym = getattr(__config__, 'scf_uhf_init_guess_breaksym', 1)
111
+
110
112
  _keys = {"init_guess_breaksym"}
111
113
 
112
114
  init_guess_by_minao = mol_uhf.UHF.init_guess_by_minao
@@ -125,6 +127,7 @@ class UHF(pbchf.SCF):
125
127
  analyze = mol_uhf.UHF.analyze
126
128
  mulliken_pop = mol_uhf.UHF.mulliken_pop
127
129
  mulliken_meta = mol_uhf.UHF.mulliken_meta
130
+ mulliken_meta_spin = mol_uhf.UHF.mulliken_meta_spin
128
131
  canonicalize = mol_uhf.UHF.canonicalize
129
132
  spin_square = mol_uhf.UHF.spin_square
130
133
  stability = mol_uhf.UHF.stability
@@ -134,7 +137,6 @@ class UHF(pbchf.SCF):
134
137
  exxdiv=getattr(__config__, 'pbc_scf_SCF_exxdiv', 'ewald')):
135
138
  pbchf.SCF.__init__(self, cell, kpt, exxdiv)
136
139
  self.nelec = None
137
- self.init_guess_breaksym = None
138
140
 
139
141
  @property
140
142
  def nelec(self):
@@ -146,7 +146,7 @@ class Symmetry():
146
146
  nop : int
147
147
  Length of `ops`.
148
148
  Dmats : list of 2d arrays
149
- Wigner D-matries
149
+ Wigner D-matrices
150
150
  l_max : int
151
151
  Maximum angular momentum considered in `Dmats`
152
152
  '''
@@ -193,7 +193,7 @@ class Symmetry():
193
193
  self.ops = ops
194
194
 
195
195
  self.nop = len(self.ops)
196
- self.has_inversion = any([op.rot_is_inversion for op in self.ops])
196
+ self.has_inversion = any(op.rot_is_inversion for op in self.ops)
197
197
 
198
198
  l_max = None
199
199
  if 'auxcell' in kwargs: