gpu4pyscf 1.4.2__tar.gz → 1.4.3__tar.gz

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 (230) hide show
  1. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/CHANGELOG +21 -0
  2. {gpu4pyscf-1.4.2/gpu4pyscf.egg-info → gpu4pyscf-1.4.3}/PKG-INFO +1 -1
  3. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/__init__.py +3 -1
  4. gpu4pyscf-1.4.3/gpu4pyscf/_patch_pyscf.py +164 -0
  5. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/df.py +6 -4
  6. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/df_jk.py +41 -27
  7. gpu4pyscf-1.4.3/gpu4pyscf/df/grad/tdrks_ris.py +39 -0
  8. gpu4pyscf-1.4.3/gpu4pyscf/df/nac/__init__.py +15 -0
  9. gpu4pyscf-1.4.3/gpu4pyscf/df/nac/tdrhf.py +38 -0
  10. gpu4pyscf-1.4.3/gpu4pyscf/df/nac/tdrks.py +36 -0
  11. gpu4pyscf-1.4.3/gpu4pyscf/df/nac/tdrks_ris.py +35 -0
  12. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/dft/numint.py +18 -19
  13. gpu4pyscf-1.4.3/gpu4pyscf/dft/rkspu.py +350 -0
  14. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/dft/roks.py +14 -1
  15. gpu4pyscf-1.4.3/gpu4pyscf/dft/ukspu.py +242 -0
  16. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/grad/__init__.py +1 -2
  17. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/grad/rhf.py +25 -13
  18. gpu4pyscf-1.4.3/gpu4pyscf/grad/rkspu.py +130 -0
  19. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/grad/tdrhf.py +4 -4
  20. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/grad/tdrks.py +8 -8
  21. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/grad/tdrks_ris.py +18 -18
  22. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/grad/tduhf.py +4 -4
  23. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/grad/tduks.py +8 -8
  24. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/grad/uhf.py +7 -13
  25. gpu4pyscf-1.4.3/gpu4pyscf/grad/ukspu.py +77 -0
  26. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/gto/int3c1e.py +8 -4
  27. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/gto/mole.py +12 -10
  28. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/lib/cupy_helper.py +5 -0
  29. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/lib/utils.py +8 -9
  30. gpu4pyscf-1.4.3/gpu4pyscf/nac/__init__.py +18 -0
  31. gpu4pyscf-1.4.3/gpu4pyscf/nac/finite_diff.py +213 -0
  32. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/nac/tdrhf.py +10 -15
  33. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/nac/tdrks.py +19 -23
  34. gpu4pyscf-1.4.3/gpu4pyscf/nac/tdrks_ris.py +509 -0
  35. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/df/aft.py +31 -2
  36. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/df/df.py +33 -4
  37. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/df/fft.py +30 -5
  38. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/df/fft_jk.py +2 -1
  39. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/df/int3c2e.py +0 -3
  40. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/dft/__init__.py +4 -0
  41. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/dft/krks.py +3 -2
  42. gpu4pyscf-1.4.3/gpu4pyscf/pbc/dft/krkspu.py +326 -0
  43. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/dft/kuks.py +1 -1
  44. gpu4pyscf-1.4.3/gpu4pyscf/pbc/dft/kukspu.py +280 -0
  45. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/dft/multigrid.py +6 -7
  46. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/dft/multigrid_v2.py +101 -24
  47. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/dft/numint.py +3 -0
  48. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/dft/rks.py +6 -2
  49. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/dft/uks.py +1 -1
  50. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/grad/krhf.py +5 -4
  51. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/grad/krks.py +4 -0
  52. gpu4pyscf-1.4.3/gpu4pyscf/pbc/grad/krks_stress.py +396 -0
  53. gpu4pyscf-1.4.3/gpu4pyscf/pbc/grad/krkspu.py +144 -0
  54. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/grad/kuhf.py +2 -2
  55. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/grad/kuks.py +4 -0
  56. gpu4pyscf-1.4.3/gpu4pyscf/pbc/grad/kuks_stress.py +335 -0
  57. gpu4pyscf-1.4.3/gpu4pyscf/pbc/grad/kukspu.py +86 -0
  58. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/grad/rhf.py +3 -2
  59. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/grad/rks.py +5 -1
  60. gpu4pyscf-1.4.3/gpu4pyscf/pbc/grad/rks_stress.py +480 -0
  61. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/grad/uhf.py +3 -2
  62. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/grad/uks.py +5 -1
  63. gpu4pyscf-1.4.3/gpu4pyscf/pbc/grad/uks_stress.py +270 -0
  64. gpu4pyscf-1.4.3/gpu4pyscf/pbc/gto/int1e.py +228 -0
  65. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/lib/kpts_helper.py +17 -0
  66. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/scf/hf.py +18 -4
  67. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/scf/khf.py +7 -2
  68. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/scf/kuhf.py +1 -1
  69. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/scf/uhf.py +1 -1
  70. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/tools/pbc.py +3 -0
  71. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/properties/eda.py +2 -1
  72. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/scf/hf.py +24 -0
  73. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/scf/hf_lowmem.py +28 -0
  74. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/scf/rohf.py +14 -1
  75. gpu4pyscf-1.4.3/gpu4pyscf/tdscf/_krylov_tools.py +1285 -0
  76. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/tdscf/_lr_eig.py +16 -15
  77. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/tdscf/math_helper.py +198 -41
  78. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/tdscf/rhf.py +3 -2
  79. gpu4pyscf-1.4.3/gpu4pyscf/tdscf/ris.py +1565 -0
  80. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/tdscf/rks.py +6 -4
  81. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/tdscf/spectralib.py +30 -20
  82. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/tdscf/uhf.py +3 -0
  83. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/tdscf/uks.py +6 -0
  84. gpu4pyscf-1.4.3/gpu4pyscf/tools/ase_interface.py +145 -0
  85. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3/gpu4pyscf.egg-info}/PKG-INFO +1 -1
  86. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf.egg-info/SOURCES.txt +19 -1
  87. gpu4pyscf-1.4.2/gpu4pyscf/grad/dispersion.py +0 -29
  88. gpu4pyscf-1.4.2/gpu4pyscf/nac/__init__.py +0 -2
  89. gpu4pyscf-1.4.2/gpu4pyscf/pbc/dft/krkspu.py +0 -259
  90. gpu4pyscf-1.4.2/gpu4pyscf/pbc/dft/kukspu.py +0 -208
  91. gpu4pyscf-1.4.2/gpu4pyscf/tdscf/_krylov_tools.py +0 -641
  92. gpu4pyscf-1.4.2/gpu4pyscf/tdscf/ris.py +0 -1814
  93. gpu4pyscf-1.4.2/gpu4pyscf/tools/ase_interface.py +0 -81
  94. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/LICENSE +0 -0
  95. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/MANIFEST.in +0 -0
  96. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/README.md +0 -0
  97. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/__config__.py +0 -0
  98. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/cc/__init__.py +0 -0
  99. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/cc/ccsd_incore.py +0 -0
  100. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/__init__.py +0 -0
  101. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/cderi.py +0 -0
  102. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/grad/__init__.py +0 -0
  103. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/grad/jk.py +0 -0
  104. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/grad/rhf.py +0 -0
  105. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/grad/rks.py +0 -0
  106. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/grad/tdrhf.py +0 -0
  107. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/grad/tdrks.py +0 -0
  108. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/grad/tduhf.py +0 -0
  109. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/grad/tduks.py +0 -0
  110. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/grad/uhf.py +0 -0
  111. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/grad/uks.py +0 -0
  112. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/hessian/__init__.py +0 -0
  113. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/hessian/jk.py +0 -0
  114. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/hessian/rhf.py +0 -0
  115. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/hessian/rks.py +0 -0
  116. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/hessian/uhf.py +0 -0
  117. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/hessian/uks.py +0 -0
  118. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/int3c2e.py +0 -0
  119. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/df/int3c2e_bdiv.py +0 -0
  120. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/dft/__init__.py +0 -0
  121. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/dft/gen_grid.py +0 -0
  122. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/dft/gks.py +0 -0
  123. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/dft/libxc.py +0 -0
  124. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/dft/libxc_structs.py +0 -0
  125. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/dft/radi.py +0 -0
  126. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/dft/rks.py +0 -0
  127. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/dft/rks_lowmem.py +0 -0
  128. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/dft/uks.py +0 -0
  129. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/dft/xc_alias.py +0 -0
  130. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/dft/xc_deriv.py +0 -0
  131. {gpu4pyscf-1.4.2/gpu4pyscf/solvent/hessian → gpu4pyscf-1.4.3/gpu4pyscf/drivers}/__init__.py +0 -0
  132. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/drivers/basis_vDZP_NWCHEM.dat +0 -0
  133. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/drivers/dft_3c_driver.py +0 -0
  134. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/drivers/dft_driver.py +0 -0
  135. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/drivers/ecp_vDZP_NWCHEM.dat +0 -0
  136. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/drivers/opt_3c_driver.py +0 -0
  137. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/drivers/opt_driver.py +0 -0
  138. {gpu4pyscf-1.4.2/gpu4pyscf/pop → gpu4pyscf-1.4.3/gpu4pyscf/fci}/__init__.py +0 -0
  139. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/fci/direct_spin1.py +0 -0
  140. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/grad/rks.py +0 -0
  141. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/grad/uks.py +0 -0
  142. {gpu4pyscf-1.4.2/gpu4pyscf/solvent/grad → gpu4pyscf-1.4.3/gpu4pyscf/gto}/__init__.py +0 -0
  143. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/gto/ecp.py +0 -0
  144. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/gto/int3c1e_ip.py +0 -0
  145. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/gto/int3c1e_ipip.py +0 -0
  146. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/hessian/__init__.py +0 -0
  147. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/hessian/dispersion.py +0 -0
  148. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/hessian/jk.py +0 -0
  149. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/hessian/rhf.py +0 -0
  150. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/hessian/rks.py +0 -0
  151. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/hessian/uhf.py +0 -0
  152. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/hessian/uks.py +0 -0
  153. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/lib/__init__.py +0 -0
  154. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/lib/cublas.py +0 -0
  155. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/lib/cusolver.py +0 -0
  156. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/lib/cutensor.py +0 -0
  157. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/lib/diis.py +0 -0
  158. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/lib/logger.py +0 -0
  159. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/lib/memcpy.py +0 -0
  160. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/lib/multi_gpu.py +0 -0
  161. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/mp/__init__.py +0 -0
  162. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/mp/dfmp2.py +0 -0
  163. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/mp/mp2.py +0 -0
  164. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/__init__.py +0 -0
  165. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/df/__init__.py +0 -0
  166. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/df/aft_jk.py +0 -0
  167. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/df/df_jk.py +0 -0
  168. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/df/df_jk_real.py +0 -0
  169. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/df/ft_ao.py +0 -0
  170. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/df/rsdf_builder.py +0 -0
  171. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/dft/gen_grid.py +0 -0
  172. {gpu4pyscf-1.4.2/gpu4pyscf/pbc/lib → gpu4pyscf-1.4.3/gpu4pyscf/pbc/grad}/__init__.py +0 -0
  173. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/gto/__init__.py +0 -0
  174. {gpu4pyscf-1.4.2/gpu4pyscf/pbc/grad → gpu4pyscf-1.4.3/gpu4pyscf/pbc/lib}/__init__.py +0 -0
  175. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/scf/__init__.py +0 -0
  176. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/tools/__init__.py +0 -0
  177. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pbc/tools/k2gamma.py +0 -0
  178. {gpu4pyscf-1.4.2/gpu4pyscf/fci → gpu4pyscf-1.4.3/gpu4pyscf/pop}/__init__.py +0 -0
  179. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/pop/esp.py +0 -0
  180. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/properties/__init__.py +0 -0
  181. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/properties/ir.py +0 -0
  182. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/properties/polarizability.py +0 -0
  183. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/properties/raman.py +0 -0
  184. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/properties/shielding.py +0 -0
  185. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/qmmm/__init__.py +0 -0
  186. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/qmmm/chelpg.py +0 -0
  187. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/qmmm/pbc/__init__.py +0 -0
  188. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/qmmm/pbc/itrf.py +0 -0
  189. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/qmmm/pbc/mm_mole.py +0 -0
  190. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/qmmm/pbc/tools.py +0 -0
  191. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/scf/__init__.py +0 -0
  192. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/scf/_response_functions.py +0 -0
  193. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/scf/cphf.py +0 -0
  194. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/scf/diis.py +0 -0
  195. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/scf/dispersion.py +0 -0
  196. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/scf/ghf.py +0 -0
  197. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/scf/hf_symm.py +0 -0
  198. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/scf/int2c2e.py +0 -0
  199. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/scf/int4c2e.py +0 -0
  200. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/scf/j_engine.py +0 -0
  201. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/scf/jk.py +0 -0
  202. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/scf/soscf.py +0 -0
  203. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/scf/ucphf.py +0 -0
  204. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/scf/uhf.py +0 -0
  205. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/scf/uhf_symm.py +0 -0
  206. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/solvent/__init__.py +0 -0
  207. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/solvent/_attach_solvent.py +0 -0
  208. {gpu4pyscf-1.4.2/gpu4pyscf/gto → gpu4pyscf-1.4.3/gpu4pyscf/solvent/grad}/__init__.py +0 -0
  209. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/solvent/grad/pcm.py +0 -0
  210. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/solvent/grad/smd.py +0 -0
  211. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/solvent/grad/smd_experiment.py +0 -0
  212. {gpu4pyscf-1.4.2/gpu4pyscf/drivers → gpu4pyscf-1.4.3/gpu4pyscf/solvent/hessian}/__init__.py +0 -0
  213. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/solvent/hessian/pcm.py +0 -0
  214. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/solvent/hessian/smd.py +0 -0
  215. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/solvent/hessian/smd_experiment.py +0 -0
  216. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/solvent/pcm.py +0 -0
  217. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/solvent/smd.py +0 -0
  218. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/solvent/smd_experiment.py +0 -0
  219. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/solvent/tdscf/__init__.py +0 -0
  220. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/solvent/tdscf/pcm.py +0 -0
  221. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/tdscf/__init__.py +0 -0
  222. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/tdscf/_uhf_resp_sf.py +0 -0
  223. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/tdscf/parameter.py +0 -0
  224. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/tools/__init__.py +0 -0
  225. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf/tools/method_config.py +0 -0
  226. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf.egg-info/dependency_links.txt +0 -0
  227. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf.egg-info/requires.txt +0 -0
  228. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/gpu4pyscf.egg-info/top_level.txt +0 -0
  229. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/setup.cfg +0 -0
  230. {gpu4pyscf-1.4.2 → gpu4pyscf-1.4.3}/setup.py +0 -0
@@ -1,3 +1,24 @@
1
+ v1.4.3 (2025-08-20)
2
+ -------------------
3
+ * New Features
4
+ - Geometry optimization for excited states using TDDFT-ris methods.
5
+ - Non-adiabatic coupling vectors for TDDFT-ris methods.
6
+ - Analytical gradients for DFT+U with k-point sampling.
7
+ - Stress tensor calculations for semi-local DFT with k-point sampling and at the gamma-point.
8
+ - ASE interface to support crystal lattice optimization.
9
+ - Multigrid v2 algorithm for meta-GGA functionals.
10
+ * Improvements
11
+ - GPU kernels for PBC overlap and kinetic integrals.
12
+ - Reduced GPU memory usage for TDDFT-ris by storing tensors in host memory.
13
+ - In PBC methods, scaled k-points (fractional coordinates) are stored to
14
+ simplify lattice optimization calculations.
15
+ - A preconditioned Krylov solver to accelerate convergence in TDDFT and
16
+ dynamic polarizability calculations.
17
+ * Fixes
18
+ - Basis decontraction issue for d and f orbitals.
19
+ - A bug in Multigrid v2 algorithm related to non-orthogonal lattices.
20
+ - Incorrect virtual orbital energies when level_shift was enabled.
21
+
1
22
  v1.4.2 (2025-07-20)
2
23
  -------------------
3
24
  * New Features
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gpu4pyscf
3
- Version: 1.4.2
3
+ Version: 1.4.3
4
4
  Summary: GPU extensions for PySCF
5
5
  Author: PySCF developers
6
6
  License: Apache-2.0
@@ -12,7 +12,9 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = '1.4.2'
15
+ __version__ = '1.4.3'
16
+
17
+ from . import _patch_pyscf
16
18
 
17
19
  from . import lib, grad, hessian, solvent, scf, dft, tdscf, nac
18
20
 
@@ -0,0 +1,164 @@
1
+ # Copyright 2025 The PySCF Developers. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ import numpy as np
16
+ import cupy
17
+ import pyscf
18
+
19
+ if int(pyscf.__version__.split('.')[1]) <= 10:
20
+ def _fftdf_to_gpu(self):
21
+ from gpu4pyscf.pbc.df.fft import FFTDF
22
+ return FFTDF(self.cell, self.kpts)
23
+ from pyscf.pbc.df.fft import FFTDF
24
+ FFTDF.to_gpu = _fftdf_to_gpu
25
+
26
+ def _aftdf_to_gpu(self):
27
+ from gpu4pyscf.pbc.df.aft import AFTDF
28
+ return AFTDF(self.cell, self.kpts)
29
+ from pyscf.pbc.df.aft import AFTDF
30
+ AFTDF.to_gpu = _aftdf_to_gpu
31
+
32
+ def _gdf_to_gpu(self):
33
+ from gpu4pyscf.pbc.df.df import GDF
34
+ return GDF(self.cell, self.kpts)
35
+ from pyscf.pbc.df.df import GDF
36
+ GDF.to_gpu = _gdf_to_gpu
37
+
38
+ # patch PySCF Cell class, updating lattice parameters is not avail in pyscf 2.10
39
+ from pyscf import lib
40
+ from pyscf.lib import logger
41
+ from pyscf.gto import mole
42
+ from pyscf.pbc.gto.cell import Cell
43
+ def set_geom_(self, atoms_or_coords=None, unit=None, symmetry=None,
44
+ a=None, inplace=True):
45
+ '''Update geometry and lattice parameters
46
+
47
+ Kwargs:
48
+ atoms_or_coords : list, str, or numpy.ndarray
49
+ When specified in list or str, it is processed as the Mole.atom
50
+ attribute. If inputing a (N, 3) numpy array, this array
51
+ represents the coordinates of the atoms in the molecule.
52
+ a : list, str, or numpy.ndarray
53
+ If specified, it is assigned to the cell.a attribute. Its data
54
+ format should be the same to cell.a
55
+ unit : str
56
+ The unit for the input `atoms_or_coords` and `a`. If specified,
57
+ cell.unit will be updated to this value. If not provided, the
58
+ current cell.unit will be used for the two inputs.
59
+ symmetry : bool
60
+ Whether to enable space_group_symmetry. It is a reserved input
61
+ argument. This functionality is not supported yet.
62
+ inplace : bool
63
+ Whether to overwrite the existing Mole object.
64
+ '''
65
+ if inplace:
66
+ cell = self
67
+ else:
68
+ cell = self.copy(deep=False)
69
+ cell._env = cell._env.copy()
70
+
71
+ if unit is not None and cell.unit != unit:
72
+ if isinstance(unit, str):
73
+ if mole.is_au(unit):
74
+ _unit = 1.
75
+ else:
76
+ _unit = lib.param.BOHR
77
+ else:
78
+ _unit = unit
79
+ if a is None:
80
+ a = self.lattice_vectors() * _unit
81
+ if atoms_or_coords is None:
82
+ atoms_or_coords = self.atom_coords() * _unit
83
+
84
+ if a is not None:
85
+ logger.info(cell, 'Set new lattice vectors')
86
+ logger.info(cell, '%s', a)
87
+ cell.a = a
88
+ if cell._mesh_from_build:
89
+ cell.mesh = None
90
+ if cell._rcut_from_build:
91
+ cell.rcut = None
92
+ cell._built = False
93
+ cell.enuc = None
94
+
95
+ if atoms_or_coords is not None:
96
+ cell = mole.MoleBase.set_geom_(cell, atoms_or_coords, unit, symmetry)
97
+ if not cell._built:
98
+ cell.build(False, False)
99
+ return cell
100
+ Cell.set_geom_ = set_geom_
101
+
102
+ def get_lattice_Ls(cell, nimgs=None, rcut=None, dimension=None, discard=True):
103
+ '''This version employs more strict criteria when discarding images in lattice sum.
104
+ It can be replaced by the built-in version available in PySCF 2.10.
105
+ '''
106
+ if dimension is None:
107
+ # For atoms near the boundary of the cell, it is necessary (even in low-
108
+ # dimensional systems) to include lattice translations in all 3 dimensions.
109
+ if cell.dimension < 2 or cell.low_dim_ft_type == 'inf_vacuum':
110
+ dimension = cell.dimension
111
+ else:
112
+ dimension = 3
113
+ if rcut is None:
114
+ rcut = cell.rcut
115
+
116
+ if dimension == 0 or rcut <= 0 or cell.natm == 0:
117
+ return np.zeros((1, 3))
118
+
119
+ a = cell.lattice_vectors()
120
+
121
+ scaled_atom_coords = cell.get_scaled_atom_coords()
122
+ atom_boundary_max = scaled_atom_coords[:,:dimension].max(axis=0)
123
+ atom_boundary_min = scaled_atom_coords[:,:dimension].min(axis=0)
124
+ if (np.any(atom_boundary_max > 1) or np.any(atom_boundary_min < -1)):
125
+ atom_boundary_max[atom_boundary_max > 1] = 1
126
+ atom_boundary_min[atom_boundary_min <-1] = -1
127
+ ovlp_penalty = atom_boundary_max - atom_boundary_min
128
+ dR = ovlp_penalty.dot(a[:dimension])
129
+ dR_basis = np.diag(dR)
130
+
131
+ # Search the minimal x,y,z requiring |x*a[0]+y*a[1]+z*a[2]+dR|^2 > rcut^2
132
+ # Ls boundary should be derived by decomposing (a, Rij) for each atom-pair.
133
+ # For reasons unclear, the so-obtained Ls boundary seems not large enough.
134
+ # The upper-bound of the Ls boundary is generated by find_boundary function.
135
+ def find_boundary(a):
136
+ aR = np.vstack([a, dR_basis])
137
+ r = np.linalg.qr(aR.T)[1]
138
+ ub = (rcut + abs(r[2,3:]).sum()) / abs(r[2,2])
139
+ return ub
140
+
141
+ xb = find_boundary(a[[1,2,0]])
142
+ if dimension > 1:
143
+ yb = find_boundary(a[[2,0,1]])
144
+ else:
145
+ yb = 0
146
+ if dimension > 2:
147
+ zb = find_boundary(a)
148
+ else:
149
+ zb = 0
150
+ bounds = np.ceil([xb, yb, zb]).astype(int)
151
+ Ts = lib.cartesian_prod((np.arange(-bounds[0], bounds[0]+1),
152
+ np.arange(-bounds[1], bounds[1]+1),
153
+ np.arange(-bounds[2], bounds[2]+1)))
154
+ Ls = np.dot(Ts[:,:dimension], a[:dimension])
155
+
156
+ if discard and len(Ls) > 1:
157
+ r = cell.atom_coords()
158
+ rr = r[:,None] - r
159
+ dist_max = np.linalg.norm(rr, axis=2).max()
160
+ Ls_mask = np.linalg.norm(Ls, axis=1) < rcut + dist_max
161
+ Ls = Ls[Ls_mask]
162
+ return np.asarray(Ls, order='C')
163
+ # Patch the get_lattice_Ls for pyscf-2.9 or older
164
+ Cell.get_lattice_Ls = get_lattice_Ls
@@ -26,6 +26,7 @@ from gpu4pyscf.lib.cupy_helper import (
26
26
  from gpu4pyscf.df import int3c2e, df_jk
27
27
  from gpu4pyscf.df import int3c2e_bdiv
28
28
  from gpu4pyscf.lib import logger
29
+ from gpu4pyscf.lib import utils
29
30
  from gpu4pyscf import __config__
30
31
  from gpu4pyscf.__config__ import _streams, num_devices
31
32
 
@@ -38,7 +39,6 @@ LINEAR_DEP_THR = incore.LINEAR_DEP_THR
38
39
  GROUP_SIZE = 256
39
40
 
40
41
  class DF(lib.StreamObject):
41
- from gpu4pyscf.lib.utils import to_gpu, device
42
42
 
43
43
  _keys = {'intopt', 'nao', 'naux', 'cd_low', 'mol', 'auxmol', 'use_gpu_memory'}
44
44
 
@@ -71,10 +71,12 @@ class DF(lib.StreamObject):
71
71
  self.reset()
72
72
  self._auxbasis = x
73
73
 
74
+ to_gpu = utils.to_gpu
75
+ device = utils.device
76
+
74
77
  def to_cpu(self):
75
- from gpu4pyscf.lib.utils import to_cpu
76
- obj = to_cpu(self)
77
- return obj.reset()
78
+ from pyscf.df.df import DF
79
+ return utils.to_cpu(self, out=DF(self.mol, auxbasis=self.auxbasis))
78
80
 
79
81
  def build(self, direct_scf_tol=1e-14, omega=None):
80
82
  mol = self.mol
@@ -25,7 +25,7 @@ from gpu4pyscf.lib import logger
25
25
  from gpu4pyscf.lib.cupy_helper import (
26
26
  contract, transpose_sum, reduce_to_device, tag_array)
27
27
  from gpu4pyscf.dft import rks, uks, numint
28
- from gpu4pyscf.scf import hf, uhf
28
+ from gpu4pyscf.scf import hf, uhf, rohf
29
29
  from gpu4pyscf.df import df, int3c2e
30
30
  from gpu4pyscf.__config__ import _streams, num_devices
31
31
 
@@ -192,13 +192,24 @@ class _DFHF:
192
192
  if dm is None: dm = self.make_rdm1()
193
193
  assert not self.direct_scf
194
194
 
195
+ if isinstance(self, rohf.ROHF):
196
+ if getattr(dm, 'mo_coeff', None) is not None:
197
+ mo_coeff = cupy.repeat(dm.mo_coeff[None], 2, axis=0)
198
+ mo_occ = cupy.asarray([dm.mo_occ>0, dm.mo_occ==2],
199
+ dtype=numpy.double)
200
+ if dm.ndim == 2: # RHF DM
201
+ dm = cupy.repeat(dm[None]*.5, 2, axis=0)
202
+ dm = tag_array(dm, mo_coeff=mo_coeff, mo_occ=mo_occ)
203
+ elif dm.ndim == 2: # RHF DM
204
+ dm = cupy.repeat(dm[None]*.5, 2, axis=0)
205
+
195
206
  # for DFT
196
207
  if isinstance(self, rks.KohnShamDFT):
197
208
  t0 = logger.init_timer(self)
198
209
  rks.initialize_grids(self, mol, dm)
199
210
  ni = self._numint
200
- if dm.ndim == 2: # RKS
201
- n, exc, vxc = ni.nr_rks(mol, self.grids, self.xc, dm)
211
+ if isinstance(self, (uhf.UHF, rohf.ROHF)): # UKS
212
+ n, exc, vxc = ni.nr_uks(mol, self.grids, self.xc, dm)
202
213
  logger.debug(self, 'nelec by numeric integration = %s', n)
203
214
  if self.do_nlc():
204
215
  if ni.libxc.is_nlc(self.xc):
@@ -206,30 +217,31 @@ class _DFHF:
206
217
  else:
207
218
  assert ni.libxc.is_nlc(self.nlc)
208
219
  xc = self.nlc
209
- n, enlc, vnlc = ni.nr_nlc_vxc(mol, self.nlcgrids, xc, dm)
220
+ n, enlc, vnlc = ni.nr_nlc_vxc(mol, self.nlcgrids, xc, dm[0]+dm[1])
210
221
  exc += enlc
211
222
  vxc += vnlc
212
223
  logger.debug(self, 'nelec with nlc grids = %s', n)
213
- t0 = logger.timer_debug1(self, 'vxc tot', *t0)
224
+ t0 = logger.timer(self, 'vxc', *t0)
214
225
 
215
226
  if not ni.libxc.is_hybrid_xc(self.xc):
216
- vj = self.get_j(mol, dm, hermi)
227
+ vj = self.get_j(mol, dm[0]+dm[1], hermi)
217
228
  vxc += vj
218
229
  else:
219
230
  omega, alpha, hyb = ni.rsh_and_hybrid_coeff(self.xc, spin=mol.spin)
220
231
  vj, vk = self.get_jk(mol, dm, hermi)
232
+ vj = vj[0] + vj[1]
221
233
  vxc += vj
222
234
  vk *= hyb
223
- if omega != 0:
224
- vklr = self.get_k(mol, dm, hermi, omega=abs(omega))
235
+ if abs(omega) > 1e-10:
236
+ vklr = self.get_k(mol, dm, hermi, omega=omega)
225
237
  vklr *= (alpha - hyb)
226
238
  vk += vklr
227
- vxc -= vk * .5
228
- exc -= cupy.einsum('ij,ji', dm, vk).real * .25
229
- ecoul = cupy.einsum('ij,ji', dm, vj).real * .5
239
+ vxc -= vk
240
+ exc -= cupy.einsum('sij,sji->', dm, vk).real * .5
241
+ ecoul = cupy.einsum('sij,ji->', dm, vj).real * .5
230
242
 
231
- elif dm.ndim == 3: # UKS
232
- n, exc, vxc = ni.nr_uks(mol, self.grids, self.xc, dm)
243
+ elif isinstance(self, hf.RHF):
244
+ n, exc, vxc = ni.nr_rks(mol, self.grids, self.xc, dm)
233
245
  logger.debug(self, 'nelec by numeric integration = %s', n)
234
246
  if self.do_nlc():
235
247
  if ni.libxc.is_nlc(self.xc):
@@ -237,39 +249,41 @@ class _DFHF:
237
249
  else:
238
250
  assert ni.libxc.is_nlc(self.nlc)
239
251
  xc = self.nlc
240
- n, enlc, vnlc = ni.nr_nlc_vxc(mol, self.nlcgrids, xc, dm[0]+dm[1])
252
+ n, enlc, vnlc = ni.nr_nlc_vxc(mol, self.nlcgrids, xc, dm)
241
253
  exc += enlc
242
254
  vxc += vnlc
243
255
  logger.debug(self, 'nelec with nlc grids = %s', n)
244
- t0 = logger.timer(self, 'vxc', *t0)
256
+ t0 = logger.timer_debug1(self, 'vxc tot', *t0)
245
257
 
246
258
  if not ni.libxc.is_hybrid_xc(self.xc):
247
- vj = self.get_j(mol, dm[0]+dm[1], hermi)
259
+ vj = self.get_j(mol, dm, hermi)
248
260
  vxc += vj
249
261
  else:
250
262
  omega, alpha, hyb = ni.rsh_and_hybrid_coeff(self.xc, spin=mol.spin)
251
263
  vj, vk = self.get_jk(mol, dm, hermi)
252
- vj = vj[0] + vj[1]
253
264
  vxc += vj
254
265
  vk *= hyb
255
- if abs(omega) > 1e-10:
256
- vklr = self.get_k(mol, dm, hermi, omega=omega)
266
+ if omega != 0:
267
+ vklr = self.get_k(mol, dm, hermi, omega=abs(omega))
257
268
  vklr *= (alpha - hyb)
258
269
  vk += vklr
259
- vxc -= vk
260
- exc -= cupy.einsum('sij,sji->', dm, vk).real * .5
261
- ecoul = cupy.einsum('sij,ji->', dm, vj).real * .5
270
+ vxc -= vk * .5
271
+ exc -= cupy.einsum('ij,ji', dm, vk).real * .25
272
+ ecoul = cupy.einsum('ij,ji', dm, vj).real * .5
273
+
274
+ else:
275
+ raise NotImplementedError("DF only supports R/U/RO KS.")
262
276
  t0 = logger.timer_debug1(self, 'jk total', *t0)
263
277
  return tag_array(vxc, ecoul=ecoul, exc=exc, vj=None, vk=None)
264
278
 
265
- if dm.ndim == 2:
266
- vj, vk = self.get_jk(mol, dm, hermi=hermi)
267
- return vj - vk * .5
268
- elif dm.ndim == 3:
279
+ if isinstance(self, (uhf.UHF, rohf.ROHF)):
269
280
  vj, vk = self.get_jk(mol, dm, hermi=hermi)
270
281
  return vj[0] + vj[1] - vk
282
+ elif isinstance(self, hf.RHF):
283
+ vj, vk = self.get_jk(mol, dm, hermi=hermi)
284
+ return vj - vk * .5
271
285
  else:
272
- raise NotImplementedError("Please check the dimension of the density matrix, it should not reach here.")
286
+ raise NotImplementedError("DF only supports R/U/RO HF.")
273
287
 
274
288
  def to_cpu(self):
275
289
  obj = self.undo_df().to_cpu().density_fit()
@@ -0,0 +1,39 @@
1
+ # Copyright 2021-2025 The PySCF Developers. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from gpu4pyscf.df import int3c2e, df
16
+ from gpu4pyscf.df.grad import tdrhf as tdrhf_grad_df
17
+ from gpu4pyscf.tdscf import ris
18
+ from gpu4pyscf.grad import tdrks_ris as tdrks_ris_grad
19
+ from gpu4pyscf import __config__
20
+
21
+ class Gradients(tdrks_ris_grad.Gradients):
22
+ from gpu4pyscf.lib.utils import to_gpu, device
23
+
24
+ _keys = {'with_df', 'auxbasis_response'}
25
+ def __init__(self, td):
26
+ # Whether to include the response of DF auxiliary basis when computing
27
+ # nuclear gradients of J/K matrices
28
+ tdrks_ris_grad.Gradients.__init__(self, td)
29
+
30
+ auxbasis_response = True
31
+ get_jk = tdrhf_grad_df.get_jk
32
+
33
+ def check_sanity(self):
34
+ assert isinstance(self.base._scf, df.df_jk._DFHF)
35
+ assert isinstance(self.base, ris.TDDFT) or isinstance(self.base, ris.TDA)
36
+
37
+ get_veff = tdrhf_grad_df.get_veff
38
+
39
+ Grad = Gradients
@@ -0,0 +1,15 @@
1
+ # Copyright 2021-2024 The PySCF Developers. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from . import tdrhf, tdrks, tdrks_ris
@@ -0,0 +1,38 @@
1
+ # Copyright 2021-2024 The PySCF Developers. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from gpu4pyscf.nac import tdrhf as tdrhf_nac
16
+ from gpu4pyscf.df.grad.tdrhf import get_jk, get_veff
17
+ from gpu4pyscf.tdscf import rhf as tdrhf
18
+ from gpu4pyscf.lib import logger
19
+ from gpu4pyscf.df import df
20
+ from gpu4pyscf.lib.cupy_helper import tag_array
21
+
22
+
23
+ class NAC(tdrhf_nac.NAC):
24
+ from gpu4pyscf.lib.utils import to_gpu, device
25
+
26
+ _keys = {'with_df', 'auxbasis_response'}
27
+ def __init__(self, td):
28
+ # Whether to include the response of DF auxiliary basis when computing
29
+ # nuclear gradients of J/K matrices
30
+ tdrhf_nac.NAC.__init__(self, td)
31
+
32
+ auxbasis_response = True
33
+ get_jk = get_jk
34
+ get_veff = get_veff
35
+
36
+ def check_sanity(self):
37
+ assert isinstance(self.base._scf, df.df_jk._DFHF)
38
+ assert isinstance(self.base, tdrhf.TDHF) or isinstance(self.base, tdrhf.TDA)
@@ -0,0 +1,36 @@
1
+ # Copyright 2021-2024 The PySCF Developers. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from gpu4pyscf.nac import tdrks as tdrks_nac
16
+ from gpu4pyscf.df.nac import tdrhf as tdrhf_nac_df
17
+ from gpu4pyscf.df import df
18
+ from gpu4pyscf.tdscf import rks as tdrks
19
+
20
+ class NAC(tdrks_nac.NAC):
21
+ from gpu4pyscf.lib.utils import to_gpu, device
22
+
23
+ _keys = {'with_df', 'auxbasis_response'}
24
+ def __init__(self, td):
25
+ # Whether to include the response of DF auxiliary basis when computing
26
+ # nuclear gradients of J/K matrices
27
+ tdrks_nac.NAC.__init__(self, td)
28
+
29
+ auxbasis_response = True
30
+ get_jk = tdrhf_nac_df.get_jk
31
+
32
+ def check_sanity(self):
33
+ assert isinstance(self.base._scf, df.df_jk._DFHF)
34
+ assert isinstance(self.base, tdrks.TDDFT) or isinstance(self.base, tdrks.TDA)
35
+
36
+ get_veff = tdrhf_nac_df.get_veff
@@ -0,0 +1,35 @@
1
+ # Copyright 2021-2024 The PySCF Developers. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from gpu4pyscf.nac import tdrks_ris as tdrks_ris_nac
16
+ from gpu4pyscf.df.nac import tdrhf as tdrhf_nac_df
17
+ from gpu4pyscf.df import df
18
+ from gpu4pyscf.tdscf import ris
19
+
20
+ class NAC(tdrks_ris_nac.NAC):
21
+ from gpu4pyscf.lib.utils import to_gpu, device
22
+
23
+ _keys = {'with_df', 'auxbasis_response'}
24
+ def __init__(self, td):
25
+ # Whether to include the response of DF auxiliary basis when computing
26
+ # nuclear gradients of J/K matrices
27
+ tdrks_ris_nac.NAC.__init__(self, td)
28
+
29
+ auxbasis_response = True
30
+ get_veff = tdrhf_nac_df.get_veff
31
+ get_jk = tdrhf_nac_df.get_jk
32
+
33
+ def check_sanity(self):
34
+ assert isinstance(self.base._scf, df.df_jk._DFHF)
35
+ assert isinstance(self.base, ris.TDDFT) or isinstance(self.base, ris.TDA)
@@ -1528,18 +1528,24 @@ def cache_xc_kernel(ni, mol, grids, xc_code, mo_coeff, mo_occ, spin=0,
1528
1528
  def batch_square(a):
1529
1529
  return a[0]**2 + a[1]**2 + a[2]**2
1530
1530
 
1531
- def eval_xc_eff(ni, xc_code, rho, deriv=1, omega=None, xctype=None, verbose=None):
1531
+ def eval_xc_eff(ni, xc_code, rho, deriv=1, omega=None, xctype=None,
1532
+ verbose=None, spin=None):
1532
1533
  '''
1533
1534
  Different from PySCF, this function employ cuda version libxc
1534
1535
  '''
1535
1536
  if omega is None: omega = ni.omega
1536
1537
  if xctype is None: xctype = ni._xc_type(xc_code)
1537
1538
 
1538
- spin_polarized = rho.ndim >= 2 and rho.shape[0] == 2
1539
- xcfuns = ni._init_xcfuns(xc_code, spin_polarized)
1539
+ if spin is None:
1540
+ spin_polarized = rho.ndim >= 2 and rho.shape[0] == 2
1541
+ if spin_polarized:
1542
+ spin = 1
1543
+ else:
1544
+ spin = 0
1545
+ xcfuns = ni._init_xcfuns(xc_code, spin)
1540
1546
 
1541
1547
  inp = {}
1542
- if not spin_polarized:
1548
+ if spin == 0:
1543
1549
  assert rho.dtype == np.float64
1544
1550
  if xctype == 'LDA':
1545
1551
  inp['rho'] = rho.ravel()
@@ -1599,23 +1605,16 @@ def eval_xc_eff(ni, xc_code, rho, deriv=1, omega=None, xctype=None, verbose=None
1599
1605
  kxc = None
1600
1606
 
1601
1607
  exc = ret_full["zk"]
1602
- if not spin_polarized:
1603
- vxc = [ret_full[label] for label in vxc_labels if label in ret_full]
1604
- if do_fxc:
1605
- fxc = [ret_full[label] for label in fxc_labels if label in ret_full]
1606
- if do_kxc:
1607
- kxc = [ret_full[label] for label in kxc_labels if label in ret_full]
1608
- else:
1609
- vxc = [ret_full[label] for label in vxc_labels if label in ret_full]
1610
- if do_fxc:
1611
- fxc = [ret_full[label] for label in fxc_labels if label in ret_full]
1612
- if do_kxc:
1613
- kxc = [ret_full[label] for label in kxc_labels if label in ret_full]
1608
+ vxc = [ret_full[label] for label in vxc_labels if label in ret_full]
1609
+ if do_fxc:
1610
+ fxc = [ret_full[label] for label in fxc_labels if label in ret_full]
1611
+ if do_kxc:
1612
+ kxc = [ret_full[label] for label in kxc_labels if label in ret_full]
1614
1613
  if do_kxc:
1615
- kxc = xc_deriv.transform_kxc(rho, fxc, kxc, xctype, spin_polarized)
1614
+ kxc = xc_deriv.transform_kxc(rho, fxc, kxc, xctype, spin)
1616
1615
  if do_fxc:
1617
- fxc = xc_deriv.transform_fxc(rho, vxc, fxc, xctype, spin_polarized)
1618
- vxc = xc_deriv.transform_vxc(rho, vxc, xctype, spin_polarized)
1616
+ fxc = xc_deriv.transform_fxc(rho, vxc, fxc, xctype, spin)
1617
+ vxc = xc_deriv.transform_vxc(rho, vxc, xctype, spin)
1619
1618
  return exc, vxc, fxc, kxc
1620
1619
 
1621
1620
  def _init_xcfuns(xc_code, spin):