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/pbc/dft/numint.py CHANGED
@@ -276,7 +276,8 @@ def eval_rho2(cell, ao, mo_coeff, mo_occ, non0tab=None, xctype='LDA',
276
276
  rho[4] -= rho5 * 2
277
277
  rho[tau_idx] -= rho5 * .5
278
278
  else:
279
- rho = numint.eval_rho2(cell, ao, mo_coeff, mo_occ, non0tab, xctype, verbose)
279
+ rho = numint.eval_rho2(cell, ao, mo_coeff, mo_occ, non0tab, xctype,
280
+ with_lapl, verbose)
280
281
  return rho
281
282
 
282
283
 
@@ -477,7 +478,7 @@ def nr_uks(ni, cell, grids, xc_code, dms, spin=1, relativity=0, hermi=1,
477
478
  vmata[i] += ni._vxc_mat(cell, ao_k1, wv[0], mask, xctype,
478
479
  shls_slice, ao_loc, v_hermi)
479
480
  vmatb[i] += ni._vxc_mat(cell, ao_k1, wv[1], mask, xctype,
480
- shls_slice, ao_loc, hermi)
481
+ shls_slice, ao_loc, v_hermi)
481
482
 
482
483
  vmat = numpy.stack([vmata, vmatb])
483
484
  # call swapaxes method to swap last two indices because vmat may be a 3D
@@ -636,11 +637,12 @@ def nr_rks_fxc(ni, cell, grids, xc_code, dm0, dms, relativity=0, hermi=0,
636
637
  elif isinstance(kpts, KPoints):
637
638
  kpts = kpts.kpts_ibz
638
639
 
640
+ v_hermi = 0
639
641
  if is_zero(kpts):
640
642
  if isinstance(dms, numpy.ndarray) and dms.dtype == numpy.double:
641
643
  # for real orbitals and real matrix, K_{ia,bj} = K_{ia,jb}
642
644
  # The output matrix v = K*x_{ia} is symmetric
643
- hermi = 1
645
+ v_hermi = 1
644
646
 
645
647
  if xctype in ('LDA', 'GGA', 'MGGA'):
646
648
  make_rho, nset, nao = ni._gen_rho_evaluator(cell, dms, hermi, False)
@@ -660,10 +662,10 @@ def nr_rks_fxc(ni, cell, grids, xc_code, dm0, dms, relativity=0, hermi=0,
660
662
  vxc1 = numpy.einsum('xg,xyg->yg', rho1, _fxc)
661
663
  wv = weight * vxc1
662
664
  vmat[i] += ni._vxc_mat(cell, ao_k1, wv, mask, xctype,
663
- shls_slice, ao_loc, hermi)
665
+ shls_slice, ao_loc, v_hermi)
664
666
 
665
667
  vmat = numpy.stack(vmat)
666
- if hermi == 1:
668
+ if v_hermi == 1:
667
669
  # call swapaxes method to swap last two indices because vmat may be a 3D
668
670
  # array (nset,nao,nao) in single k-point mode or a 4D array
669
671
  # (nset,nkpts,nao,nao) in k-points mode
@@ -759,10 +761,11 @@ def nr_uks_fxc(ni, cell, grids, xc_code, dm0, dms, relativity=0, hermi=0,
759
761
  kpts = kpts.kpts_ibz
760
762
 
761
763
  dma, dmb = _format_uks_dm(dms)
764
+ v_hermi = 0
762
765
  if is_zero(kpts) and dma.dtype == numpy.double:
763
766
  # for real orbitals and real matrix, K_{ia,bj} = K_{ia,jb}
764
767
  # The output matrix v = K*x_{ia} is symmetric
765
- hermi = 1
768
+ v_hermi = 1
766
769
 
767
770
  nao = dma.shape[-1]
768
771
  make_rhoa, nset = ni._gen_rho_evaluator(cell, dma, hermi, False)[:2]
@@ -782,19 +785,19 @@ def nr_uks_fxc(ni, cell, grids, xc_code, dm0, dms, relativity=0, hermi=0,
782
785
  for i in range(nset):
783
786
  rho1a = make_rhoa(i, ao_k1, mask, xctype)
784
787
  rho1b = make_rhob(i, ao_k1, mask, xctype)
785
- rho1 = numpy.stack([rho1a, rho1b])
786
788
  if xctype == 'LDA':
787
- vxc1 = numpy.einsum('ag,abyg->byg', rho1, _fxc[:,0,:])
789
+ wv = rho1a * _fxc[0,0] + rho1b * _fxc[1,0]
788
790
  else:
789
- vxc1 = numpy.einsum('axg,axbyg->byg', rho1, _fxc)
790
- wv = weight * vxc1
791
+ wv = numpy.einsum('xg,xbyg->byg', rho1a, _fxc[0])
792
+ wv += numpy.einsum('xg,xbyg->byg', rho1b, _fxc[1])
793
+ wv *= weight
791
794
  vmata[i] += ni._vxc_mat(cell, ao_k1, wv[0], mask, xctype,
792
- shls_slice, ao_loc, hermi)
795
+ shls_slice, ao_loc, v_hermi)
793
796
  vmatb[i] += ni._vxc_mat(cell, ao_k1, wv[1], mask, xctype,
794
- shls_slice, ao_loc, hermi)
797
+ shls_slice, ao_loc, v_hermi)
795
798
 
796
799
  vmat = numpy.stack([vmata, vmatb])
797
- if hermi == 1:
800
+ if v_hermi == 1:
798
801
  vmat = vmat + vmat.conj().swapaxes(-2,-1)
799
802
  if nset == 1:
800
803
  vmat = vmat.reshape((2,) + dma.shape)
@@ -852,12 +855,13 @@ def cache_xc_kernel(ni, cell, grids, xc_code, mo_coeff, mo_occ, spin=0,
852
855
  else:
853
856
  is_rhf = mo_coeff[0].ndim == 1
854
857
 
858
+ with_lapl = False
855
859
  nao = cell.nao_nr()
856
860
  if is_rhf:
857
861
  rho = []
858
862
  for ao_k1, ao_k2, mask, weight, coords \
859
863
  in ni.block_loop(cell, grids, nao, ao_deriv, kpts, None, max_memory):
860
- rho.append(ni.eval_rho2(cell, ao_k1, mo_coeff, mo_occ, mask, xctype))
864
+ rho.append(ni.eval_rho2(cell, ao_k1, mo_coeff, mo_occ, mask, xctype, with_lapl))
861
865
  rho = numpy.hstack(rho)
862
866
  if spin == 1:
863
867
  rho *= .5
@@ -868,8 +872,8 @@ def cache_xc_kernel(ni, cell, grids, xc_code, mo_coeff, mo_occ, spin=0,
868
872
  rhob = []
869
873
  for ao_k1, ao_k2, mask, weight, coords \
870
874
  in ni.block_loop(cell, grids, nao, ao_deriv, kpts, None, max_memory):
871
- rhoa.append(ni.eval_rho2(cell, ao_k1, mo_coeff[0], mo_occ[0], mask, xctype))
872
- rhob.append(ni.eval_rho2(cell, ao_k1, mo_coeff[1], mo_occ[1], mask, xctype))
875
+ rhoa.append(ni.eval_rho2(cell, ao_k1, mo_coeff[0], mo_occ[0], mask, xctype, with_lapl))
876
+ rhob.append(ni.eval_rho2(cell, ao_k1, mo_coeff[1], mo_occ[1], mask, xctype, with_lapl))
873
877
  rho = numpy.stack([numpy.hstack(rhoa), numpy.hstack(rhob)])
874
878
  vxc, fxc = ni.eval_xc_eff(xc_code, rho, deriv=2, xctype=xctype)[1:3]
875
879
  return rho, vxc, fxc
@@ -898,12 +902,13 @@ def cache_xc_kernel1(ni, cell, grids, xc_code, dm, spin=0,
898
902
 
899
903
  # 0th order density matrix must be hermitian
900
904
  hermi = 1
905
+ with_lapl = False
901
906
  nao = cell.nao_nr()
902
907
  if is_rhf:
903
908
  rho = []
904
909
  for ao_k1, ao_k2, mask, weight, coords \
905
910
  in ni.block_loop(cell, grids, nao, ao_deriv, kpts, None, max_memory):
906
- rho.append(ni.eval_rho1(cell, ao_k1, dm, mask, xctype, hermi))
911
+ rho.append(ni.eval_rho1(cell, ao_k1, dm, mask, xctype, hermi, with_lapl))
907
912
  rho = numpy.hstack(rho)
908
913
  if spin == 1:
909
914
  rho *= .5
@@ -914,8 +919,8 @@ def cache_xc_kernel1(ni, cell, grids, xc_code, dm, spin=0,
914
919
  rhob = []
915
920
  for ao_k1, ao_k2, mask, weight, coords \
916
921
  in ni.block_loop(cell, grids, nao, ao_deriv, kpts, None, max_memory):
917
- rhoa.append(ni.eval_rho1(cell, ao_k1, dm[0], mask, xctype, hermi))
918
- rhob.append(ni.eval_rho1(cell, ao_k1, dm[1], mask, xctype, hermi))
922
+ rhoa.append(ni.eval_rho1(cell, ao_k1, dm[0], mask, xctype, hermi, with_lapl))
923
+ rhob.append(ni.eval_rho1(cell, ao_k1, dm[1], mask, xctype, hermi, with_lapl))
919
924
  rho = numpy.stack([numpy.hstack(rhoa), numpy.hstack(rhob)])
920
925
  vxc, fxc = ni.eval_xc_eff(xc_code, rho, deriv=2, xctype=xctype)[1:3]
921
926
  return rho, vxc, fxc
@@ -985,11 +990,13 @@ class NumInt(lib.StreamObject, numint.LibXCMixin):
985
990
  hermi, kpt, kpts_band, max_memory, verbose)
986
991
 
987
992
  def _vxc_mat(self, cell, ao, wv, mask, xctype, shls_slice, ao_loc, hermi):
993
+ if xctype == 'MGGA':
994
+ tau_idx = 4
995
+ wv[tau_idx] *= .5 # *.5 for 1/2 in tau
988
996
  if hermi == 1:
989
997
  # *.5 because mat + mat.T in the caller when hermi=1
990
998
  wv[0] *= .5
991
999
  if xctype == 'MGGA':
992
- tau_idx = 4
993
1000
  wv[tau_idx] *= .5
994
1001
  return _vxc_mat(cell, ao, wv, mask, xctype, shls_slice, ao_loc, hermi)
995
1002
 
@@ -1190,11 +1197,13 @@ class KNumInt(lib.StreamObject, numint.LibXCMixin):
1190
1197
  nao = ao_kpts[0].shape[-1]
1191
1198
  dtype = numpy.result_type(wv, *ao_kpts)
1192
1199
  mat = numpy.empty((nkpts,nao,nao), dtype=dtype)
1200
+ if xctype == 'MGGA':
1201
+ tau_idx = 4
1202
+ wv[tau_idx] *= .5 # *.5 for 1/2 in tau
1193
1203
  if hermi == 1:
1194
1204
  # *.5 because mat + mat.T in the caller when hermi=1
1195
1205
  wv[0] *= .5
1196
1206
  if xctype == 'MGGA':
1197
- tau_idx = 4
1198
1207
  wv[tau_idx] *= .5
1199
1208
 
1200
1209
  for k in range(nkpts):
pyscf/pbc/eph/eph_fd.py CHANGED
@@ -137,7 +137,7 @@ def kernel(mf, disp=1e-4, mo_rep=False):
137
137
  mo_coeff = np.asarray(mf.mo_coeff)
138
138
  RESTRICTED= (mo_coeff.ndim==3)
139
139
  cell = mf.cell
140
- cells_a, cells_b = gen_cells(cell, disp/2.0) # generate a bunch of cells with disp/2 on each cartesion coord
140
+ cells_a, cells_b = gen_cells(cell, disp/2.0) # generate a bunch of cells with disp/2 on each cartesian coord
141
141
  mfset = run_mfs(mf, cells_a, cells_b) # run mean field calculations on all these cells
142
142
  vmat = get_vmat(mf, mfset, disp) # extracting <u|dV|v>/dR
143
143
  hmat = run_hess(mfset, disp)
@@ -133,7 +133,7 @@ def kernel(method, assert_convergence=ASSERT_CONV,
133
133
  # When symmetry is enabled, the molecule may be shifted or rotated to make
134
134
  # the z-axis be the main axis. The transformation can cause inconsistency
135
135
  # between the optimization steps. The transformation is muted by setting
136
- # an explict point group to the keyword mol.symmetry (see symmetry
136
+ # an explicit point group to the keyword mol.symmetry (see symmetry
137
137
  # detection code in Mole.build function).
138
138
 
139
139
  # geomeTRIC library on pypi requires to provide config file log.ini.
pyscf/pbc/gto/cell.py CHANGED
@@ -66,6 +66,7 @@ def pack(cell):
66
66
  '''
67
67
  cldic = mole.pack(cell)
68
68
  cldic['a'] = cell.a
69
+ cldic['fractional'] = cell.fractional
69
70
  cldic['precision'] = cell.precision
70
71
  cldic['ke_cutoff'] = cell.ke_cutoff
71
72
  cldic['exp_to_discard'] = cell.exp_to_discard
@@ -87,8 +88,8 @@ def unpack(celldic):
87
88
  def dumps(cell):
88
89
  '''Serialize Cell object to a JSON formatted str.
89
90
  '''
90
- exclude_keys = {'output', 'stdout', '_keys', 'symm_orb', 'irrep_id',
91
- 'irrep_name', 'lattice_symmetry'}
91
+ exclude_keys = {'output', 'stdout', '_keys', '_ctx_lock',
92
+ 'symm_orb', 'irrep_id', 'irrep_name', 'lattice_symmetry'}
92
93
 
93
94
  celldic = dict(cell.__dict__)
94
95
  for k in exclude_keys:
@@ -497,7 +498,7 @@ def error_for_ke_cutoff(cell, ke_cutoff, omega=None):
497
498
  def get_bounding_sphere(cell, rcut):
498
499
  '''Finds all the lattice points within a sphere of radius rcut.
499
500
 
500
- Defines a parallelipiped given by -N_x <= n_x <= N_x, with x in [1,3]
501
+ Defines a parallelepiped given by -N_x <= n_x <= N_x, with x in [1,3]
501
502
  See Martin p. 85
502
503
 
503
504
  Args:
@@ -1075,7 +1076,7 @@ class Cell(mole.MoleBase):
1075
1076
 
1076
1077
  _keys = {
1077
1078
  'precision', 'exp_to_discard',
1078
- 'a', 'ke_cutoff', 'pseudo', 'dimension', 'low_dim_ft_type',
1079
+ 'a', 'ke_cutoff', 'pseudo', 'fractional', 'dimension', 'low_dim_ft_type',
1079
1080
  'space_group_symmetry', 'symmorphic', 'lattice_symmetry', 'mesh', 'rcut',
1080
1081
  'use_loose_rcut', 'use_particle_mesh_ewald',
1081
1082
  }
@@ -1087,6 +1088,7 @@ class Cell(mole.MoleBase):
1087
1088
  # of fourier components, with .5 * G**2 < ke_cutoff
1088
1089
  self.ke_cutoff = None
1089
1090
 
1091
+ self.fractional = False
1090
1092
  self.dimension = 3
1091
1093
  # TODO: Simple hack for now; the implementation of ewald depends on the
1092
1094
  # density-fitting class. This determines how the ewald produces
@@ -1265,13 +1267,23 @@ class Cell(mole.MoleBase):
1265
1267
  self._mesh_from_build = _mesh_from_build
1266
1268
  return self
1267
1269
 
1270
+ @lib.with_doc(mole.format_atom.__doc__)
1271
+ def format_atom(self, atoms, origin=0, axes=None,
1272
+ unit=getattr(__config__, 'UNIT', 'Ang')):
1273
+ if not self.fractional:
1274
+ return mole.format_atom(atoms, origin, axes, unit)
1275
+ _atoms = mole.format_atom(atoms, origin, axes, unit=1.)
1276
+ _a = self.lattice_vectors()
1277
+ c = np.array([a[1] for a in _atoms]).dot(_a)
1278
+ return [(a[0], r) for a, r in zip(_atoms, c.tolist())]
1279
+
1268
1280
  #Note: Exculde dump_input, parse_arg, basis from kwargs to avoid parsing twice
1269
1281
  def build(self, dump_input=True, parse_arg=mole.ARGPARSE,
1270
1282
  a=None, mesh=None, ke_cutoff=None, precision=None, nimgs=None,
1271
1283
  h=None, dimension=None, rcut= None, low_dim_ft_type=None,
1272
1284
  space_group_symmetry=None, symmorphic=None,
1273
1285
  use_loose_rcut=None, use_particle_mesh_ewald=None,
1274
- *args, **kwargs):
1286
+ fractional=None, *args, **kwargs):
1275
1287
  '''Setup Mole molecule and Cell and initialize some control parameters.
1276
1288
  Whenever you change the value of the attributes of :class:`Cell`,
1277
1289
  you need call this function to refresh the internal data of Cell.
@@ -1280,6 +1292,10 @@ class Cell(mole.MoleBase):
1280
1292
  a : (3,3) ndarray
1281
1293
  The real-space cell lattice vectors. Each row represents
1282
1294
  a lattice vector.
1295
+ fractional : bool
1296
+ Whether the atom postions are specified in fractional coordinates.
1297
+ The default value is False, which means the coordinates are
1298
+ interpreted as Cartesian coordinate.
1283
1299
  mesh : (3,) ndarray of ints
1284
1300
  The number of *positive* G-vectors along each direction.
1285
1301
  ke_cutoff : float
@@ -1318,6 +1334,7 @@ class Cell(mole.MoleBase):
1318
1334
  if mesh is not None: self.mesh = mesh
1319
1335
  if nimgs is not None: self.nimgs = nimgs
1320
1336
  if dimension is not None: self.dimension = dimension
1337
+ if fractional is not None: self.fractional = fractional
1321
1338
  if precision is not None: self.precision = precision
1322
1339
  if rcut is not None: self.rcut = rcut
1323
1340
  if ke_cutoff is not None: self.ke_cutoff = ke_cutoff
@@ -1331,8 +1348,11 @@ class Cell(mole.MoleBase):
1331
1348
  if symmorphic is not None:
1332
1349
  self.symmorphic = symmorphic
1333
1350
 
1334
- dump_input = dump_input and not self._built and self.verbose > logger.NOTE
1335
- mole.MoleBase.build(self, dump_input, parse_arg, *args, **kwargs)
1351
+ if self.a is None:
1352
+ raise RuntimeError('Lattice parameters not specified')
1353
+
1354
+ _built = self._built
1355
+ mole.MoleBase.build(self, False, parse_arg, *args, **kwargs)
1336
1356
 
1337
1357
  exp_min = np.array([self.bas_exp(ib).min() for ib in range(self.nbas)])
1338
1358
  if self.exp_to_discard is None:
@@ -1409,11 +1429,6 @@ class Cell(mole.MoleBase):
1409
1429
  '%d contracted functions', nprim_drop, nctr_drop)
1410
1430
  #logger.debug1(self, 'Old shells %s', steep_shls)
1411
1431
 
1412
- # The rest initialization requires lattice parameters. If .a is not
1413
- # set, pass the rest initialization.
1414
- if self.a is None:
1415
- return self
1416
-
1417
1432
  if self.rcut is None or self._rcut_from_build:
1418
1433
  self._rcut = estimate_rcut(self, self.precision)
1419
1434
  self._rcut_from_build = True
@@ -1449,7 +1464,8 @@ class Cell(mole.MoleBase):
1449
1464
  _check_mesh_symm = not self._mesh_from_build
1450
1465
  self.build_lattice_symmetry(check_mesh_symmetry=_check_mesh_symm)
1451
1466
 
1452
- if dump_input:
1467
+ if dump_input and not _built and self.verbose > logger.NOTE:
1468
+ self.dump_input()
1453
1469
  logger.info(self, 'lattice vectors a1 [%.9f, %.9f, %.9f]', *_a[0])
1454
1470
  logger.info(self, ' a2 [%.9f, %.9f, %.9f]', *_a[1])
1455
1471
  logger.info(self, ' a3 [%.9f, %.9f, %.9f]', *_a[2])
@@ -1536,7 +1552,7 @@ class Cell(mole.MoleBase):
1536
1552
  rcut_guess = estimate_rcut(self, self.precision)
1537
1553
  if self.rcut > rcut_guess*1.5:
1538
1554
  msg = ('.nimgs is a deprecated attribute. It is replaced by .rcut '
1539
- 'attribute for lattic sum cutoff radius. The given nimgs '
1555
+ 'attribute for lattice sum cutoff radius. The given nimgs '
1540
1556
  '%s is far over the estimated cutoff radius %s. ' %
1541
1557
  (x, rcut_guess))
1542
1558
  warnings.warn(msg)
@@ -1742,12 +1758,14 @@ class Cell(mole.MoleBase):
1742
1758
  '''Return a Mole object using the same atoms and basis functions as
1743
1759
  the Cell object.
1744
1760
  '''
1745
- #FIXME: should cell be converted to mole object? If cell is converted
1746
- # and a mole object is returned, many attributes (e.g. the GTH basis,
1747
- # gth-PP) will not be recognized by mole.build function.
1748
1761
  mol = self.view(mole.Mole)
1749
- delattr(mol, 'a')
1750
- delattr(mol, '_mesh')
1762
+ del mol.a
1763
+ mol.__dict__.pop('fractional', None)
1764
+ mol.__dict__.pop('ke_cutoff', None)
1765
+ mol.__dict__.pop('_mesh', None)
1766
+ mol.__dict__.pop('_rcut', None)
1767
+ mol.__dict__.pop('dimension', None)
1768
+ mol.__dict__.pop('low_dim_ft_type', None)
1751
1769
  mol.enuc = None #reset nuclear energy
1752
1770
  if mol.symmetry:
1753
1771
  mol._build_symmetry()
pyscf/pbc/gto/ecp.py CHANGED
@@ -21,29 +21,29 @@ Short range part of ECP under PBC
21
21
  '''
22
22
 
23
23
  from functools import reduce
24
- import numpy
24
+ import numpy as np
25
25
  from pyscf import lib
26
- from pyscf.pbc import gto
27
- from pyscf.gto import PTR_EXP, AS_ECPBAS_OFFSET, AS_NECPBAS
26
+ from pyscf import gto
27
+ from pyscf.pbc.gto.cell import _split_basis
28
+ from pyscf.pbc.df import incore
28
29
 
29
30
 
30
31
  def ecp_int(cell, kpts=None):
31
- from pyscf.pbc.df import incore
32
32
  lib.logger.debug(cell, 'PBC-ECP integrals')
33
33
  if kpts is None:
34
- kpts_lst = numpy.zeros((1,3))
34
+ kpts_lst = np.zeros((1,3))
35
35
  else:
36
- kpts_lst = numpy.reshape(kpts, (-1,3))
36
+ kpts_lst = np.reshape(kpts, (-1,3))
37
37
 
38
- cell, contr_coeff = gto.cell._split_basis(cell)
38
+ cell, contr_coeff = _split_basis(cell)
39
39
  lib.logger.debug1(cell, 'nao %d -> nao %d', *(contr_coeff.shape))
40
40
 
41
41
  ecpcell = cell.copy(deep=False)
42
42
  # append a fake s function to mimic the auxiliary index in pbc.incore.
43
- exp_ptr = cell._ecpbas[-1,PTR_EXP]
44
- ecpcell._bas = numpy.array([[0, 0, 1, 1, 0, exp_ptr, 0, 0]], dtype=numpy.int32)
43
+ exp_ptr = cell._ecpbas[-1,gto.PTR_EXP]
44
+ ecpcell._bas = np.array([[0, 0, 1, 1, 0, exp_ptr, 0, 0]], dtype=np.int32)
45
45
  # _env[AS_ECPBAS_OFFSET] is to be determined in pbc.incore
46
- cell._env[AS_NECPBAS] = len(cell._ecpbas)
46
+ cell._env[gto.AS_NECPBAS] = len(cell._ecpbas)
47
47
  # shls_slice of auxiliary index (0,1) corresponds to the fake s function
48
48
  shls_slice = (0, cell.nbas, 0, cell.nbas, 0, 1)
49
49
 
@@ -57,7 +57,7 @@ def ecp_int(cell, kpts=None):
57
57
  v = lib.unpack_tril(buf[k], lib.HERMITIAN)
58
58
  if abs(kpt).max() < 1e-9: # gamma_point:
59
59
  v = v.real
60
- mat.append(reduce(numpy.dot, (contr_coeff.T, v, contr_coeff)))
61
- if kpts is None or numpy.shape(kpts) == (3,):
60
+ mat.append(reduce(np.dot, (contr_coeff.T, v, contr_coeff)))
61
+ if kpts is None or np.shape(kpts) == (3,):
62
62
  mat = mat[0]
63
63
  return mat
pyscf/pbc/gto/eval_gto.py CHANGED
@@ -167,8 +167,8 @@ def eval_gto(cell, eval_name, coords, comp=None, kpts=None, kpt=None,
167
167
  pbc_eval_gto = eval_gto
168
168
 
169
169
  def _estimate_rcut(cell):
170
- '''Cutoff raidus, above which each shell decays to a value less than the
171
- required precsion'''
170
+ '''Cutoff radius, above which each shell decays to a value less than the
171
+ required precision'''
172
172
  vol = cell.vol
173
173
  weight_penalty = vol # ~ V[r] * (vol/ngrids) * ngrids
174
174
  precision = cell.precision / max(weight_penalty, 1)
@@ -227,7 +227,7 @@ def cart2polar(rvec):
227
227
 
228
228
 
229
229
  def get_pp(cell, kpt=np.zeros(3)):
230
- '''Get the periodic pseudotential nuc-el AO matrix
230
+ '''Get the periodic pseudopotential nuc-el AO matrix
231
231
  '''
232
232
  from pyscf.pbc import tools
233
233
  coords = cell.get_uniform_grids()
pyscf/pbc/gw/krgw_ac.py CHANGED
@@ -20,7 +20,7 @@
20
20
  PBC spin-restricted G0W0-AC QP eigenvalues with k-point sampling
21
21
  This implementation has N^4 scaling, and is faster than GW-CD (N^4)
22
22
  and analytic GW (N^6) methods.
23
- GW-AC is recommended for valence states only, and is inaccuarate for core states.
23
+ GW-AC is recommended for valence states only, and is inaccurate for core states.
24
24
 
25
25
  Method:
26
26
  See T. Zhu and G.K.-L. Chan, arxiv:2007.03148 (2020) for details
@@ -277,7 +277,7 @@ def get_sigma_diag(gw, orbs, kptlist, freqs, wts, iw_cutoff=None, max_memory=800
277
277
  for LpqR, LpqI, sign \
278
278
  in mydf.sr_loop([kpti, kptj], max_memory=0.1*gw._scf.max_memory, compact=False):
279
279
  Lpq.append(LpqR+LpqI*1.0j)
280
- # support uneqaul naux on different k points
280
+ # support unequal naux on different k points
281
281
  Lpq = np.vstack(Lpq).reshape(-1,nmo**2)
282
282
  tao = []
283
283
  ao_loc = None
@@ -389,7 +389,7 @@ def get_rho_response_wing(gw, omega, mo_energy, Lpq, qij):
389
389
  def get_qij(gw, q, mo_coeff, uniform_grids=False):
390
390
  '''
391
391
  Compute qij = 1/Omega * |< psi_{ik} | e^{iqr} | psi_{ak-q} >|^2 at q: (nkpts, nocc, nvir)
392
- through kp perturbtation theory
392
+ through kp perturbation theory
393
393
  Ref: Phys. Rev. B 83, 245122 (2011)
394
394
  '''
395
395
  nocc = gw.nocc
@@ -442,7 +442,7 @@ def _get_scaled_legendre_roots(nw):
442
442
 
443
443
  def _get_clenshaw_curtis_roots(nw):
444
444
  """
445
- Clenshaw-Curtis qaudrature on [0,inf)
445
+ Clenshaw-Curtis quadrature on [0,inf)
446
446
  Ref: J. Chem. Phys. 132, 234114 (2010)
447
447
  Returns:
448
448
  freqs : 1D ndarray
pyscf/pbc/gw/krgw_cd.py CHANGED
@@ -237,7 +237,7 @@ def get_WmnI_diag(gw, orbs, kptlist, freqs, max_memory=8000):
237
237
  for LpqR, LpqI, sign \
238
238
  in mydf.sr_loop([kpti, kptj], max_memory=0.1*gw._scf.max_memory, compact=False):
239
239
  Lpq.append(LpqR+LpqI*1.0j)
240
- # support uneqaul naux on different k points
240
+ # support unequal naux on different k points
241
241
  Lpq = np.vstack(Lpq).reshape(-1,nmo**2)
242
242
  tao = []
243
243
  ao_loc = None
@@ -338,7 +338,7 @@ def get_rho_response_R(gw, omega, mo_energy, Lpq, kL, kidx):
338
338
 
339
339
  def get_sigmaR_diag(gw, omega, kn, orbp, ef, freqs, qij, q_abs):
340
340
  '''
341
- Compute self-energy for poles inside coutour
341
+ Compute self-energy for poles inside contour
342
342
  (more and more expensive away from Fermi surface)
343
343
  '''
344
344
  mo_energy = np.array(gw._scf.mo_energy)
@@ -394,7 +394,7 @@ def get_sigmaR_diag(gw, omega, kn, orbp, ef, freqs, qij, q_abs):
394
394
  for LpqR, LpqI, sign \
395
395
  in mydf.sr_loop([kpti, kptj], max_memory=0.1*gw._scf.max_memory, compact=False):
396
396
  Lpq.append(LpqR+LpqI*1.0j)
397
- # support uneqaul naux on different k points
397
+ # support unequal naux on different k points
398
398
  Lpq = np.vstack(Lpq).reshape(-1,nmo**2)
399
399
  tao = []
400
400
  ao_loc = None
@@ -577,7 +577,7 @@ def _get_scaled_legendre_roots(nw):
577
577
 
578
578
  def _get_clenshaw_curtis_roots(nw):
579
579
  """
580
- Clenshaw-Curtis qaudrature on [0,inf)
580
+ Clenshaw-Curtis quadrature on [0,inf)
581
581
  Ref: J. Chem. Phys. 132, 234114 (2010)
582
582
  Returns:
583
583
  freqs : 1D ndarray
pyscf/pbc/gw/kugw_ac.py CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  '''
20
20
  PBC spin-unrestricted G0W0-AC QP eigenvalues with k-point sampling
21
- GW-AC is recommended for valence states only, and is inaccuarate for core states.
21
+ GW-AC is recommended for valence states only, and is inaccurate for core states.
22
22
 
23
23
  Method:
24
24
  See T. Zhu and G.K.-L. Chan, arxiv:2007.03148 (2020) for details
@@ -448,7 +448,7 @@ def get_rho_response_wing(gw, omega, mo_energy, Lpq, qij):
448
448
  def get_qij(gw, q, mo_coeff, uniform_grids=False):
449
449
  '''
450
450
  Compute qij = 1/Omega * |< psi_{ik} | e^{iqr} | psi_{ak-q} >|^2 at q: (nkpts, nocc, nvir)
451
- through kp perturbtation theory
451
+ through kp perturbation theory
452
452
  Ref: Phys. Rev. B 83, 245122 (2011)
453
453
  '''
454
454
  nocca, noccb = gw.nocc
@@ -507,7 +507,7 @@ def _get_scaled_legendre_roots(nw):
507
507
 
508
508
  def _get_clenshaw_curtis_roots(nw):
509
509
  """
510
- Clenshaw-Curtis qaudrature on [0,inf)
510
+ Clenshaw-Curtis quadrature on [0,inf)
511
511
  Ref: J. Chem. Phys. 132, 234114 (2010)
512
512
  Returns:
513
513
  freqs : 1D ndarray
@@ -30,7 +30,7 @@ KPT_DIFF_TOL = getattr(__config__, 'pbc_lib_kpts_helper_kpt_diff_tol', 1e-6)
30
30
 
31
31
  def is_zero(kpt):
32
32
  return abs(np.asarray(kpt)).sum() < KPT_DIFF_TOL
33
- gamma_point = is_zero
33
+ is_gamma_point = gamma_point = is_zero
34
34
 
35
35
  def round_to_fbz(kpts, wrap_around=False, tol=KPT_DIFF_TOL):
36
36
  '''
@@ -91,6 +91,7 @@ def unique(kpts):
91
91
  kpts.round(digits), return_index=True, return_inverse=True, axis=0)[1:3]
92
92
  idx = uniq_index.argsort()
93
93
  rank = idx.argsort()
94
+ uniq_inverse = uniq_inverse.ravel()
94
95
  return kpts[uniq_index[idx]], uniq_index[idx], rank[uniq_inverse]
95
96
  except TypeError:
96
97
  # Old numpy does not support unique of 2D array
@@ -261,7 +262,7 @@ def get_kconserv(cell, kpts):
261
262
  r'''Get the momentum conservation array for a set of k-points.
262
263
 
263
264
  Given k-point indices (k, l, m) the array kconserv[k,l,m] returns
264
- the index n that satifies momentum conservation,
265
+ the index n that satisfies momentum conservation,
265
266
 
266
267
  (k(k) - k(l) + k(m) - k(n)) \dot a = 2n\pi
267
268
 
@@ -287,7 +288,7 @@ def get_kconserv_ria(cell, kpts):
287
288
  for a set of k-points with appropriate k-shift.
288
289
 
289
290
  Given k-point indices m the array kconserv[kshift,m] returns the index n that
290
- satifies a shifted momentum conservation,
291
+ satisfies a shifted momentum conservation,
291
292
 
292
293
  (k(m) - k(n) - k(kshift)) \dot a = 2n\pi
293
294
 
@@ -649,7 +649,7 @@ class DavidsonZL:
649
649
  if tmp <= self.crit_e: nconv1+=1
650
650
  if VERBOSE: print(' No. of converged eigval:',nconv1)
651
651
  if nconv1 == neig:
652
- if VERBOSE: print(' Cong: all eignvalues converged ! ')
652
+ if VERBOSE: print(' Cong: all eigenvalues converged ! ')
653
653
  eigs = teig.copy()
654
654
 
655
655
  # Full Residuals: Res[i]=Res'[i]-w[i]*X[i]
pyscf/pbc/mp/kmp2.py CHANGED
@@ -380,7 +380,7 @@ def _frozen_sanity_check(frozen, mo_occ, kpt_idx):
380
380
 
381
381
  Args:
382
382
  frozen (array_like of int): The orbital indices that will be frozen.
383
- mo_occ (:obj:`ndarray` of int): The occupuation number for each orbital
383
+ mo_occ (:obj:`ndarray` of int): The occupation number for each orbital
384
384
  resulting from a mean-field-like calculation.
385
385
  kpt_idx (int): The k-point that `mo_occ` and `frozen` belong to.
386
386
 
pyscf/pbc/mpitools/mpi.py CHANGED
@@ -67,7 +67,7 @@ INQUIRY = 50050
67
67
  TASK = 50051
68
68
  def work_share_partition(tasks, interval=.02, loadmin=1):
69
69
  loadmin = max(loadmin, len(tasks)//50//pool.size)
70
- rest_tasks = [x for x in tasks[loadmin*pool.size:]]
70
+ rest_tasks = list(tasks[loadmin*pool.size:])
71
71
  tasks = tasks[loadmin*rank:loadmin*rank+loadmin]
72
72
  def distribute_task():
73
73
  while True:
pyscf/pbc/scf/addons.py CHANGED
@@ -91,13 +91,17 @@ class _SmearingKSCF(mol_addons._SmearingSCF):
91
91
 
92
92
  This is a k-point version of scf.hf.SCF.get_occ
93
93
  '''
94
+ from pyscf.pbc import scf
94
95
  if (self.sigma == 0) or (not self.sigma) or (not self.smearing_method):
95
96
  mo_occ_kpts = super().get_occ(mo_energy_kpts, mo_coeff_kpts)
96
97
  return mo_occ_kpts
97
98
 
98
99
  is_uhf = self.istype('KUHF')
99
100
  is_rhf = self.istype('KRHF')
100
- is_rohf = self.istype('KROHF')
101
+ if isinstance(self, scf.krohf.KROHF):
102
+ # ROHF leads to two Fock matrices. It's not clear how to define the
103
+ # Roothaan effective Fock matrix from the two.
104
+ raise NotImplementedError('Smearing-ROHF')
101
105
 
102
106
  sigma = self.sigma
103
107
  if self.smearing_method.lower() == 'fermi':
@@ -112,9 +116,7 @@ class _SmearingKSCF(mol_addons._SmearingSCF):
112
116
  else:
113
117
  nkpts = len(kpts)
114
118
 
115
- if self.fix_spin and (is_uhf or is_rohf): # spin separated fermi level
116
- if is_rohf: # treat rohf as uhf
117
- mo_energy_kpts = (mo_energy_kpts, mo_energy_kpts)
119
+ if self.fix_spin and is_uhf: # spin separated fermi level
118
120
  mo_es = [numpy.hstack(mo_energy_kpts[0]),
119
121
  numpy.hstack(mo_energy_kpts[1])]
120
122
  nocc = self.nelec
@@ -150,8 +152,6 @@ class _SmearingKSCF(mol_addons._SmearingSCF):
150
152
  mo_occ_kpts =(_partition_occ(mo_occs[0], mo_energy_kpts[0]),
151
153
  _partition_occ(mo_occs[1], mo_energy_kpts[1]))
152
154
  tools.print_mo_energy_occ_kpts(self, mo_energy_kpts, mo_occ_kpts, True)
153
- if is_rohf:
154
- mo_occ_kpts = numpy.array(mo_occ_kpts, dtype=numpy.float64).sum(axis=0)
155
155
  else:
156
156
  nocc = nelectron = self.mol.tot_electrons(nkpts)
157
157
  if is_uhf:
@@ -488,15 +488,19 @@ def convert_to_kscf(mf, out=None):
488
488
  }
489
489
  mf = mol_addons._object_without_soscf(mf, known_cls, False)
490
490
  if mf.mo_energy is not None:
491
- if mf.istype('UHF'):
492
- mf.mo_occ = mf.mo_occ[:,numpy.newaxis]
493
- mf.mo_coeff = mf.mo_coeff[:,numpy.newaxis]
494
- mf.mo_energy = mf.mo_energy[:,numpy.newaxis]
491
+ if isinstance(mf, scf.kuhf.KUHF):
492
+ mf.mo_occ = mf.mo_occ[:, numpy.newaxis]
493
+ mf.mo_coeff = mf.mo_coeff[:, numpy.newaxis]
494
+ mf.mo_energy = mf.mo_energy[:, numpy.newaxis]
495
495
  else:
496
496
  mf.mo_occ = mf.mo_occ[numpy.newaxis]
497
497
  mf.mo_coeff = mf.mo_coeff[numpy.newaxis]
498
498
  mf.mo_energy = mf.mo_energy[numpy.newaxis]
499
499
 
500
+ if hasattr(mf, '_numint'):
501
+ kpts = getattr(mf.kpts, 'kpts', mf.kpts)
502
+ mf._numint = dft.numint.KNumInt(kpts)
503
+
500
504
  if out is None:
501
505
  return mf
502
506
 
@@ -522,7 +526,7 @@ def mo_energy_with_exxdiv_none(mf, mo_coeff=None):
522
526
  fockao = mf.get_fock(vhf=vhf, dm=dm)
523
527
 
524
528
  def _get_moe1(C, fao):
525
- return lib.einsum('pi,pq,qi->i', C.conj(), fao, C)
529
+ return lib.einsum('pi,pq,qi->i', C.conj(), fao, C).real
526
530
  def _get_moek(kC, kfao):
527
531
  return [_get_moe1(C, fao) for C,fao in zip(kC, kfao)]
528
532
 
pyscf/pbc/scf/cphf.py CHANGED
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
  '''
20
- Restricted coupled pertubed Hartree-Fock solver
20
+ Restricted coupled perturbed Hartree-Fock solver
21
21
  Modified from pyscf.scf.cphf
22
22
  '''
23
23