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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. pyscf/__init__.py +2 -2
  2. pyscf/adc/__init__.py +3 -8
  3. pyscf/adc/dfadc.py +22 -6
  4. pyscf/adc/radc.py +106 -15
  5. pyscf/adc/radc_amplitudes.py +7 -1
  6. pyscf/adc/radc_ao2mo.py +4 -2
  7. pyscf/adc/radc_ea.py +524 -8
  8. pyscf/adc/radc_ip.py +492 -60
  9. pyscf/adc/radc_ip_cvs.py +4 -2
  10. pyscf/adc/uadc.py +116 -27
  11. pyscf/adc/uadc_amplitudes.py +215 -20
  12. pyscf/adc/uadc_ao2mo.py +30 -9
  13. pyscf/adc/uadc_ea.py +34 -44
  14. pyscf/adc/uadc_ip.py +9 -4
  15. pyscf/adc/uadc_ip_cvs.py +4 -1
  16. pyscf/agf2/__init__.py +2 -2
  17. pyscf/agf2/aux_space.py +1 -1
  18. pyscf/agf2/chkfile.py +1 -1
  19. pyscf/ao2mo/outcore.py +6 -4
  20. pyscf/cc/__init__.py +21 -3
  21. pyscf/cc/bccd.py +0 -46
  22. pyscf/cc/ccsd.py +16 -8
  23. pyscf/cc/uccsd.py +1 -1
  24. pyscf/data/elements.py +1 -1
  25. pyscf/df/__init__.py +2 -1
  26. pyscf/df/addons.py +79 -51
  27. pyscf/df/autoaux.py +191 -0
  28. pyscf/df/df.py +5 -1
  29. pyscf/df/grad/casscf.py +0 -41
  30. pyscf/df/hessian/rhf.py +2 -10
  31. pyscf/df/hessian/rks.py +1 -7
  32. pyscf/df/hessian/uhf.py +3 -13
  33. pyscf/df/hessian/uks.py +1 -8
  34. pyscf/df/incore.py +17 -5
  35. pyscf/dft/dks.py +1 -1
  36. pyscf/dft/libxc.py +65 -639
  37. pyscf/dft/numint.py +7 -3
  38. pyscf/dft/radi.py +39 -5
  39. pyscf/dft/rks.py +1 -1
  40. pyscf/dft/xc_deriv.py +1 -1
  41. pyscf/dft/xcfun.py +53 -2
  42. pyscf/eph/eph_fd.py +1 -1
  43. pyscf/eph/rhf.py +6 -36
  44. pyscf/eph/rks.py +0 -4
  45. pyscf/eph/uhf.py +1 -7
  46. pyscf/eph/uks.py +1 -7
  47. pyscf/fci/addons.py +117 -2
  48. pyscf/fci/cistring.py +1 -1
  49. pyscf/fci/direct_nosym.py +3 -3
  50. pyscf/fci/direct_spin0_symm.py +22 -43
  51. pyscf/fci/direct_spin1.py +65 -9
  52. pyscf/fci/direct_spin1_symm.py +49 -14
  53. pyscf/fci/direct_uhf.py +4 -4
  54. pyscf/fci/selected_ci_symm.py +1 -1
  55. pyscf/grad/lagrange.py +11 -3
  56. pyscf/grad/mp2.py +1 -1
  57. pyscf/grad/sacasscf.py +1 -1
  58. pyscf/grad/tdrks.py +1 -1
  59. pyscf/gto/basis/__init__.py +7 -0
  60. pyscf/gto/basis/bse.py +68 -15
  61. pyscf/gto/basis/parse_cp2k_pp.py +1 -1
  62. pyscf/gto/basis/parse_nwchem.py +1 -1
  63. pyscf/gto/basis/parse_nwchem_ecp.py +2 -1
  64. pyscf/gto/basis/sap_grasp_large.dat +2438 -0
  65. pyscf/gto/basis/sap_grasp_small.dat +1434 -0
  66. pyscf/gto/mole.py +99 -44
  67. pyscf/gw/gw_ac.py +2 -2
  68. pyscf/gw/gw_cd.py +2 -2
  69. pyscf/gw/rpa.py +2 -2
  70. pyscf/gw/ugw_ac.py +2 -2
  71. pyscf/gw/urpa.py +1 -1
  72. pyscf/hessian/rhf.py +30 -128
  73. pyscf/hessian/rks.py +1 -6
  74. pyscf/hessian/uhf.py +28 -138
  75. pyscf/hessian/uks.py +1 -8
  76. pyscf/lib/ao2mo/nr_ao2mo.c +1 -1
  77. pyscf/lib/ao2mo/nrr_ao2mo.c +1 -1
  78. pyscf/lib/ao2mo/r_ao2mo.c +1 -1
  79. pyscf/lib/cc/ccsd_pack.c +1 -1
  80. pyscf/lib/cc/ccsd_t.c +6 -6
  81. pyscf/lib/cc/uccsd_t.c +4 -4
  82. pyscf/lib/deps/include/XCFun/XCFunExport.h +1 -0
  83. pyscf/lib/dft/grid_common.c +1 -1
  84. pyscf/lib/dft/libxc_itrf.c +4 -1
  85. pyscf/lib/dft/xcfun_itrf.c +1 -1
  86. pyscf/lib/diis.py +1 -1
  87. pyscf/lib/exceptions.py +3 -0
  88. pyscf/lib/gto/fill_grids_int2c.c +11 -9
  89. pyscf/lib/gto/fill_int2e.c +7 -5
  90. pyscf/lib/gto/fill_r_4c.c +1 -1
  91. pyscf/lib/gto/ft_ao.c +1 -1
  92. pyscf/lib/gto/ft_ao.h +1 -1
  93. pyscf/lib/gto/gto.h +2 -2
  94. pyscf/lib/gto/nr_ecp.c +3 -2
  95. pyscf/lib/libagf2.dylib +0 -0
  96. pyscf/lib/libao2mo.dylib +0 -0
  97. pyscf/lib/libcc.dylib +0 -0
  98. pyscf/lib/libcgto.dylib +0 -0
  99. pyscf/lib/libcvhf.dylib +0 -0
  100. pyscf/lib/libdft.dylib +0 -0
  101. pyscf/lib/libfci.dylib +0 -0
  102. pyscf/lib/libmcscf.dylib +0 -0
  103. pyscf/lib/libnp_helper.dylib +0 -0
  104. pyscf/lib/libpbc.dylib +0 -0
  105. pyscf/lib/libri.dylib +0 -0
  106. pyscf/lib/libxc_itrf.dylib +0 -0
  107. pyscf/lib/libxcfun_itrf.dylib +0 -0
  108. pyscf/lib/linalg_helper.py +112 -192
  109. pyscf/lib/mcscf/fci_contract.c +2 -2
  110. pyscf/lib/misc.py +47 -14
  111. pyscf/lib/numpy_helper.py +1 -1
  112. pyscf/lib/pbc/nr_ecp.c +10 -3
  113. pyscf/lib/pbc/pbc.h +1 -1
  114. pyscf/lib/vhf/nr_sgx_direct.c +8 -6
  115. pyscf/lib/vhf/optimizer.c +2 -2
  116. pyscf/lo/iao.py +1 -1
  117. pyscf/lo/ibo.py +3 -3
  118. pyscf/lo/pipek_jacobi.py +1 -1
  119. pyscf/mcscf/__init__.py +2 -2
  120. pyscf/mcscf/addons.py +3 -3
  121. pyscf/mcscf/apc.py +2 -2
  122. pyscf/mcscf/casci.py +8 -6
  123. pyscf/mcscf/chkfile.py +70 -41
  124. pyscf/mcscf/dmet_cas.py +2 -2
  125. pyscf/mcscf/mc1step.py +62 -38
  126. pyscf/mcscf/newton_casscf.py +5 -5
  127. pyscf/mcscf/ucasci.py +1 -1
  128. pyscf/mcscf/umc1step.py +44 -25
  129. pyscf/md/integrators.py +3 -3
  130. pyscf/mp/mp2.py +6 -5
  131. pyscf/mp/ump2.py +7 -6
  132. pyscf/pbc/adc/kadc_rhf.py +1 -1
  133. pyscf/pbc/adc/kadc_rhf_amplitudes.py +2 -2
  134. pyscf/pbc/ao2mo/eris.py +1 -1
  135. pyscf/pbc/cc/kccsd_rhf.py +3 -3
  136. pyscf/pbc/cc/kccsd_t_rhf.py +2 -2
  137. pyscf/pbc/ci/kcis_rhf.py +2 -2
  138. pyscf/pbc/df/aft.py +2 -2
  139. pyscf/pbc/df/aft_ao2mo.py +1 -1
  140. pyscf/pbc/df/df.py +84 -11
  141. pyscf/pbc/df/df_jk.py +2 -1
  142. pyscf/pbc/df/fft.py +6 -2
  143. pyscf/pbc/df/fft_ao2mo.py +4 -0
  144. pyscf/pbc/df/fft_jk.py +11 -3
  145. pyscf/pbc/df/ft_ao.py +4 -3
  146. pyscf/pbc/df/gdf_builder.py +5 -4
  147. pyscf/pbc/df/incore.py +1 -1
  148. pyscf/pbc/df/mdf.py +6 -3
  149. pyscf/pbc/df/rsdf.py +2 -2
  150. pyscf/pbc/df/rsdf_builder.py +11 -6
  151. pyscf/pbc/df/rsdf_helper.py +1 -1
  152. pyscf/pbc/dft/cdft.py +5 -5
  153. pyscf/pbc/dft/multigrid/multigrid.py +19 -26
  154. pyscf/pbc/dft/multigrid/multigrid_pair.py +1 -1
  155. pyscf/pbc/dft/multigrid/pp.py +1 -1
  156. pyscf/pbc/dft/numint.py +30 -21
  157. pyscf/pbc/eph/eph_fd.py +1 -1
  158. pyscf/pbc/geomopt/geometric_solver.py +1 -1
  159. pyscf/pbc/gto/cell.py +37 -19
  160. pyscf/pbc/gto/ecp.py +12 -12
  161. pyscf/pbc/gto/eval_gto.py +2 -2
  162. pyscf/pbc/gto/pseudo/pp.py +1 -1
  163. pyscf/pbc/gw/krgw_ac.py +4 -4
  164. pyscf/pbc/gw/krgw_cd.py +4 -4
  165. pyscf/pbc/gw/kugw_ac.py +3 -3
  166. pyscf/pbc/lib/kpts_helper.py +4 -3
  167. pyscf/pbc/lib/linalg_helper.py +1 -1
  168. pyscf/pbc/mp/kmp2.py +1 -1
  169. pyscf/pbc/mpitools/mpi.py +1 -1
  170. pyscf/pbc/scf/addons.py +15 -11
  171. pyscf/pbc/scf/cphf.py +1 -1
  172. pyscf/pbc/scf/ghf.py +1 -1
  173. pyscf/pbc/scf/hf.py +21 -24
  174. pyscf/pbc/scf/kghf.py +33 -29
  175. pyscf/pbc/scf/khf.py +71 -26
  176. pyscf/pbc/scf/krohf.py +5 -7
  177. pyscf/pbc/scf/kuhf.py +53 -22
  178. pyscf/pbc/scf/rsjk.py +13 -9
  179. pyscf/pbc/scf/scfint.py +1 -1
  180. pyscf/pbc/scf/stability.py +1 -1
  181. pyscf/pbc/scf/uhf.py +3 -1
  182. pyscf/pbc/symm/symmetry.py +2 -2
  183. pyscf/pbc/tdscf/kproxy.py +1 -1
  184. pyscf/pbc/tdscf/kproxy_supercell.py +2 -2
  185. pyscf/pbc/tdscf/krhf.py +215 -133
  186. pyscf/pbc/tdscf/krhf_slow_supercell.py +1 -1
  187. pyscf/pbc/tdscf/krks.py +1 -45
  188. pyscf/pbc/tdscf/kuhf.py +58 -105
  189. pyscf/pbc/tdscf/kuks.py +0 -56
  190. pyscf/pbc/tdscf/proxy.py +1 -1
  191. pyscf/pbc/tdscf/rhf.py +111 -3
  192. pyscf/pbc/tdscf/rks.py +2 -1
  193. pyscf/pbc/tdscf/uhf.py +203 -1
  194. pyscf/pbc/tdscf/uks.py +2 -1
  195. pyscf/pbc/tools/k2gamma.py +7 -4
  196. pyscf/pbc/tools/pbc.py +63 -56
  197. pyscf/pbc/tools/pyscf_ase.py +0 -1
  198. pyscf/pbc/tools/pywannier90.py +1 -1
  199. pyscf/qmmm/mm_mole.py +1 -1
  200. pyscf/scf/_response_functions.py +2 -2
  201. pyscf/scf/_vhf.py +14 -10
  202. pyscf/scf/addons.py +29 -15
  203. pyscf/scf/cphf.py +14 -52
  204. pyscf/scf/dhf.py +39 -10
  205. pyscf/scf/dispersion.py +9 -8
  206. pyscf/scf/ghf.py +25 -13
  207. pyscf/scf/ghf_symm.py +2 -2
  208. pyscf/scf/hf.py +245 -29
  209. pyscf/scf/rohf.py +37 -5
  210. pyscf/scf/stability.py +142 -112
  211. pyscf/scf/ucphf.py +21 -16
  212. pyscf/scf/uhf.py +95 -58
  213. pyscf/sgx/sgx.py +1 -1
  214. pyscf/sgx/sgx_jk.py +4 -4
  215. pyscf/solvent/_ddcosmo_tdscf_grad.py +1 -1
  216. pyscf/solvent/ddcosmo.py +1 -1
  217. pyscf/solvent/pol_embed.py +1 -1
  218. pyscf/soscf/ciah.py +1 -1
  219. pyscf/soscf/newton_ah.py +1 -1
  220. pyscf/symm/__init__.py +1 -1
  221. pyscf/symm/addons.py +5 -5
  222. pyscf/tdscf/_lr_eig.py +505 -0
  223. pyscf/tdscf/common_slow.py +1 -1
  224. pyscf/tdscf/dhf.py +41 -37
  225. pyscf/tdscf/dks.py +0 -4
  226. pyscf/tdscf/ghf.py +91 -71
  227. pyscf/tdscf/gks.py +16 -16
  228. pyscf/tdscf/proxy.py +2 -2
  229. pyscf/tdscf/rhf.py +143 -96
  230. pyscf/tdscf/rks.py +15 -14
  231. pyscf/tdscf/uhf.py +117 -70
  232. pyscf/tdscf/uks.py +17 -18
  233. pyscf/tools/fcidump.py +3 -0
  234. pyscf/x2c/sfx2c1e.py +1 -1
  235. pyscf/x2c/tdscf.py +4 -4
  236. pyscf/x2c/x2c.py +15 -11
  237. {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/METADATA +24 -24
  238. {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/NOTICE +3 -1
  239. {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/RECORD +242 -240
  240. {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/WHEEL +1 -1
  241. pyscf/dft/gen_libxc_param.py +0 -35
  242. pyscf/dft/gen_xcfun_param.py +0 -209
  243. {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/LICENSE +0 -0
  244. {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/top_level.txt +0 -0
pyscf/__init__.py CHANGED
@@ -35,7 +35,7 @@ to try out the package::
35
35
 
36
36
  '''
37
37
 
38
- __version__ = '2.6.2'
38
+ __version__ = '2.7.0'
39
39
 
40
40
  import os
41
41
  import sys
@@ -56,7 +56,7 @@ if PYSCF_EXT_PATH:
56
56
  __path__.append(os.path.join(p, f, 'pyscf'))
57
57
  del f
58
58
  elif os.path.exists(p):
59
- # Load all moduels defined inside the file PYSCF_EXT_PATH
59
+ # Load all modules defined inside the file PYSCF_EXT_PATH
60
60
  with open(p, 'r') as f:
61
61
  __path__.extend(f.read().splitlines())
62
62
  del f
pyscf/adc/__init__.py CHANGED
@@ -42,12 +42,8 @@ def ADC(mf, frozen=None, mo_coeff=None, mo_occ=None):
42
42
 
43
43
  if mf.istype('UHF'):
44
44
  return UADC(mf, frozen, mo_coeff, mo_occ)
45
- #elif isinstance(mf, scf.rohf.ROHF):
46
- # lib.logger.warn(mf, 'RADC method does not support ROHF reference. ROHF object '
47
- # 'is converted to UHF object and UADC method is called.')
48
- # mf = mf.to_uhf(mf)
49
- # return UADC(mf, frozen, mo_coeff, mo_occ)
50
- # TODO add ROHF functionality
45
+ elif mf.istype('ROHF'):
46
+ return UADC(mf, frozen, mo_coeff, mo_occ)
51
47
  elif mf.istype('RHF'):
52
48
  return RADC(mf, frozen, mo_coeff, mo_occ)
53
49
  else :
@@ -61,8 +57,7 @@ def UADC(mf, frozen=None, mo_coeff=None, mo_occ=None):
61
57
  if not (frozen is None or frozen == 0):
62
58
  raise NotImplementedError
63
59
 
64
- mf = mf.remove_soscf()
65
- if not mf.istype('UHF'):
60
+ if not (mf.istype('UHF') or mf.istype('ROHF')):
66
61
  mf = mf.to_uhf()
67
62
 
68
63
  return uadc.UADC(mf, frozen, mo_coeff, mo_occ)
pyscf/adc/dfadc.py CHANGED
@@ -12,6 +12,13 @@
12
12
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
+ #
16
+ # Author: Abdelrahman Ahmed <>
17
+ # Samragni Banerjee <samragnibanerjee4@gmail.com>
18
+ # James Serna <jamcar456@gmail.com>
19
+ # Terrence Stahl <>
20
+ # Alexander Sokolov <alexander.y.sokolov@gmail.com>
21
+ #
15
22
 
16
23
  import numpy as np
17
24
 
@@ -58,6 +65,7 @@ def get_ovvv_spin_df(myadc, Lov, Lvv, p, chnk_size):
58
65
  #vvvv = np.ascontiguousarray(vvvv.transpose(0,2,1,3)).reshape(-1, nvir, nvir * nvir)
59
66
  return ovvv
60
67
 
68
+
61
69
  def get_vvvv_df(myadc, Lvv, p, chnk_size):
62
70
 
63
71
  ''' Returns approximate vvvv integrals used in restricted implementation'''
@@ -75,11 +83,13 @@ def get_vvvv_df(myadc, Lvv, p, chnk_size):
75
83
  Lvv = Lvv.reshape(naux,nvir*nvir)
76
84
  vvvv = np.dot(Lvv_temp, Lvv)
77
85
  vvvv = vvvv.reshape(-1, nvir, nvir, nvir)
78
- vvvv = np.ascontiguousarray(vvvv.transpose(0,2,1,3)).reshape(-1, nvir, nvir * nvir)
86
+ vvvv = vvvv.transpose(0,2,1,3).reshape(-1, nvir, nvir, nvir)
87
+ vvvv = np.ascontiguousarray(vvvv)
88
+
79
89
  return vvvv
80
90
 
81
91
 
82
- def get_vvvv_antisym_df(myadc, Lvv, p, chnk_size):
92
+ def get_vvvv_antisym_df(myadc, Lvv, p, chnk_size, pack = True):
83
93
 
84
94
  ''' Returns approximate antisymmetrized vvvv integrals (alpha/beta spin) used in unrestricted implementation'''
85
95
 
@@ -95,9 +105,13 @@ def get_vvvv_antisym_df(myadc, Lvv, p, chnk_size):
95
105
  Lvv = Lvv.reshape(naux,nvir*nvir)
96
106
  vvvv = np.dot(Lvv_temp, Lvv)
97
107
  vvvv = vvvv.reshape(-1, nvir, nvir, nvir)
98
- vvvv = vvvv.transpose(0,2,1,3).reshape(-1, nvir, nvir, nvir)
108
+ vvvv = vvvv.transpose(0,2,1,3)
99
109
  vvvv -= vvvv.transpose(0,1,3,2)
100
- vvvv = np.ascontiguousarray(vvvv[:, :, ind_vv_g[0], ind_vv_g[1]])
110
+
111
+ if pack:
112
+ vvvv = np.ascontiguousarray(vvvv[:, :, ind_vv_g[0], ind_vv_g[1]])
113
+ else:
114
+ vvvv = np.ascontiguousarray(vvvv)
101
115
 
102
116
  return vvvv
103
117
 
@@ -116,7 +130,9 @@ def get_vVvV_df(myadc, Lvv, LVV, p, chnk_size):
116
130
  Lvv_temp = np.ascontiguousarray(Lvv.T.reshape(-1,naux))
117
131
 
118
132
  LVV = LVV.reshape(naux,nvir_2*nvir_2)
119
- vvvv = np.dot(Lvv_temp, LVV).reshape(-1,nvir_1,nvir_2,nvir_2)
120
- vvvv = np.ascontiguousarray(vvvv.transpose(0,2,1,3)).reshape(-1, nvir_2, nvir_1, nvir_2)
133
+ vvvv = np.dot(Lvv_temp, LVV)
134
+ vvvv = vvvv.reshape(-1,nvir_1,nvir_2,nvir_2)
135
+ vvvv = vvvv.transpose(0,2,1,3)
136
+ vvvv = np.ascontiguousarray(vvvv)
121
137
 
122
138
  return vvvv
pyscf/adc/radc.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
 
@@ -50,7 +53,7 @@ def kernel(adc, nroots=1, guess=None, eris=None, verbose=None):
50
53
  imds = adc.get_imds(eris)
51
54
  matvec, diag = adc.gen_matvec(imds, eris)
52
55
 
53
- guess = adc.get_init_guess(nroots, diag, ascending=True)
56
+ guess = adc.get_init_guess(nroots, diag, ascending = True)
54
57
 
55
58
  conv, adc.E, U = lib.linalg_helper.davidson_nosym1(
56
59
  lambda xs : [matvec(x) for x in xs],
@@ -61,6 +64,7 @@ def kernel(adc, nroots=1, guess=None, eris=None, verbose=None):
61
64
 
62
65
  if adc.compute_properties:
63
66
  adc.P,adc.X = adc.get_properties(nroots)
67
+ nfalse = np.shape(conv)[0] - np.sum(conv)
64
68
 
65
69
  header = ("\n*************************************************************"
66
70
  "\n ADC calculation summary"
@@ -71,15 +75,88 @@ def kernel(adc, nroots=1, guess=None, eris=None, verbose=None):
71
75
  print_string = ('%s root %d | Energy (Eh) = %14.10f | Energy (eV) = %12.8f ' %
72
76
  (adc.method, n, adc.E[n], adc.E[n]*27.2114))
73
77
  if adc.compute_properties:
74
- print_string += ("| Spec factors = %10.8f " % adc.P[n])
78
+ print_string += ("| Spec. factor = %10.8f " % adc.P[n])
75
79
  print_string += ("| conv = %s" % conv[n])
76
80
  logger.info(adc, print_string)
77
81
 
82
+ if nfalse >= 1:
83
+ logger.warn(adc, "Davidson iterations for " + str(nfalse) + " root(s) did not converge!!!")
84
+
78
85
  log.timer('ADC', *cput0)
79
86
 
80
87
  return adc.E, adc.U, adc.P, adc.X
81
88
 
82
89
 
90
+ def make_ref_rdm1(adc):
91
+
92
+ if adc.method not in ("adc(2)", "adc(2)-x", "adc(3)"):
93
+ raise NotImplementedError(adc.method)
94
+
95
+ t1 = adc.t1
96
+ t2 = adc.t2
97
+ t2_ce = t1[0][:]
98
+ t1_ccee = t2[0][:]
99
+
100
+ ######################
101
+ einsum_type = True
102
+ nocc = adc._nocc
103
+ nvir = adc._nvir
104
+
105
+ nmo = nocc + nvir
106
+
107
+ OPDM = np.zeros((nmo,nmo))
108
+
109
+ ####### ADC(2) SPIN ADAPTED REF OPDM with SQA ################
110
+ ### OCC-OCC ###
111
+ OPDM[:nocc, :nocc] += lib.einsum('IJ->IJ', np.identity(nocc), optimize = einsum_type).copy()
112
+ OPDM[:nocc, :nocc] -= 2 * lib.einsum('Iiab,Jiab->IJ', t1_ccee, t1_ccee, optimize = einsum_type)
113
+ OPDM[:nocc, :nocc] += lib.einsum('Iiab,Jiba->IJ', t1_ccee, t1_ccee, optimize = einsum_type)
114
+
115
+ ### OCC-VIR ###
116
+ OPDM[:nocc, nocc:] += lib.einsum('IA->IA', t2_ce, optimize = einsum_type).copy()
117
+
118
+ ### VIR-OCC ###
119
+ OPDM[nocc:, :nocc] += lib.einsum('IA->AI', t2_ce, optimize = einsum_type).copy()
120
+
121
+ ### VIR-VIR ###
122
+ OPDM[nocc:, nocc:] += 2 * lib.einsum('ijAa,ijBa->AB', t1_ccee, t1_ccee, optimize = einsum_type)
123
+ OPDM[nocc:, nocc:] -= lib.einsum('ijAa,jiBa->AB', t1_ccee, t1_ccee, optimize = einsum_type)
124
+
125
+ ####### ADC(3) SPIN ADAPTED REF OPDM WITH SQA ################
126
+ if adc.method == "adc(3)":
127
+ t3_ce = adc.t1[1][:]
128
+ t2_ccee = t2[1][:]
129
+
130
+ #### OCC-OCC ###
131
+ OPDM[:nocc, :nocc] -= 2 * lib.einsum('Iiab,Jiab->IJ',
132
+ t1_ccee, t2_ccee, optimize = einsum_type)
133
+ OPDM[:nocc, :nocc] += lib.einsum('Iiab,Jiba->IJ', t1_ccee, t2_ccee, optimize = einsum_type)
134
+ OPDM[:nocc, :nocc] -= 2 * lib.einsum('Jiab,Iiab->IJ',
135
+ t1_ccee, t2_ccee, optimize = einsum_type)
136
+ OPDM[:nocc, :nocc] += lib.einsum('Jiab,Iiba->IJ', t1_ccee, t2_ccee, optimize = einsum_type)
137
+
138
+ ##### OCC-VIR ### ####
139
+ OPDM[:nocc, nocc:] += lib.einsum('IA->IA', t3_ce, optimize = einsum_type).copy()
140
+ OPDM[:nocc, nocc:] += lib.einsum('IiAa,ia->IA', t1_ccee, t2_ce, optimize = einsum_type)
141
+ OPDM[:nocc, nocc:] -= 1/2 * \
142
+ lib.einsum('iIAa,ia->IA', t1_ccee, t2_ce, optimize = einsum_type)
143
+ ###### VIR-OCC ###
144
+ OPDM[nocc:, :nocc] += lib.einsum('IA->AI', t3_ce, optimize = einsum_type).copy()
145
+ OPDM[nocc:, :nocc] += lib.einsum('IiAa,ia->AI', t1_ccee, t2_ce, optimize = einsum_type)
146
+ OPDM[nocc:, :nocc] -= 1/2 * \
147
+ lib.einsum('iIAa,ia->AI', t1_ccee, t2_ce, optimize = einsum_type)
148
+
149
+ ##### VIR=VIR ###
150
+ OPDM[nocc:, nocc:] += 2 * lib.einsum('ijAa,ijBa->AB',
151
+ t1_ccee, t2_ccee, optimize = einsum_type)
152
+ OPDM[nocc:, nocc:] -= lib.einsum('ijAa,jiBa->AB', t1_ccee, t2_ccee, optimize = einsum_type)
153
+ OPDM[nocc:, nocc:] += 2 * lib.einsum('ijBa,ijAa->AB',
154
+ t1_ccee, t2_ccee, optimize = einsum_type)
155
+ OPDM[nocc:, nocc:] -= lib.einsum('ijBa,jiAa->AB', t1_ccee, t2_ccee, optimize = einsum_type)
156
+
157
+ return 2 * OPDM
158
+
159
+
83
160
  class RADC(lib.StreamObject):
84
161
  '''Ground state calculations
85
162
 
@@ -112,13 +189,12 @@ class RADC(lib.StreamObject):
112
189
  memorymin = getattr(__config__, 'adc_radc_RADC_memorymin', 2000)
113
190
 
114
191
  _keys = {
115
- 'tol_residual','conv_tol', 'e_corr', 'method', 'mo_coeff',
192
+ 'tol_residual','conv_tol', 'e_corr', 'method', 'method_type', 'mo_coeff',
116
193
  'mol', 'mo_energy', 'incore_complete',
117
- 'scf_energy', 'e_tot', 't1', 'frozen', 'chkfile',
118
- 'max_space', 't2', 'mo_occ', 'max_cycle',
119
- 'imds', 'method', 'method_type', 'with_df', 'compute_properties',
194
+ 'scf_energy', 'e_tot', 't1', 't2', 'frozen', 'chkfile',
195
+ 'max_space', 'mo_occ', 'max_cycle', 'imds', 'with_df', 'compute_properties',
120
196
  'approx_trans_moments', 'evec_print_tol', 'spec_factor_print_tol',
121
- 'ncvs', 'E', 'U', 'P', 'X',
197
+ 'E', 'U', 'P', 'X', 'ncvs', 'dip_mom', 'dip_mom_nuc'
122
198
  }
123
199
 
124
200
  def __init__(self, mf, frozen=0, mo_coeff=None, mo_occ=None):
@@ -141,7 +217,7 @@ class RADC(lib.StreamObject):
141
217
  self.max_space = getattr(__config__, 'adc_radc_RADC_max_space', 12)
142
218
  self.max_cycle = getattr(__config__, 'adc_radc_RADC_max_cycle', 50)
143
219
  self.conv_tol = getattr(__config__, 'adc_radc_RADC_conv_tol', 1e-12)
144
- self.tol_residual = getattr(__config__, 'adc_radc_RADC_tol_res', 1e-6)
220
+ self.tol_residual = getattr(__config__, 'adc_radc_RADC_tol_residual', 1e-6)
145
221
  self.scf_energy = mf.e_tot
146
222
 
147
223
  self.frozen = frozen
@@ -172,9 +248,23 @@ class RADC(lib.StreamObject):
172
248
  self.P = None
173
249
  self.X = None
174
250
 
251
+ dip_ints = -self.mol.intor('int1e_r',comp=3)
252
+ dip_mom = np.zeros((dip_ints.shape[0], self._nmo, self._nmo))
253
+
254
+ for i in range(dip_ints.shape[0]):
255
+ dip = dip_ints[i,:,:]
256
+ dip_mom[i,:,:] = np.dot(mo_coeff.T, np.dot(dip, mo_coeff))
257
+
258
+ self.dip_mom = dip_mom
259
+
260
+ charges = self.mol.atom_charges()
261
+ coords = self.mol.atom_coords()
262
+ self.dip_mom_nuc = lib.einsum('i,ix->x', charges, coords)
263
+
175
264
  compute_amplitudes = radc_amplitudes.compute_amplitudes
176
265
  compute_energy = radc_amplitudes.compute_energy
177
266
  transform_integrals = radc_ao2mo.transform_integrals_incore
267
+ make_ref_rdm1 = make_ref_rdm1
178
268
 
179
269
  def dump_flags(self, verbose=None):
180
270
  logger.info(self, '')
@@ -194,8 +284,8 @@ class RADC(lib.StreamObject):
194
284
  return self
195
285
 
196
286
  def kernel_gs(self):
197
- assert (self.mo_coeff is not None)
198
- assert (self.mo_occ is not None)
287
+ assert(self.mo_coeff is not None)
288
+ assert(self.mo_occ is not None)
199
289
 
200
290
  self.method = self.method.lower()
201
291
  if self.method not in ("adc(2)", "adc(2)-x", "adc(3)"):
@@ -236,8 +326,8 @@ class RADC(lib.StreamObject):
236
326
  return self.e_corr, self.t1, self.t2
237
327
 
238
328
  def kernel(self, nroots=1, guess=None, eris=None):
239
- assert (self.mo_coeff is not None)
240
- assert (self.mo_occ is not None)
329
+ assert(self.mo_coeff is not None)
330
+ assert(self.mo_occ is not None)
241
331
 
242
332
  self.method = self.method.lower()
243
333
  if self.method not in ("adc(2)", "adc(2)-x", "adc(3)"):
@@ -293,8 +383,8 @@ class RADC(lib.StreamObject):
293
383
 
294
384
  def _finalize(self):
295
385
  '''Hook for dumping results and clearing up the object.'''
296
- logger.note(self, 'E_corr = %.8f',
297
- self.e_corr)
386
+ logger.note(self, 'MP%s correlation energy of reference state (a.u.) = %.8f',
387
+ self.method[4], self.e_corr)
298
388
  return self
299
389
 
300
390
  def ea_adc(self, nroots=1, guess=None, eris=None):
@@ -338,6 +428,7 @@ class RADC(lib.StreamObject):
338
428
  def make_rdm1(self):
339
429
  return self._adc_es.make_rdm1()
340
430
 
431
+
341
432
  if __name__ == '__main__':
342
433
  from pyscf import scf
343
434
  from pyscf import gto
@@ -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
 
@@ -526,7 +529,10 @@ def compute_energy(myadc, t2, eris):
526
529
  e_mp = 2 * lib.einsum('ijab,iabj', t2_new, eris_ovvo,optimize=True)
527
530
  e_mp -= lib.einsum('ijab,ibaj', t2_new, eris_ovvo,optimize=True)
528
531
 
532
+ logger.info(myadc, "Reference correlation energy (doubles): %.8f", e_mp)
533
+
529
534
  del t2_new
535
+
530
536
  return e_mp
531
537
 
532
538
 
pyscf/adc/radc_ao2mo.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
  import numpy as np
20
22
  import pyscf.ao2mo as ao2mo