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/adc/uadc.py CHANGED
@@ -12,9 +12,11 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  #
15
- # Author: Samragni Banerjee <samragnibanerjee4@gmail.com>
15
+ # Author: Abdelrahman Ahmed <>
16
+ # Samragni Banerjee <samragnibanerjee4@gmail.com>
17
+ # James Serna <jamcar456@gmail.com>
18
+ # Terrence Stahl <>
16
19
  # Alexander Sokolov <alexander.y.sokolov@gmail.com>
17
- #
18
20
 
19
21
  '''
20
22
  Unrestricted algebraic diagrammatic construction
@@ -29,6 +31,7 @@ from pyscf.adc import radc_ao2mo
29
31
  from pyscf.adc import dfadc
30
32
  from pyscf import __config__
31
33
  from pyscf import df
34
+ from pyscf import scf
32
35
 
33
36
 
34
37
  # Excited-state kernel
@@ -44,13 +47,17 @@ def kernel(adc, nroots=1, guess=None, eris=None, verbose=None):
44
47
  adc.check_sanity()
45
48
  adc.dump_flags()
46
49
 
50
+ if isinstance(adc._scf, scf.rohf.ROHF) and (adc.method_type == "ip" or adc.method_type == "ea"):
51
+ logger.warn(
52
+ adc, "EA/IP-ADC with the ROHF reference do not incorporate the occ-vir Fock matrix elements...")
53
+
47
54
  if eris is None:
48
55
  eris = adc.transform_integrals()
49
56
 
50
57
  imds = adc.get_imds(eris)
51
58
  matvec, diag = adc.gen_matvec(imds, eris)
52
59
 
53
- guess = adc.get_init_guess(nroots, diag, ascending=True)
60
+ guess = adc.get_init_guess(nroots, diag, ascending = True)
54
61
 
55
62
  conv, adc.E, U = lib.linalg_helper.davidson1(
56
63
  lambda xs : [matvec(x) for x in xs],
@@ -61,7 +68,6 @@ def kernel(adc, nroots=1, guess=None, eris=None, verbose=None):
61
68
 
62
69
  if adc.compute_properties:
63
70
  adc.P,adc.X = adc.get_properties(nroots)
64
-
65
71
  nfalse = np.shape(conv)[0] - np.sum(conv)
66
72
 
67
73
  header = ("\n*************************************************************"
@@ -69,17 +75,17 @@ def kernel(adc, nroots=1, guess=None, eris=None, verbose=None):
69
75
  "\n*************************************************************")
70
76
  logger.info(adc, header)
71
77
 
72
- if nfalse >= 1:
73
- logger.warn(adc, "Davidson iterations for " + str(nfalse) + " root(s) not converged\n")
74
-
75
78
  for n in range(nroots):
76
79
  print_string = ('%s root %d | Energy (Eh) = %14.10f | Energy (eV) = %12.8f ' %
77
80
  (adc.method, n, adc.E[n], adc.E[n]*27.2114))
78
81
  if adc.compute_properties:
79
- print_string += ("| Spec factors = %10.8f " % adc.P[n])
82
+ print_string += ("| Spec. factor = %10.8f " % adc.P[n])
80
83
  print_string += ("| conv = %s" % conv[n])
81
84
  logger.info(adc, print_string)
82
85
 
86
+ if nfalse >= 1:
87
+ logger.warn(adc, "Davidson iterations for " + str(nfalse) + " root(s) did not converge!!!")
88
+
83
89
  log.timer('ADC', *cput0)
84
90
 
85
91
  return adc.E, adc.U, adc.P, adc.X
@@ -114,14 +120,13 @@ class UADC(lib.StreamObject):
114
120
  incore_complete = getattr(__config__, 'adc_uadc_UADC_incore_complete', False)
115
121
 
116
122
  _keys = {
117
- 'tol_residual','conv_tol', 'e_corr', 'method',
118
- 'method_type', 'mo_coeff', 'mol', 'mo_energy_b',
119
- 'scf_energy', 'e_tot', 't1', 'frozen',
120
- 'mo_energy_a', 'chkfile', 'max_space', 't2', 'mo_occ', 'max_cycle',
121
- 'incore_complete', 'mo_energy_a', 'mo_energy_b', 'with_df',
122
- 'compute_mpn_energy', 'compute_spec', 'compute_properties',
123
+ 'tol_residual','conv_tol', 'e_corr', 'method', 'method_type', 'mo_coeff',
124
+ 'mol', 'mo_energy_a', 'mo_energy_b', 'incore_complete',
125
+ 'scf_energy', 'e_tot', 't1', 't2', 'frozen', 'chkfile',
126
+ 'max_space', 'mo_occ', 'max_cycle', 'imds', 'with_df', 'compute_properties',
123
127
  'approx_trans_moments', 'evec_print_tol', 'spec_factor_print_tol',
124
- 'E', 'U', 'P', 'X', 'ncvs',
128
+ 'E', 'U', 'P', 'X', 'ncvs', 'dip_mom', 'dip_mom_nuc',
129
+ 'spin_c', 'f_ov'
125
130
  }
126
131
 
127
132
  def __init__(self, mf, frozen=None, mo_coeff=None, mo_occ=None):
@@ -144,12 +149,59 @@ class UADC(lib.StreamObject):
144
149
  self.max_space = getattr(__config__, 'adc_uadc_UADC_max_space', 12)
145
150
  self.max_cycle = getattr(__config__, 'adc_uadc_UADC_max_cycle', 50)
146
151
  self.conv_tol = getattr(__config__, 'adc_uadc_UADC_conv_tol', 1e-12)
147
- self.tol_residual = getattr(__config__, 'adc_uadc_UADC_tol_res', 1e-6)
148
-
152
+ self.tol_residual = getattr(__config__, 'adc_uadc_UADC_tol_residual', 1e-6)
149
153
  self.scf_energy = mf.e_tot
154
+
150
155
  self.frozen = frozen
151
156
  self.incore_complete = self.incore_complete or self.mol.incore_anyway
152
157
 
158
+ self.f_ov = None
159
+
160
+ if isinstance(mf, scf.rohf.ROHF):
161
+
162
+ logger.info(mf, "\nROHF reference detected in ADC, semicanonicalizing the orbitals...")
163
+
164
+ mo_a = mo_coeff.copy()
165
+ nalpha = mf.mol.nelec[0]
166
+ nbeta = mf.mol.nelec[1]
167
+
168
+ h1e = mf.get_hcore()
169
+ dm = mf.make_rdm1()
170
+ vhf = mf.get_veff(mf.mol, dm)
171
+
172
+ fock_a = h1e + vhf[0]
173
+ fock_b = h1e + vhf[1]
174
+
175
+ if nalpha > nbeta:
176
+ ndocc = nbeta
177
+ nsocc = nalpha - nbeta
178
+ else:
179
+ ndocc = nalpha
180
+ nsocc = nbeta - nalpha
181
+
182
+ fock_a = np.dot(mo_a.T,np.dot(fock_a, mo_a))
183
+ fock_b = np.dot(mo_a.T,np.dot(fock_b, mo_a))
184
+
185
+ # Semicanonicalize Ca using fock_a, nocc_a -> Ca, mo_energy_a, U_a, f_ov_a
186
+ mo_a, mo_energy_a, f_ov_a, f_aa = self.semi_canonicalize_orbitals(
187
+ fock_a, ndocc + nsocc, mo_a)
188
+
189
+ # Semicanonicalize Cb using fock_b, nocc_b -> Cb, mo_energy_b, U_b, f_ov_b
190
+ mo_b, mo_energy_b, f_ov_b, f_bb = self.semi_canonicalize_orbitals(fock_b, ndocc, mo_a)
191
+
192
+ mo_coeff = [mo_a, mo_b]
193
+
194
+ f_ov = [f_ov_a, f_ov_b]
195
+
196
+ self.f_ov = f_ov
197
+ self.spin_c = True
198
+ self.mo_energy_a = mo_energy_a.copy()
199
+ self.mo_energy_b = mo_energy_b.copy()
200
+
201
+ else:
202
+ self.mo_energy_a = mf.mo_energy[0]
203
+ self.mo_energy_b = mf.mo_energy[1]
204
+
153
205
  self.mo_coeff = mo_coeff
154
206
  self.mo_occ = mo_occ
155
207
  self.e_corr = None
@@ -159,28 +211,66 @@ class UADC(lib.StreamObject):
159
211
  self._nocc = mf.nelec
160
212
  self._nmo = (mo_coeff[0].shape[1], mo_coeff[1].shape[1])
161
213
  self._nvir = (self._nmo[0] - self._nocc[0], self._nmo[1] - self._nocc[1])
162
- self.mo_energy_a = mf.mo_energy[0]
163
- self.mo_energy_b = mf.mo_energy[1]
164
214
  self.chkfile = mf.chkfile
165
215
  self.method = "adc(2)"
166
216
  self.method_type = "ip"
167
217
  self.with_df = None
168
- self.compute_mpn_energy = True
169
- self.compute_spec = True
170
218
  self.compute_properties = True
171
219
  self.approx_trans_moments = False
172
220
  self.evec_print_tol = 0.1
173
221
  self.spec_factor_print_tol = 0.1
222
+ self.ncvs = None
223
+
174
224
  self.E = None
175
225
  self.U = None
176
226
  self.P = None
177
227
  self.X = (None,)
178
- self.ncvs = None
228
+
229
+ self.spin_c = False
230
+
231
+ dip_ints = -self.mol.intor('int1e_r',comp=3)
232
+ dip_mom_a = np.zeros((dip_ints.shape[0], self._nmo[0], self._nmo[0]))
233
+ dip_mom_b = np.zeros((dip_ints.shape[0], self._nmo[1], self._nmo[1]))
234
+
235
+ for i in range(dip_ints.shape[0]):
236
+ dip = dip_ints[i,:,:]
237
+ dip_mom_a[i,:,:] = np.dot(mo_coeff[0].T, np.dot(dip, mo_coeff[0]))
238
+ dip_mom_b[i,:,:] = np.dot(mo_coeff[1].T, np.dot(dip, mo_coeff[1]))
239
+
240
+ self.dip_mom = []
241
+ self.dip_mom.append(dip_mom_a)
242
+ self.dip_mom.append(dip_mom_b)
243
+
244
+ charges = self.mol.atom_charges()
245
+ coords = self.mol.atom_coords()
246
+ self.dip_mom_nuc = lib.einsum('i,ix->x', charges, coords)
179
247
 
180
248
  compute_amplitudes = uadc_amplitudes.compute_amplitudes
181
249
  compute_energy = uadc_amplitudes.compute_energy
182
250
  transform_integrals = uadc_ao2mo.transform_integrals_incore
183
251
 
252
+ def semi_canonicalize_orbitals(self, f, nocc, C):
253
+
254
+ # Diagonalize occ-occ block
255
+ evals_oo, evecs_oo = np.linalg.eigh(f[:nocc, :nocc])
256
+
257
+ # Diagonalize virt-virt block
258
+ evals_vv, evecs_vv = np.linalg.eigh(f[nocc:, nocc:])
259
+
260
+ evals = np.hstack((evals_oo, evals_vv))
261
+
262
+ U = np.zeros_like(f)
263
+
264
+ U[:nocc, :nocc] = evecs_oo
265
+ U[nocc:, nocc:] = evecs_vv
266
+
267
+ C = np.dot(C, U)
268
+
269
+ transform_f = np.dot(U.T, np.dot(f, U))
270
+ f_ov = transform_f[:nocc, nocc:].copy()
271
+
272
+ return C, evals, f_ov, transform_f
273
+
184
274
  def dump_flags(self, verbose=None):
185
275
  logger.info(self, '')
186
276
  logger.info(self, '******** %s ********', self.__class__)
@@ -200,8 +290,8 @@ class UADC(lib.StreamObject):
200
290
  return self
201
291
 
202
292
  def kernel_gs(self):
203
- assert (self.mo_coeff is not None)
204
- assert (self.mo_occ is not None)
293
+ assert(self.mo_coeff is not None)
294
+ assert(self.mo_occ is not None)
205
295
 
206
296
  self.method = self.method.lower()
207
297
  if self.method not in ("adc(2)", "adc(2)-x", "adc(3)"):
@@ -301,8 +391,8 @@ class UADC(lib.StreamObject):
301
391
 
302
392
  def _finalize(self):
303
393
  '''Hook for dumping results and clearing up the object.'''
304
- logger.note(self, 'E_corr = %.8f',
305
- self.e_corr)
394
+ logger.note(self, 'MP%s correlation energy of reference state (a.u.) = %.8f',
395
+ self.method[4], self.e_corr)
306
396
  return self
307
397
 
308
398
  def ea_adc(self, nroots=1, guess=None, eris=None):
@@ -347,7 +437,6 @@ class UADC(lib.StreamObject):
347
437
  return self._adc_es.make_rdm1()
348
438
 
349
439
  if __name__ == '__main__':
350
- from pyscf import scf
351
440
  from pyscf import gto
352
441
  from pyscf import adc
353
442
 
@@ -12,7 +12,10 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  #
15
- # Author: Samragni Banerjee <samragnibanerjee4@gmail.com>
15
+ # Author: Abdelrahman Ahmed <>
16
+ # Samragni Banerjee <samragnibanerjee4@gmail.com>
17
+ # James Serna <jamcar456@gmail.com>
18
+ # Terrence Stahl <>
16
19
  # Alexander Sokolov <alexander.y.sokolov@gmail.com>
17
20
  #
18
21
 
@@ -29,7 +32,7 @@ from pyscf.adc import dfadc
29
32
  from pyscf.adc.radc_amplitudes import _create_t2_h5cache
30
33
  from pyscf import __config__
31
34
  from pyscf import df
32
-
35
+ from pyscf import scf
33
36
 
34
37
  def compute_amplitudes_energy(myadc, eris, verbose=None):
35
38
 
@@ -126,12 +129,29 @@ def compute_amplitudes(myadc, eris):
126
129
 
127
130
  cput0 = log.timer_debug1("Completed t2_1 amplitude calculation", *cput0)
128
131
 
132
+ t1_1 = (None,)
133
+
134
+ if isinstance(myadc._scf, scf.rohf.ROHF):
135
+
136
+ f_ov_a, f_ov_b = myadc.f_ov
137
+
138
+ t1_1_a = f_ov_a/D1_a
139
+ t1_1_b = f_ov_b/D1_b
140
+ t1_1 = (t1_1_a, t1_1_b)
141
+ else:
142
+ f_ov_a = np.zeros((nocc_a, nvir_a))
143
+ f_ov_b = np.zeros((nocc_b, nvir_b))
144
+ t1_1_a = np.zeros((nocc_a, nvir_a))
145
+ t1_1_b = np.zeros((nocc_b, nvir_b))
146
+
147
+
129
148
  t1_2 = (None,)
130
149
  if myadc.approx_trans_moments is False or myadc.method == "adc(3)":
131
150
  # Compute second-order singles t1 (tij)
132
151
 
133
152
  t1_2_a = np.zeros((nocc_a,nvir_a))
134
153
  t1_2_b = np.zeros((nocc_b,nvir_b))
154
+
135
155
  if isinstance(eris.ovvv, type(None)):
136
156
  chnk_size = uadc_ao2mo.calculate_chunk_size(myadc)
137
157
  a = 0
@@ -152,6 +172,33 @@ def compute_amplitudes(myadc, eris):
152
172
  t1_2_a -= 0.5*lib.einsum('lcki,klac->ia',eris_ovoo,t2_1_a[:],optimize=True)
153
173
  t1_2_a += 0.5*lib.einsum('kcli,klac->ia',eris_ovoo,t2_1_a[:],optimize=True)
154
174
 
175
+ if isinstance(myadc._scf, scf.rohf.ROHF):
176
+ t1_2_a += lib.einsum('d,ld,ilad->ia',e_a[nocc_a:],t1_1_a,t2_1_a[:], optimize = True)
177
+ t1_2_a += lib.einsum('d,ld,ilad->ia',e_b[nocc_b:],t1_1_b,t2_1_ab[:], optimize = True)
178
+
179
+ t1_2_a -= lib.einsum('l,ld,ilad->ia',e_a[:nocc_a],t1_1_a,t2_1_a[:], optimize = True)
180
+ t1_2_a -= lib.einsum('l,ld,ilad->ia',e_b[:nocc_b],t1_1_b,t2_1_ab[:], optimize = True)
181
+
182
+
183
+ t1_2_a += 0.5*lib.einsum('a,ld,ilad->ia',e_a[nocc_a:],t1_1_a,t2_1_a[:], optimize = True)
184
+ t1_2_a += 0.5*lib.einsum('a,ld,ilad->ia',
185
+ e_a[nocc_a:],t1_1_b,t2_1_ab[:], optimize = True)
186
+
187
+ t1_2_a -= 0.5*lib.einsum('i,ld,ilad->ia',e_a[:nocc_a],t1_1_a,t2_1_a[:], optimize = True)
188
+ t1_2_a -= 0.5*lib.einsum('i,ld,ilad->ia',
189
+ e_a[:nocc_a],t1_1_b,t2_1_ab[:], optimize = True)
190
+
191
+ t1_2_a += lib.einsum('ld,ilad->ia',f_ov_a,t2_1_a[:], optimize = True)
192
+ t1_2_a += lib.einsum('ld,ilad->ia',f_ov_b,t2_1_ab[:], optimize = True)
193
+
194
+ t1_2_a += lib.einsum('ld,iadl->ia',t1_1_a, eris.ovvo, optimize = True)
195
+ t1_2_a -= lib.einsum('ld,idal->ia',t1_1_a, eris.ovvo, optimize = True)
196
+ t1_2_a += lib.einsum('ld,iadl->ia',t1_1_b, eris.ovVO, optimize = True)
197
+
198
+ t1_2_a += lib.einsum('ld,iadl->ia',t1_1_a,eris.ovvo, optimize = True)
199
+ t1_2_a -= lib.einsum('ld,liad->ia',t1_1_a,eris.oovv, optimize = True)
200
+ t1_2_a += lib.einsum('ld,iadl->ia',t1_1_b,eris.ovVO, optimize = True)
201
+
155
202
  if isinstance(eris.OVvv, type(None)):
156
203
  chnk_size = uadc_ao2mo.calculate_chunk_size(myadc)
157
204
  a = 0
@@ -184,7 +231,33 @@ def compute_amplitudes(myadc, eris):
184
231
  del eris_ovVV
185
232
 
186
233
  t1_2_a -= lib.einsum('lcki,klac->ia',eris_OVoo,t2_1_ab[:],optimize=True)
187
- t1_2_b -= lib.einsum('lcki,lkca->ia',eris_ovOO,t2_1_ab[:])
234
+ t1_2_b -= lib.einsum('lcki,lkca->ia',eris_ovOO,t2_1_ab[:],optimize=True)
235
+
236
+ if isinstance(myadc._scf, scf.rohf.ROHF):
237
+ t1_2_b += lib.einsum('d,ld,ilad->ia',e_b[nocc_b:],t1_1_b,t2_1_b[:], optimize = True)
238
+ t1_2_b += lib.einsum('d,ld,lida->ia',e_a[nocc_a:],t1_1_a,t2_1_ab[:], optimize = True)
239
+
240
+ t1_2_b -= lib.einsum('l,ld,ilad->ia',e_b[:nocc_b],t1_1_b,t2_1_b[:], optimize = True)
241
+ t1_2_b -= lib.einsum('l,ld,lida->ia',e_a[:nocc_a],t1_1_a,t2_1_ab[:], optimize = True)
242
+
243
+ t1_2_b += 0.5*lib.einsum('a,ld,ilad->ia',e_b[nocc_b:],t1_1_b,t2_1_b[:], optimize = True)
244
+ t1_2_b += 0.5*lib.einsum('a,ld,lida->ia',
245
+ e_b[nocc_b:],t1_1_a,t2_1_ab[:], optimize = True)
246
+
247
+ t1_2_b -= 0.5*lib.einsum('i,ld,ilad->ia',e_b[:nocc_b],t1_1_b,t2_1_b[:], optimize = True)
248
+ t1_2_b -= 0.5*lib.einsum('i,ld,lida->ia',
249
+ e_b[:nocc_b],t1_1_a,t2_1_ab[:], optimize = True)
250
+
251
+ t1_2_b += lib.einsum('ld,ilad->ia',f_ov_b,t2_1_b[:], optimize = True)
252
+ t1_2_b += lib.einsum('ld,lida->ia',f_ov_a,t2_1_ab[:], optimize = True)
253
+
254
+ t1_2_b += lib.einsum('ld,iadl->ia',t1_1_b, eris.OVVO, optimize = True)
255
+ t1_2_b -= lib.einsum('ld,idal->ia',t1_1_b, eris.OVVO, optimize = True)
256
+ t1_2_b += lib.einsum('ld,ldai->ia',t1_1_a, eris.ovVO, optimize = True)
257
+
258
+ t1_2_b += lib.einsum('ld,iadl->ia',t1_1_b,eris.OVVO, optimize = True)
259
+ t1_2_b -= lib.einsum('ld,liad->ia',t1_1_b,eris.OOVV, optimize = True)
260
+ t1_2_b += lib.einsum('ld,ldai->ia',t1_1_a,eris.ovVO, optimize = True)
188
261
 
189
262
  if isinstance(eris.OVVV, type(None)):
190
263
  chnk_size = uadc_ao2mo.calculate_chunk_size(myadc)
@@ -234,19 +307,20 @@ def compute_amplitudes(myadc, eris):
234
307
  eris_vvvv = eris.vvvv_p
235
308
  temp = np.ascontiguousarray(
236
309
  t2_1_a[:,:,ab_ind_a[0],ab_ind_a[1]]).reshape(nocc_a*nocc_a,-1)
237
- t2_1_vvvv_a = np.dot(temp,eris_vvvv.T).reshape(nocc_a, nocc_a, -1)
310
+ temp = np.dot(temp,eris_vvvv.T).reshape(nocc_a, nocc_a, -1)
311
+ t2_1_vvvv_a = np.zeros((nocc_a,nocc_a,nvir_a,nvir_a))
312
+ t2_1_vvvv_a[:,:,ab_ind_a[0],ab_ind_a[1]] = temp
313
+ t2_1_vvvv_a[:,:,ab_ind_a[1],ab_ind_a[0]] = -temp
238
314
  del eris_vvvv
239
315
  elif isinstance(eris.vvvv_p, list):
240
- t2_1_vvvv_a = contract_ladder_antisym(myadc,t2_1_a[:], eris.vvvv_p)
316
+ t2_1_vvvv_a = contract_ladder_antisym(myadc,t2_1_a[:], eris.vvvv_p, pack = False)
241
317
  else:
242
- t2_1_vvvv_a = contract_ladder_antisym(myadc,t2_1_a[:], eris.Lvv)
318
+ t2_1_vvvv_a = contract_ladder(myadc, t2_1_a[:], (eris.Lvv, eris.Lvv))
243
319
 
244
320
  if not isinstance(eris.oooo, np.ndarray):
245
321
  t2_1_vvvv_a = h5cache_t2.create_dataset('t2_1_vvvv_a', data=t2_1_vvvv_a)
246
322
 
247
- t2_2_a = np.zeros((nocc_a,nocc_a,nvir_a,nvir_a))
248
- t2_2_a[:,:,ab_ind_a[0],ab_ind_a[1]] = t2_1_vvvv_a[:]
249
- t2_2_a[:,:,ab_ind_a[1],ab_ind_a[0]] = -t2_1_vvvv_a[:]
323
+ t2_2_a = t2_1_vvvv_a[:].copy()
250
324
 
251
325
  t2_2_a += 0.5*lib.einsum('kilj,klab->ijab', eris_oooo, t2_1_a[:],optimize=True)
252
326
  t2_2_a -= 0.5*lib.einsum('kjli,klab->ijab', eris_oooo, t2_1_a[:],optimize=True)
@@ -262,23 +336,53 @@ def compute_amplitudes(myadc, eris):
262
336
  del temp
263
337
  del temp_1
264
338
 
339
+ if isinstance(myadc._scf, scf.rohf.ROHF):
340
+ t2_2_a += lib.einsum('la,ibjl->ijab',t1_1_a,eris.ovoo, optimize = True)
341
+ t2_2_a -= lib.einsum('la,jbil->ijab',t1_1_a,eris.ovoo, optimize = True)
342
+
343
+
344
+ t2_2_a -= lib.einsum('lb,iajl->ijab',t1_1_a,eris.ovoo, optimize = True)
345
+ t2_2_a += lib.einsum('lb,jail->ijab',t1_1_a,eris.ovoo, optimize = True)
346
+
347
+ if isinstance(eris.ovvv, type(None)):
348
+ chnk_size = uadc_ao2mo.calculate_chunk_size(myadc)
349
+ a = 0
350
+ for p in range(0,nocc_a,chnk_size):
351
+ eris_ovvv = dfadc.get_ovvv_spin_df(
352
+ myadc, eris.Lov, eris.Lvv, p, chnk_size).reshape(-1,nvir_a,nvir_a,nvir_a)
353
+ k = eris_ovvv.shape[0]
354
+ t2_2_a[:,a:a+k] += lib.einsum('id,jbad->ijab',t1_1_a,eris_ovvv, optimize = True)
355
+ t2_2_a[:,a:a+k] -= lib.einsum('id,jabd->ijab',t1_1_a,eris_ovvv, optimize = True)
356
+ t2_2_a[a:a+k] -= lib.einsum('jd,ibad->ijab',t1_1_a,eris_ovvv, optimize = True)
357
+ t2_2_a[a:a+k] += lib.einsum('jd,iabd->ijab',t1_1_a,eris_ovvv, optimize = True)
358
+ del eris_ovvv
359
+ a += k
360
+ else:
361
+ eris_ovvv = uadc_ao2mo.unpack_eri_1(eris.ovvv, nvir_a)
362
+ t2_2_a += lib.einsum('id,jbad->ijab',t1_1_a,eris_ovvv, optimize = True)
363
+ t2_2_a -= lib.einsum('id,jabd->ijab',t1_1_a,eris_ovvv, optimize = True)
364
+ t2_2_a -= lib.einsum('jd,ibad->ijab',t1_1_a,eris_ovvv, optimize = True)
365
+ t2_2_a += lib.einsum('jd,iabd->ijab',t1_1_a,eris_ovvv, optimize = True)
366
+ del eris_ovvv
367
+
265
368
  if isinstance(eris.VVVV_p, np.ndarray):
266
369
  eris_VVVV = eris.VVVV_p
267
370
  temp = np.ascontiguousarray(
268
371
  t2_1_b[:,:,ab_ind_b[0],ab_ind_b[1]]).reshape(nocc_b*nocc_b,-1)
269
- t2_1_vvvv_b = np.dot(temp,eris_VVVV.T).reshape(nocc_b, nocc_b, -1)
372
+ temp = np.dot(temp,eris_VVVV.T).reshape(nocc_b, nocc_b, -1)
373
+ t2_1_vvvv_b = np.zeros((nocc_b,nocc_b,nvir_b,nvir_b))
374
+ t2_1_vvvv_b[:,:,ab_ind_b[0],ab_ind_b[1]] = temp
375
+ t2_1_vvvv_b[:,:,ab_ind_b[1],ab_ind_b[0]] = -temp
270
376
  del eris_VVVV
271
377
  elif isinstance(eris.VVVV_p, list) :
272
- t2_1_vvvv_b = contract_ladder_antisym(myadc,t2_1_b[:],eris.VVVV_p)
378
+ t2_1_vvvv_b = contract_ladder_antisym(myadc,t2_1_b[:],eris.VVVV_p, pack = False)
273
379
  else:
274
- t2_1_vvvv_b = contract_ladder_antisym(myadc,t2_1_b[:],eris.LVV)
380
+ t2_1_vvvv_b = contract_ladder(myadc, t2_1_b[:], (eris.LVV, eris.LVV))
275
381
 
276
382
  if not isinstance(eris.oooo, np.ndarray):
277
383
  t2_1_vvvv_b = h5cache_t2.create_dataset('t2_1_vvvv_b', data=t2_1_vvvv_b)
278
384
 
279
- t2_2_b = np.zeros((nocc_b,nocc_b,nvir_b,nvir_b))
280
- t2_2_b[:,:,ab_ind_b[0],ab_ind_b[1]] = t2_1_vvvv_b[:]
281
- t2_2_b[:,:,ab_ind_b[1],ab_ind_b[0]] = -t2_1_vvvv_b[:]
385
+ t2_2_b = t2_1_vvvv_b[:].copy()
282
386
 
283
387
  t2_2_b += 0.5*lib.einsum('kilj,klab->ijab', eris_OOOO, t2_1_b[:],optimize=True)
284
388
  t2_2_b -= 0.5*lib.einsum('kjli,klab->ijab', eris_OOOO, t2_1_b[:],optimize=True)
@@ -290,9 +394,38 @@ def compute_amplitudes(myadc, eris):
290
394
  t2_2_b += temp - temp.transpose(1,0,2,3) - temp.transpose(0,1,3,2) + temp.transpose(1,0,3,2)
291
395
  t2_2_b += temp_1 - temp_1.transpose(1,0,2,3) - \
292
396
  temp_1.transpose(0,1,3,2) + temp_1.transpose(1,0,3,2)
397
+
293
398
  del temp
294
399
  del temp_1
295
400
 
401
+ if isinstance(myadc._scf, scf.rohf.ROHF):
402
+ t2_2_b += lib.einsum('la,ibjl->ijab',t1_1_b,eris.OVOO, optimize = True)
403
+ t2_2_b -= lib.einsum('la,jbil->ijab',t1_1_b,eris.OVOO, optimize = True)
404
+
405
+ t2_2_b -= lib.einsum('lb,iajl->ijab',t1_1_b,eris.OVOO, optimize = True)
406
+ t2_2_b += lib.einsum('lb,jail->ijab',t1_1_b,eris.OVOO, optimize = True)
407
+
408
+ if isinstance(eris.OVVV, type(None)):
409
+ chnk_size = uadc_ao2mo.calculate_chunk_size(myadc)
410
+ a = 0
411
+ for p in range(0,nocc_b,chnk_size):
412
+ eris_OVVV = dfadc.get_ovvv_spin_df(
413
+ myadc, eris.LOV, eris.LVV, p, chnk_size).reshape(-1,nvir_b,nvir_b,nvir_b)
414
+ k = eris_OVVV.shape[0]
415
+ t2_2_b[:,a:a+k] += lib.einsum('id,jbad->ijab',t1_1_b,eris_OVVV, optimize = True)
416
+ t2_2_b[:,a:a+k] -= lib.einsum('id,jabd->ijab',t1_1_b,eris_OVVV, optimize = True)
417
+ t2_2_b[a:a+k] -= lib.einsum('jd,ibad->ijab',t1_1_b,eris_OVVV, optimize = True)
418
+ t2_2_b[a:a+k] += lib.einsum('jd,iabd->ijab',t1_1_b,eris_OVVV, optimize = True)
419
+ del eris_OVVV
420
+ a += k
421
+ else:
422
+ eris_OVVV = uadc_ao2mo.unpack_eri_1(eris.OVVV, nvir_b)
423
+ t2_2_b += lib.einsum('id,jbad->ijab',t1_1_b,eris_OVVV, optimize = True)
424
+ t2_2_b -= lib.einsum('id,jabd->ijab',t1_1_b,eris_OVVV, optimize = True)
425
+ t2_2_b -= lib.einsum('jd,ibad->ijab',t1_1_b,eris_OVVV, optimize = True)
426
+ t2_2_b += lib.einsum('jd,iabd->ijab',t1_1_b,eris_OVVV, optimize = True)
427
+ del eris_OVVV
428
+
296
429
  if isinstance(eris.vVvV_p, np.ndarray):
297
430
  temp = t2_1_ab.reshape(nocc_a*nocc_b,nvir_a*nvir_b)
298
431
  eris_vVvV = eris.vVvV_p
@@ -317,6 +450,43 @@ def compute_amplitudes(myadc, eris):
317
450
  t2_2_ab += lib.einsum('kcai,kjcb->ijab',eris_ovvo,t2_1_ab[:],optimize=True)
318
451
  t2_2_ab -= lib.einsum('kiac,kjcb->ijab',eris_oovv,t2_1_ab[:],optimize=True)
319
452
 
453
+ if isinstance(myadc._scf, scf.rohf.ROHF):
454
+ t2_2_ab -= lib.einsum('la,jbil->ijab',t1_1_a,eris.OVoo, optimize = True)
455
+ t2_2_ab -= lib.einsum('lb,iajl->ijab',t1_1_b,eris.ovOO, optimize = True)
456
+
457
+ if isinstance(eris.OVvv, type(None)):
458
+ chnk_size = uadc_ao2mo.calculate_chunk_size(myadc)
459
+ a = 0
460
+ for p in range(0,nocc_b,chnk_size):
461
+ eris_OVvv = dfadc.get_ovvv_spin_df(
462
+ myadc, eris.LOV, eris.Lvv, p, chnk_size).reshape(-1,nvir_b,nvir_a,nvir_a)
463
+ k = eris_OVvv.shape[0]
464
+ t2_2_ab[:, a:a+k] += lib.einsum('id,jbad->ijab',
465
+ t1_1_a,eris_OVvv, optimize = True)
466
+ del eris_OVvv
467
+ a += k
468
+ else:
469
+ eris_OVvv = uadc_ao2mo.unpack_eri_1(eris.OVvv, nvir_a)
470
+ t2_2_ab += lib.einsum('id,jbad->ijab',t1_1_a,eris_OVvv, optimize = True)
471
+ del eris_OVvv
472
+
473
+ if isinstance(eris.ovVV, type(None)):
474
+ chnk_size = uadc_ao2mo.calculate_chunk_size(myadc)
475
+ a = 0
476
+ for p in range(0,nocc_a,chnk_size):
477
+ eris_ovVV = dfadc.get_ovvv_spin_df(
478
+ myadc, eris.Lov, eris.LVV, p, chnk_size).reshape(-1,nvir_a,nvir_b,nvir_b)
479
+ k = eris_ovVV.shape[0]
480
+ t2_2_ab[a:a+k] += lib.einsum('jd,iabd->ijab',t1_1_b,eris_ovVV, optimize = True)
481
+ del eris_ovVV
482
+ a += k
483
+ else:
484
+ eris_ovVV = uadc_ao2mo.unpack_eri_1(eris.ovVV, nvir_b)
485
+ t2_2_ab += lib.einsum('jd,iabd->ijab',t1_1_b,eris_ovVV, optimize = True)
486
+ del eris_ovVV
487
+
488
+
489
+
320
490
  D2_a = d_ij_a.reshape(-1,1) - d_ab_a.reshape(-1)
321
491
  D2_a = D2_a.reshape((nocc_a,nocc_a,nvir_a,nvir_a))
322
492
  t2_2_a = t2_2_a/D2_a
@@ -694,7 +864,7 @@ def compute_amplitudes(myadc, eris):
694
864
  t2_2 = (t2_2_a , t2_2_ab, t2_2_b)
695
865
  t2_1_vvvv = (t2_1_vvvv_a, t2_1_vvvv_ab, t2_1_vvvv_b)
696
866
 
697
- t1 = (t1_2, t1_3)
867
+ t1 = (t1_2, t1_3, t1_1)
698
868
  t2 = (t2_1, t2_2)
699
869
 
700
870
  cput0 = log.timer_debug1("Completed amplitude calculation", *cput0)
@@ -738,17 +908,38 @@ def compute_energy(myadc, t1, t2, eris):
738
908
  e_mp -= 0.25 * lib.einsum('ijab,ibaj', t2_b, eris_OVVO)
739
909
  del t2_b
740
910
 
911
+ logger.info(myadc, "Reference correlation energy (doubles): %.8f", e_mp)
912
+
913
+ if isinstance(myadc._scf, scf.rohf.ROHF):
914
+ f_ov_a = myadc.f_ov[0]
915
+ f_ov_b = myadc.f_ov[1]
916
+ t1_1_a = t1[2][0].copy()
917
+ t1_1_b = t1[2][1].copy()
918
+
919
+ if (myadc.method == "adc(3)"):
920
+ t1_1_a += t1[0][0]
921
+ t1_1_b += t1[0][1]
922
+
923
+ singles = lib.einsum('ia,ia', f_ov_a, t1_1_a)
924
+ singles += lib.einsum('ia,ia', f_ov_b, t1_1_b)
925
+
926
+ e_mp += singles
927
+
928
+ logger.info(myadc, "Reference correlation energy (singles): %.8f", singles)
929
+
741
930
  cput0 = log.timer_debug1("Completed energy calculation", *cput0)
742
931
 
743
932
  return e_mp
744
933
 
745
- def contract_ladder(myadc,t_amp,vvvv_p):
934
+
935
+ def contract_ladder(myadc,t_amp,vvvv_p, prefactor = 1.0, pack = False):
746
936
 
747
937
  nocc_a = t_amp.shape[0]
748
938
  nocc_b = t_amp.shape[1]
749
939
  nvir_a = t_amp.shape[2]
750
940
  nvir_b = t_amp.shape[3]
751
941
 
942
+ tril_idx = np.tril_indices(nvir_a, k=-1)
752
943
  t_amp_t = np.ascontiguousarray(t_amp.reshape(nocc_a*nocc_b,-1).T)
753
944
  t = np.zeros((nvir_a,nvir_b, nocc_a*nocc_b))
754
945
  chnk_size = uadc_ao2mo.calculate_chunk_size(myadc)
@@ -773,12 +964,14 @@ def contract_ladder(myadc,t_amp,vvvv_p):
773
964
  else:
774
965
  raise Exception("Unknown vvvv type")
775
966
 
776
- t = np.ascontiguousarray(t.transpose(2,0,1)).reshape(nocc_a, nocc_b, nvir_a, nvir_b)
967
+ t = prefactor * np.ascontiguousarray(t.transpose(2,0,1)).reshape(nocc_a, nocc_b, nvir_a, nvir_b)
968
+ if pack:
969
+ t = t[:, :, tril_idx[0], tril_idx[1]]
777
970
 
778
971
  return t
779
972
 
780
973
 
781
- def contract_ladder_antisym(myadc,t_amp,vvvv_d):
974
+ def contract_ladder_antisym(myadc,t_amp,vvvv_d, pack = True):
782
975
 
783
976
  nocc = t_amp.shape[0]
784
977
  nvir = t_amp.shape[2]
@@ -811,6 +1004,8 @@ def contract_ladder_antisym(myadc,t_amp,vvvv_d):
811
1004
  raise Exception("Unknown vvvv type")
812
1005
 
813
1006
  t = np.ascontiguousarray(t.transpose(2,0,1)).reshape(nocc, nocc, nvir, nvir)
814
- t = t[:, :, tril_idx[0], tril_idx[1]]
1007
+
1008
+ if pack:
1009
+ t = t[:, :, tril_idx[0], tril_idx[1]]
815
1010
 
816
1011
  return t
pyscf/adc/uadc_ao2mo.py CHANGED
@@ -12,7 +12,10 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  #
15
- # Author: Samragni Banerjee <samragnibanerjee4@gmail.com>
15
+ # Author: Abdelrahman Ahmed <>
16
+ # Samragni Banerjee <samragnibanerjee4@gmail.com>
17
+ # James Serna <jamcar456@gmail.com>
18
+ # Terrence Stahl <>
16
19
  # Alexander Sokolov <alexander.y.sokolov@gmail.com>
17
20
  #
18
21
 
@@ -199,7 +202,7 @@ def transform_integrals_outcore(myadc):
199
202
  eris.OOvv[i] = buf[:nocc_b,nocc_a:,nocc_a:]
200
203
  eris.OVvo[i] = buf[nocc_b:,nocc_a:,:nocc_a]
201
204
  eris.OVvv[i] = lib.pack_tril(buf[nocc_b:,nocc_a:,nocc_a:])
202
- del (tmpf['ba'])
205
+ del(tmpf['ba'])
203
206
 
204
207
  buf = None
205
208
  cput1 = logger.timer_debug1(myadc, 'transforming oopq, ovpq', *cput1)
@@ -465,17 +468,35 @@ def transform_integrals_df(myadc):
465
468
  eris.Lvv = eris.Lvv.reshape(naux,nvir_a,nvir_a)
466
469
  eris.LVV = eris.LVV.reshape(naux,nvir_b,nvir_b)
467
470
 
468
- if not isinstance(myadc.ncvs, type(None)) and myadc.ncvs > 0:
469
- ncvs = myadc.ncvs
470
- eris.Lce = eris.Lce.reshape(naux,ncvs,nvir_a)
471
- eris.Lee = eris.Lvv
472
- eris.LCE = eris.LCE.reshape(naux,ncvs,nvir_b)
473
- eris.LEE = eris.LVV
474
-
475
471
  log.timer('DF-ADC integral transformation', *cput0)
476
472
 
477
473
  return eris
478
474
 
475
+ def unpack_eri_1(eri, norb):
476
+
477
+ n_oo = norb * (norb + 1) // 2
478
+ ind_oo = np.tril_indices(norb)
479
+
480
+ eri_ = None
481
+
482
+ if len(eri.shape) == 3:
483
+ if (eri.shape[0] == n_oo):
484
+ eri_ = np.zeros((norb, norb, eri.shape[1], eri.shape[2]))
485
+ eri_[ind_oo[0], ind_oo[1]] = eri
486
+ eri_[ind_oo[1], ind_oo[0]] = eri
487
+
488
+ elif (eri.shape[2] == n_oo):
489
+ eri_ = np.zeros((eri.shape[0], eri.shape[1], norb, norb))
490
+ eri_[:, :, ind_oo[0], ind_oo[1]] = eri
491
+ eri_[:, :, ind_oo[1], ind_oo[0]] = eri
492
+ else:
493
+ raise TypeError("ERI dimensions don't match")
494
+
495
+ else:
496
+ raise RuntimeError("ERI does not have a correct dimension")
497
+
498
+ return eri_
499
+
479
500
  def calculate_chunk_size(myadc):
480
501
 
481
502
  avail_mem = (myadc.max_memory - lib.current_memory()[0]) * 0.25