pyscf 2.6.2__py3-none-macosx_11_0_arm64.whl → 2.8.0__py3-none-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyscf/__init__.py +2 -2
- pyscf/adc/__init__.py +3 -8
- pyscf/adc/dfadc.py +22 -6
- pyscf/adc/radc.py +106 -15
- pyscf/adc/radc_amplitudes.py +7 -1
- pyscf/adc/radc_ao2mo.py +4 -2
- pyscf/adc/radc_ea.py +524 -8
- pyscf/adc/radc_ip.py +492 -60
- pyscf/adc/radc_ip_cvs.py +4 -2
- pyscf/adc/uadc.py +116 -27
- pyscf/adc/uadc_amplitudes.py +215 -20
- pyscf/adc/uadc_ao2mo.py +30 -9
- pyscf/adc/uadc_ea.py +34 -44
- pyscf/adc/uadc_ip.py +9 -4
- pyscf/adc/uadc_ip_cvs.py +4 -1
- pyscf/agf2/__init__.py +2 -2
- pyscf/agf2/aux_space.py +1 -1
- pyscf/agf2/chkfile.py +1 -1
- pyscf/ao2mo/__init__.py +13 -2
- pyscf/ao2mo/_ao2mo.py +10 -1
- pyscf/ao2mo/incore.py +3 -0
- pyscf/ao2mo/nrr_outcore.py +2 -2
- pyscf/ao2mo/outcore.py +9 -7
- pyscf/ao2mo/r_outcore.py +2 -2
- pyscf/cc/__init__.py +21 -3
- pyscf/cc/bccd.py +0 -46
- pyscf/cc/ccsd.py +29 -13
- pyscf/cc/ccsd_rdm.py +6 -1
- pyscf/cc/gccsd.py +2 -2
- pyscf/cc/uccsd.py +7 -7
- pyscf/cc/uccsd_rdm.py +2 -2
- pyscf/data/elements.py +1 -1
- pyscf/df/__init__.py +2 -1
- pyscf/df/addons.py +79 -51
- pyscf/df/autoaux.py +195 -0
- pyscf/df/df.py +5 -1
- pyscf/df/df_jk.py +27 -25
- pyscf/df/grad/casscf.py +0 -41
- pyscf/df/grad/rhf.py +31 -1
- pyscf/df/hessian/rhf.py +2 -10
- pyscf/df/hessian/rks.py +1 -7
- pyscf/df/hessian/uhf.py +3 -13
- pyscf/df/hessian/uks.py +1 -8
- pyscf/df/incore.py +18 -6
- pyscf/df/outcore.py +6 -6
- pyscf/dft/dks.py +1 -1
- pyscf/dft/gks.py +25 -21
- pyscf/dft/libxc.py +91 -645
- pyscf/dft/numint.py +40 -19
- pyscf/dft/radi.py +48 -7
- pyscf/dft/rks.py +29 -25
- pyscf/dft/roks.py +7 -1
- pyscf/dft/uks.py +34 -25
- pyscf/dft/xc_deriv.py +1 -1
- pyscf/dft/xcfun.py +53 -2
- pyscf/eph/eph_fd.py +1 -1
- pyscf/eph/rhf.py +6 -36
- pyscf/eph/rks.py +0 -4
- pyscf/eph/uhf.py +1 -7
- pyscf/eph/uks.py +1 -7
- pyscf/fci/addons.py +117 -2
- pyscf/fci/cistring.py +1 -1
- pyscf/fci/direct_nosym.py +3 -3
- pyscf/fci/direct_spin0_symm.py +22 -43
- pyscf/fci/direct_spin1.py +65 -10
- pyscf/fci/direct_spin1_symm.py +49 -14
- pyscf/fci/direct_uhf.py +4 -4
- pyscf/fci/selected_ci_symm.py +1 -1
- pyscf/grad/ccsd.py +3 -7
- pyscf/grad/ccsd_slow.py +2 -3
- pyscf/grad/lagrange.py +11 -3
- pyscf/grad/mp2.py +13 -4
- pyscf/grad/sacasscf.py +1 -1
- pyscf/grad/tdrks.py +1 -1
- pyscf/grad/uccsd.py +3 -7
- pyscf/grad/ump2.py +2 -4
- pyscf/gto/basis/__init__.py +17 -4
- pyscf/gto/basis/bse.py +68 -15
- pyscf/gto/basis/def2-mtzvp.dat +4719 -0
- pyscf/gto/basis/def2-mtzvpp.dat +4739 -0
- pyscf/gto/basis/dyall-basis/__init__.py +0 -0
- pyscf/gto/basis/dyall-basis/dyall_2zp.py +6492 -0
- pyscf/gto/basis/dyall-basis/dyall_3zp.py +8343 -0
- pyscf/gto/basis/dyall-basis/dyall_4zp.py +10055 -0
- pyscf/gto/basis/dyall-basis/dyall_aae2z.py +1818 -0
- pyscf/gto/basis/dyall-basis/dyall_aae3z.py +2521 -0
- pyscf/gto/basis/dyall-basis/dyall_aae4z.py +3351 -0
- pyscf/gto/basis/dyall-basis/dyall_acv2z.py +1790 -0
- pyscf/gto/basis/dyall-basis/dyall_acv3z.py +2417 -0
- pyscf/gto/basis/dyall-basis/dyall_acv4z.py +3085 -0
- pyscf/gto/basis/dyall-basis/dyall_ae2z.py +6619 -0
- pyscf/gto/basis/dyall-basis/dyall_ae3z.py +9027 -0
- pyscf/gto/basis/dyall-basis/dyall_ae4z.py +11839 -0
- pyscf/gto/basis/dyall-basis/dyall_av2z.py +1742 -0
- pyscf/gto/basis/dyall-basis/dyall_av3z.py +2318 -0
- pyscf/gto/basis/dyall-basis/dyall_av4z.py +2905 -0
- pyscf/gto/basis/dyall-basis/dyall_cv2z.py +6558 -0
- pyscf/gto/basis/dyall-basis/dyall_cv3z.py +8767 -0
- pyscf/gto/basis/dyall-basis/dyall_cv4z.py +11098 -0
- pyscf/gto/basis/dyall-basis/dyall_v2z.py +6472 -0
- pyscf/gto/basis/dyall-basis/dyall_v3z.py +8539 -0
- pyscf/gto/basis/dyall-basis/dyall_v4z.py +10658 -0
- pyscf/gto/basis/ma-def2-qzvp.dat +5959 -0
- pyscf/gto/basis/ma-def2-qzvpp.dat +6195 -0
- pyscf/gto/basis/ma-def2-svp.dat +3504 -0
- pyscf/gto/basis/ma-def2-svpp.dat +3504 -0
- pyscf/gto/basis/ma-def2-tzvp.dat +4347 -0
- pyscf/gto/basis/ma-def2-tzvpp.dat +4549 -0
- pyscf/gto/basis/parse_cp2k.py +8 -7
- pyscf/gto/basis/parse_cp2k_pp.py +1 -1
- pyscf/gto/basis/parse_nwchem.py +26 -11
- pyscf/gto/basis/parse_nwchem_ecp.py +2 -1
- pyscf/gto/basis/sap_grasp_large.dat +2438 -0
- pyscf/gto/basis/sap_grasp_small.dat +1434 -0
- pyscf/gto/eval_gto.py +1 -1
- pyscf/gto/ft_ao.py +6 -6
- pyscf/gto/mole.py +123 -71
- pyscf/gto/moleintor.py +1 -1
- pyscf/gw/gw_ac.py +2 -2
- pyscf/gw/gw_cd.py +2 -2
- pyscf/gw/rpa.py +135 -246
- pyscf/gw/ugw_ac.py +2 -2
- pyscf/gw/urpa.py +80 -131
- pyscf/hessian/rhf.py +30 -128
- pyscf/hessian/rks.py +1 -6
- pyscf/hessian/uhf.py +28 -138
- pyscf/hessian/uks.py +1 -8
- pyscf/lib/CMakeLists.txt +6 -2
- pyscf/lib/ao2mo/nr_ao2mo.c +1 -1
- pyscf/lib/ao2mo/nrr_ao2mo.c +1 -1
- pyscf/lib/ao2mo/r_ao2mo.c +1 -1
- pyscf/lib/cc/ccsd_pack.c +1 -1
- pyscf/lib/cc/ccsd_t.c +6 -6
- pyscf/lib/cc/uccsd_t.c +4 -4
- pyscf/lib/config.h +0 -1
- pyscf/lib/config.h.in +0 -1
- pyscf/lib/deps/include/XCFun/XCFunExport.h +1 -0
- pyscf/lib/deps/include/xc.h +28 -18
- pyscf/lib/deps/include/xc_funcs.h +50 -2
- pyscf/lib/deps/include/xc_version.h +3 -3
- pyscf/lib/deps/lib/libcint.6.dylib +0 -0
- pyscf/lib/deps/lib/{libxc.12.dylib → libxc.15.dylib} +0 -0
- pyscf/lib/deps/lib/libxcfun.2.dylib +0 -0
- pyscf/lib/dft/grid_common.c +1 -1
- pyscf/lib/dft/libxc_itrf.c +10 -7
- pyscf/lib/dft/nr_numint_sparse.c +3 -3
- pyscf/lib/dft/xcfun_itrf.c +1 -1
- pyscf/lib/diis.py +2 -2
- pyscf/lib/exceptions.py +6 -0
- pyscf/lib/gto/fill_grids_int2c.c +11 -9
- pyscf/lib/gto/fill_int2e.c +7 -5
- pyscf/lib/gto/fill_r_4c.c +1 -1
- pyscf/lib/gto/ft_ao.c +1 -1
- pyscf/lib/gto/ft_ao.h +1 -1
- pyscf/lib/gto/gto.h +2 -2
- pyscf/lib/gto/nr_ecp.c +3 -2
- pyscf/lib/libagf2.dylib +0 -0
- pyscf/lib/libao2mo.dylib +0 -0
- pyscf/lib/libcc.dylib +0 -0
- pyscf/lib/libcgto.dylib +0 -0
- pyscf/lib/libcvhf.dylib +0 -0
- pyscf/lib/libdft.dylib +0 -0
- pyscf/lib/libfci.dylib +0 -0
- pyscf/lib/libmcscf.dylib +0 -0
- pyscf/lib/libmp.dylib +0 -0
- pyscf/lib/libnp_helper.dylib +0 -0
- pyscf/lib/libpbc.dylib +0 -0
- pyscf/lib/libri.dylib +0 -0
- pyscf/lib/libxc_itrf.dylib +0 -0
- pyscf/lib/libxcfun_itrf.dylib +0 -0
- pyscf/lib/linalg_helper.py +117 -198
- pyscf/lib/logger.py +2 -1
- pyscf/lib/mcscf/fci_contract.c +10 -3
- pyscf/lib/misc.py +63 -22
- pyscf/lib/mp/CMakeLists.txt +22 -0
- pyscf/lib/mp/mp2.c +518 -0
- pyscf/lib/mp/mp2.h +44 -0
- pyscf/lib/np_helper/CMakeLists.txt +1 -1
- pyscf/lib/np_helper/imatcopy.c +360 -0
- pyscf/lib/np_helper/np_helper.c +94 -0
- pyscf/lib/np_helper/np_helper.h +26 -0
- pyscf/lib/numpy_helper.py +195 -11
- pyscf/lib/pbc/nr_direct.c +2 -7
- pyscf/lib/pbc/nr_ecp.c +10 -3
- pyscf/lib/pbc/pbc.h +1 -1
- pyscf/lib/vhf/fblas.h +3 -0
- pyscf/lib/vhf/nr_sgx_direct.c +8 -6
- pyscf/lib/vhf/nr_sr_vhf.c +8 -12
- pyscf/lib/vhf/optimizer.c +2 -2
- pyscf/lib/vhf/rkb_screen.c +139 -0
- pyscf/lo/iao.py +1 -1
- pyscf/lo/ibo.py +3 -3
- pyscf/lo/pipek_jacobi.py +1 -1
- pyscf/mcscf/__init__.py +2 -2
- pyscf/mcscf/addons.py +3 -3
- pyscf/mcscf/apc.py +2 -2
- pyscf/mcscf/casci.py +13 -7
- pyscf/mcscf/chkfile.py +69 -41
- pyscf/mcscf/dmet_cas.py +2 -2
- pyscf/mcscf/mc1step.py +72 -44
- pyscf/mcscf/newton_casscf.py +5 -5
- pyscf/mcscf/ucasci.py +1 -1
- pyscf/mcscf/umc1step.py +49 -28
- pyscf/md/integrators.py +3 -3
- pyscf/mp/__init__.py +1 -0
- pyscf/mp/dfmp2.py +498 -59
- pyscf/mp/dfmp2_native.py +11 -1
- pyscf/mp/dfmp2_slow.py +133 -0
- pyscf/mp/dfump2.py +672 -0
- pyscf/mp/dfump2_native.py +9 -0
- pyscf/mp/dfump2_slow.py +161 -0
- pyscf/mp/gmp2.py +6 -47
- pyscf/mp/mp2.py +25 -10
- pyscf/mp/ump2.py +30 -24
- pyscf/pbc/adc/kadc_rhf.py +1 -1
- pyscf/pbc/adc/kadc_rhf_amplitudes.py +2 -2
- pyscf/pbc/ao2mo/eris.py +1 -1
- pyscf/pbc/cc/kccsd_rhf.py +3 -3
- pyscf/pbc/cc/kccsd_t_rhf.py +2 -2
- pyscf/pbc/ci/kcis_rhf.py +2 -2
- pyscf/pbc/df/aft.py +8 -9
- pyscf/pbc/df/aft_ao2mo.py +1 -1
- pyscf/pbc/df/df.py +85 -12
- pyscf/pbc/df/df_jk.py +6 -2
- pyscf/pbc/df/fft.py +9 -5
- pyscf/pbc/df/fft_ao2mo.py +4 -0
- pyscf/pbc/df/fft_jk.py +18 -10
- pyscf/pbc/df/ft_ao.py +4 -3
- pyscf/pbc/df/gdf_builder.py +5 -4
- pyscf/pbc/df/incore.py +2 -2
- pyscf/pbc/df/mdf.py +6 -3
- pyscf/pbc/df/mdf_jk.py +2 -1
- pyscf/pbc/df/outcore.py +10 -10
- pyscf/pbc/df/rsdf.py +2 -2
- pyscf/pbc/df/rsdf_builder.py +13 -8
- pyscf/pbc/df/rsdf_helper.py +6 -6
- pyscf/pbc/df/rsdf_jk.py +2 -1
- pyscf/pbc/dft/cdft.py +5 -5
- pyscf/pbc/dft/gen_grid.py +3 -2
- pyscf/pbc/dft/gks.py +14 -3
- pyscf/pbc/dft/kgks.py +15 -4
- pyscf/pbc/dft/krks.py +28 -10
- pyscf/pbc/dft/krks_ksymm.py +21 -9
- pyscf/pbc/dft/krkspu.py +1 -30
- pyscf/pbc/dft/krkspu_ksymm.py +0 -30
- pyscf/pbc/dft/kuks.py +30 -13
- pyscf/pbc/dft/kuks_ksymm.py +22 -10
- pyscf/pbc/dft/kukspu.py +0 -27
- pyscf/pbc/dft/kukspu_ksymm.py +0 -30
- pyscf/pbc/dft/multigrid/multigrid.py +36 -33
- pyscf/pbc/dft/multigrid/multigrid_pair.py +7 -2
- pyscf/pbc/dft/multigrid/pp.py +1 -1
- pyscf/pbc/dft/numint.py +56 -31
- pyscf/pbc/dft/rks.py +16 -24
- pyscf/pbc/dft/uks.py +21 -4
- pyscf/pbc/eph/eph_fd.py +1 -1
- pyscf/pbc/geomopt/geometric_solver.py +1 -1
- pyscf/pbc/gto/_pbcintor.py +1 -0
- pyscf/pbc/gto/cell.py +194 -23
- pyscf/pbc/gto/ecp.py +12 -12
- pyscf/pbc/gto/eval_gto.py +3 -3
- pyscf/pbc/gto/neighborlist.py +4 -1
- pyscf/pbc/gto/pseudo/pp.py +1 -1
- pyscf/pbc/gw/krgw_ac.py +4 -4
- pyscf/pbc/gw/krgw_cd.py +4 -4
- pyscf/pbc/gw/kugw_ac.py +3 -3
- pyscf/pbc/lib/kpts_helper.py +4 -3
- pyscf/pbc/lib/linalg_helper.py +1 -1
- pyscf/pbc/mp/kmp2.py +1 -1
- pyscf/pbc/mpitools/mpi.py +1 -1
- pyscf/pbc/scf/_response_functions.py +141 -34
- pyscf/pbc/scf/addons.py +15 -11
- pyscf/pbc/scf/cphf.py +1 -1
- pyscf/pbc/scf/ghf.py +1 -1
- pyscf/pbc/scf/hf.py +21 -32
- pyscf/pbc/scf/kghf.py +33 -29
- pyscf/pbc/scf/khf.py +103 -29
- pyscf/pbc/scf/khf_ksymm.py +15 -1
- pyscf/pbc/scf/krohf.py +5 -7
- pyscf/pbc/scf/kuhf.py +54 -23
- pyscf/pbc/scf/kuhf_ksymm.py +1 -1
- pyscf/pbc/scf/rsjk.py +14 -10
- pyscf/pbc/scf/scfint.py +1 -1
- pyscf/pbc/scf/stability.py +27 -15
- pyscf/pbc/scf/uhf.py +3 -1
- pyscf/pbc/symm/symmetry.py +2 -2
- pyscf/pbc/tdscf/krhf.py +238 -154
- pyscf/pbc/tdscf/krks.py +1 -45
- pyscf/pbc/tdscf/kuhf.py +319 -171
- pyscf/pbc/tdscf/kuks.py +0 -56
- pyscf/pbc/tdscf/rhf.py +116 -3
- pyscf/pbc/tdscf/rks.py +2 -1
- pyscf/pbc/tdscf/uhf.py +214 -1
- pyscf/pbc/tdscf/uks.py +2 -1
- pyscf/pbc/tools/k2gamma.py +20 -6
- pyscf/pbc/tools/lattice.py +3 -3
- pyscf/pbc/tools/pbc.py +111 -91
- pyscf/pbc/tools/pyscf_ase.py +0 -1
- pyscf/pbc/tools/pywannier90.py +1 -1
- pyscf/qmmm/mm_mole.py +1 -1
- pyscf/scf/_response_functions.py +87 -46
- pyscf/scf/_vhf.py +15 -10
- pyscf/scf/addons.py +29 -15
- pyscf/scf/cphf.py +14 -52
- pyscf/scf/dhf.py +121 -38
- pyscf/scf/dispersion.py +10 -9
- pyscf/scf/ghf.py +25 -13
- pyscf/scf/ghf_symm.py +2 -2
- pyscf/scf/hf.py +262 -30
- pyscf/scf/rohf.py +37 -5
- pyscf/scf/stability.py +142 -112
- pyscf/scf/ucphf.py +21 -16
- pyscf/scf/uhf.py +104 -61
- pyscf/sgx/sgx.py +1 -1
- pyscf/sgx/sgx_jk.py +4 -4
- pyscf/solvent/__init__.py +2 -2
- pyscf/solvent/_attach_solvent.py +2 -0
- pyscf/solvent/_ddcosmo_tdscf_grad.py +1 -1
- pyscf/solvent/cosmors.py +366 -0
- pyscf/solvent/ddcosmo.py +1 -1
- pyscf/solvent/pcm.py +4 -4
- pyscf/solvent/pol_embed.py +1 -1
- pyscf/solvent/smd.py +5 -3
- pyscf/soscf/ciah.py +3 -11
- pyscf/soscf/newton_ah.py +5 -2
- pyscf/symm/__init__.py +1 -1
- pyscf/symm/addons.py +5 -5
- pyscf/symm/geom.py +1 -5
- pyscf/tdscf/_lr_eig.py +1002 -0
- pyscf/tdscf/dhf.py +84 -87
- pyscf/tdscf/dks.py +0 -4
- pyscf/tdscf/ghf.py +139 -127
- pyscf/tdscf/gks.py +27 -25
- pyscf/tdscf/rhf.py +194 -147
- pyscf/tdscf/rks.py +26 -22
- pyscf/tdscf/uhf.py +166 -118
- pyscf/tdscf/uks.py +32 -31
- pyscf/tools/fcidump.py +3 -0
- pyscf/tools/qcschema.py +265 -0
- pyscf/x2c/sfx2c1e.py +1 -1
- pyscf/x2c/tdscf.py +41 -41
- pyscf/x2c/x2c.py +15 -11
- {pyscf-2.6.2.dist-info → pyscf-2.8.0.dist-info}/METADATA +39 -36
- {pyscf-2.6.2.dist-info → pyscf-2.8.0.dist-info}/NOTICE +14 -1
- {pyscf-2.6.2.dist-info → pyscf-2.8.0.dist-info}/RECORD +348 -316
- {pyscf-2.6.2.dist-info → pyscf-2.8.0.dist-info}/WHEEL +1 -1
- pyscf/dft/gen_libxc_param.py +0 -35
- pyscf/dft/gen_xcfun_param.py +0 -209
- pyscf/pbc/tdscf/kproxy.py +0 -189
- pyscf/pbc/tdscf/kproxy_supercell.py +0 -664
- pyscf/pbc/tdscf/krhf_slow.py +0 -300
- pyscf/pbc/tdscf/krhf_slow_gamma.py +0 -175
- pyscf/pbc/tdscf/krhf_slow_supercell.py +0 -250
- pyscf/pbc/tdscf/proxy.py +0 -39
- pyscf/pbc/tdscf/rhf_slow.py +0 -35
- pyscf/tdscf/common_slow.py +0 -799
- pyscf/tdscf/proxy.py +0 -258
- pyscf/tdscf/rhf_slow.py +0 -181
- {pyscf-2.6.2.dist-info → pyscf-2.8.0.dist-info}/LICENSE +0 -0
- {pyscf-2.6.2.dist-info → pyscf-2.8.0.dist-info}/top_level.txt +0 -0
|
@@ -64,34 +64,64 @@ def _gen_rhf_response(mf, mo_coeff=None, mo_occ=None,
|
|
|
64
64
|
if hermi == 2:
|
|
65
65
|
v1 = numpy.zeros_like(dm1)
|
|
66
66
|
else:
|
|
67
|
+
assert kshift == 0
|
|
67
68
|
v1 = ni.nr_rks_fxc(cell, mf.grids, mf.xc, dm0, dm1, 0, hermi,
|
|
68
69
|
rho0, vxc, fxc, kpts, max_memory=max_memory)
|
|
69
70
|
if hybrid:
|
|
70
|
-
if
|
|
71
|
+
if omega == 0:
|
|
72
|
+
vj, vk = _get_jk(mf, cell, dm1, hermi, kpts, kshift)
|
|
73
|
+
vk *= hyb
|
|
74
|
+
elif alpha == 0: # LR=0, only SR exchange
|
|
75
|
+
vj = _get_j(mf, cell, dm1, hermi, kpts, kshift)
|
|
76
|
+
vk = _get_k(mf, cell, dm1, hermi, kpts, kshift, omega=-omega)
|
|
77
|
+
vk *= hyb
|
|
78
|
+
elif hyb == 0: # SR=0, only LR exchange
|
|
79
|
+
vj = _get_j(mf, cell, dm1, hermi, kpts, kshift)
|
|
80
|
+
vk = _get_k(mf, cell, dm1, hermi, kpts, kshift, omega=omega)
|
|
81
|
+
vk *= alpha
|
|
82
|
+
else: # SR and LR exchange with different ratios
|
|
71
83
|
vj, vk = _get_jk(mf, cell, dm1, hermi, kpts, kshift)
|
|
72
|
-
|
|
84
|
+
vk *= hyb
|
|
85
|
+
vk += _get_k(mf, cell, dm1, hermi, kpts, kshift, omega=omega) * (alpha-hyb)
|
|
86
|
+
if hermi != 2:
|
|
87
|
+
v1 += vj - .5 * vk
|
|
73
88
|
else:
|
|
74
|
-
v1
|
|
89
|
+
v1 += -.5 * vk
|
|
75
90
|
elif hermi != 2:
|
|
76
91
|
v1 += _get_j(mf, cell, dm1, hermi, kpts, kshift)
|
|
77
92
|
return v1
|
|
78
93
|
|
|
79
94
|
elif singlet:
|
|
95
|
+
fxc *= .5
|
|
80
96
|
def vind(dm1, kshift=0):
|
|
81
97
|
if hermi == 2:
|
|
82
98
|
v1 = numpy.zeros_like(dm1)
|
|
83
99
|
else:
|
|
100
|
+
assert kshift == 0
|
|
84
101
|
# nr_rks_fxc_st requires alpha of dm1
|
|
85
102
|
v1 = numint.nr_rks_fxc_st(ni, cell, mf.grids, mf.xc, dm0, dm1, 0,
|
|
86
103
|
True, rho0, vxc, fxc, kpts,
|
|
87
104
|
max_memory=max_memory)
|
|
88
|
-
v1 *= .5
|
|
89
105
|
if hybrid:
|
|
90
|
-
if
|
|
106
|
+
if omega == 0:
|
|
91
107
|
vj, vk = _get_jk(mf, cell, dm1, hermi, kpts, kshift)
|
|
92
|
-
|
|
108
|
+
vk *= hyb
|
|
109
|
+
elif alpha == 0: # LR=0, only SR exchange
|
|
110
|
+
vj = _get_j(mf, cell, dm1, hermi, kpts, kshift)
|
|
111
|
+
vk = _get_k(mf, cell, dm1, hermi, kpts, kshift, omega=-omega)
|
|
112
|
+
vk *= hyb
|
|
113
|
+
elif hyb == 0: # SR=0, only LR exchange
|
|
114
|
+
vj = _get_j(mf, cell, dm1, hermi, kpts, kshift)
|
|
115
|
+
vk = _get_k(mf, cell, dm1, hermi, kpts, kshift, omega=omega)
|
|
116
|
+
vk *= alpha
|
|
117
|
+
else: # SR and LR exchange with different ratios
|
|
118
|
+
vj, vk = _get_jk(mf, cell, dm1, hermi, kpts, kshift)
|
|
119
|
+
vk *= hyb
|
|
120
|
+
vk += _get_k(mf, cell, dm1, hermi, kpts, kshift, omega=omega) * (alpha-hyb)
|
|
121
|
+
if hermi != 2:
|
|
122
|
+
v1 += vj - .5 * vk
|
|
93
123
|
else:
|
|
94
|
-
v1
|
|
124
|
+
v1 += -.5 * vk
|
|
95
125
|
elif hermi != 2:
|
|
96
126
|
v1 += _get_j(mf, cell, dm1, hermi, kpts, kshift)
|
|
97
127
|
return v1
|
|
@@ -100,13 +130,23 @@ def _gen_rhf_response(mf, mo_coeff=None, mo_occ=None,
|
|
|
100
130
|
if hermi == 2:
|
|
101
131
|
v1 = numpy.zeros_like(dm1)
|
|
102
132
|
else:
|
|
133
|
+
assert kshift == 0
|
|
103
134
|
# nr_rks_fxc_st requires alpha of dm1
|
|
104
135
|
v1 = numint.nr_rks_fxc_st(ni, cell, mf.grids, mf.xc, dm0, dm1, 0,
|
|
105
136
|
False, rho0, vxc, fxc, kpts,
|
|
106
137
|
max_memory=max_memory)
|
|
107
138
|
v1 *= .5
|
|
108
139
|
if hybrid:
|
|
109
|
-
|
|
140
|
+
if omega == 0:
|
|
141
|
+
vk = _get_k(mf, cell, dm1, hermi, kpts, kshift) * hyb
|
|
142
|
+
elif alpha == 0: # LR=0, only SR exchange
|
|
143
|
+
vk = _get_k(mf, cell, dm1, hermi, kpts, kshift, omega=-omega) * hyb
|
|
144
|
+
elif hyb == 0: # SR=0, only LR exchange
|
|
145
|
+
vk = _get_k(mf, cell, dm1, hermi, kpts, kshift, omega=omega) * alpha
|
|
146
|
+
else: # SR and LR exchange with different ratios
|
|
147
|
+
vk = _get_k(mf, cell, dm1, hermi, kpts, kshift) * hyb
|
|
148
|
+
vk += _get_k(mf, cell, dm1, hermi, kpts, kshift, omega=omega) * (alpha-hyb)
|
|
149
|
+
v1 += -.5 * vk
|
|
110
150
|
return v1
|
|
111
151
|
|
|
112
152
|
else: # HF
|
|
@@ -154,6 +194,7 @@ def _gen_uhf_response(mf, mo_coeff=None, mo_occ=None,
|
|
|
154
194
|
if hermi == 2:
|
|
155
195
|
v1 = numpy.zeros_like(dm1)
|
|
156
196
|
else:
|
|
197
|
+
assert kshift == 0
|
|
157
198
|
v1 = ni.nr_uks_fxc(cell, mf.grids, mf.xc, dm0, dm1, 0, hermi,
|
|
158
199
|
rho0, vxc, fxc, kpts, max_memory=max_memory)
|
|
159
200
|
if not hybrid:
|
|
@@ -161,11 +202,25 @@ def _gen_uhf_response(mf, mo_coeff=None, mo_occ=None,
|
|
|
161
202
|
vj = _get_j(mf, cell, dm1, hermi, kpts, kshift)
|
|
162
203
|
v1 += vj[0] + vj[1]
|
|
163
204
|
else:
|
|
164
|
-
if
|
|
205
|
+
if omega == 0:
|
|
206
|
+
vj, vk = _get_jk(mf, cell, dm1, hermi, kpts, kshift)
|
|
207
|
+
vk *= hyb
|
|
208
|
+
elif alpha == 0: # LR=0, only SR exchange
|
|
209
|
+
vj = _get_j(mf, cell, dm1, hermi, kpts, kshift)
|
|
210
|
+
vk = _get_k(mf, cell, dm1, hermi, kpts, kshift, omega=-omega)
|
|
211
|
+
vk *= hyb
|
|
212
|
+
elif hyb == 0: # SR=0, only LR exchange
|
|
213
|
+
vj = _get_j(mf, cell, dm1, hermi, kpts, kshift)
|
|
214
|
+
vk = _get_k(mf, cell, dm1, hermi, kpts, kshift, omega=omega)
|
|
215
|
+
vk *= alpha
|
|
216
|
+
else: # SR and LR exchange with different ratios
|
|
165
217
|
vj, vk = _get_jk(mf, cell, dm1, hermi, kpts, kshift)
|
|
166
|
-
|
|
218
|
+
vk *= hyb
|
|
219
|
+
vk += _get_k(mf, cell, dm1, hermi, kpts, kshift, omega=omega) * (alpha-hyb)
|
|
220
|
+
if with_j:
|
|
221
|
+
v1 += vj[0] + vj[1] - vk
|
|
167
222
|
else:
|
|
168
|
-
v1 -=
|
|
223
|
+
v1 -= vk
|
|
169
224
|
return v1
|
|
170
225
|
|
|
171
226
|
elif with_j:
|
|
@@ -187,7 +242,8 @@ def _gen_ghf_response(mf, mo_coeff=None, mo_occ=None,
|
|
|
187
242
|
'''
|
|
188
243
|
raise NotImplementedError
|
|
189
244
|
|
|
190
|
-
def _get_jk_kshift(mf, dm_kpts, hermi, kpts, kshift, with_j=True, with_k=True
|
|
245
|
+
def _get_jk_kshift(mf, dm_kpts, hermi, kpts, kshift, with_j=True, with_k=True,
|
|
246
|
+
omega=None):
|
|
191
247
|
from pyscf.pbc.df.df_jk import get_j_kpts_kshift, get_k_kpts_kshift
|
|
192
248
|
vj = vk = None
|
|
193
249
|
if with_j:
|
|
@@ -196,19 +252,23 @@ def _get_jk_kshift(mf, dm_kpts, hermi, kpts, kshift, with_j=True, with_k=True):
|
|
|
196
252
|
vk = get_k_kpts_kshift(mf.with_df, dm_kpts, kshift, hermi=hermi, kpts=kpts,
|
|
197
253
|
exxdiv=mf.exxdiv)
|
|
198
254
|
return vj, vk
|
|
199
|
-
def _get_jk(mf, cell, dm1, hermi, kpts, kshift, with_j=True, with_k=True):
|
|
255
|
+
def _get_jk(mf, cell, dm1, hermi, kpts, kshift, with_j=True, with_k=True, omega=None):
|
|
200
256
|
from pyscf.pbc import df
|
|
201
257
|
if kshift == 0:
|
|
202
|
-
return mf.get_jk(cell, dm1, hermi=hermi, kpts=kpts,
|
|
258
|
+
return mf.get_jk(cell, dm1, hermi=hermi, kpts=kpts,
|
|
259
|
+
with_j=with_j, with_k=with_k, omega=omega)
|
|
260
|
+
elif omega is not None and omega != 0:
|
|
261
|
+
raise NotImplementedError
|
|
203
262
|
elif mf.rsjk is not None or not isinstance(mf.with_df, df.df.DF):
|
|
204
263
|
lib.logger.error(mf, 'Non-zero kshift is only supported by GDF/RSDF.')
|
|
205
264
|
raise NotImplementedError
|
|
206
265
|
else:
|
|
207
|
-
return _get_jk_kshift(mf, dm1, hermi, kpts, kshift,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
266
|
+
return _get_jk_kshift(mf, dm1, hermi, kpts, kshift,
|
|
267
|
+
with_j=with_j, with_k=with_k, omega=omega)
|
|
268
|
+
def _get_j(mf, cell, dm1, hermi, kpts, kshift, omega=None):
|
|
269
|
+
return _get_jk(mf, cell, dm1, hermi, kpts, kshift, True, False, omega)[0]
|
|
270
|
+
def _get_k(mf, cell, dm1, hermi, kpts, kshift, omega=None):
|
|
271
|
+
return _get_jk(mf, cell, dm1, hermi, kpts, kshift, False, True, omega)[1]
|
|
212
272
|
|
|
213
273
|
|
|
214
274
|
khf.KRHF.gen_response = _gen_rhf_response
|
|
@@ -233,8 +293,6 @@ def _gen_rhf_response_gam(mf, mo_coeff=None, mo_occ=None,
|
|
|
233
293
|
|
|
234
294
|
omega, alpha, hyb = ni.rsh_and_hybrid_coeff(mf.xc, spin=cell.spin)
|
|
235
295
|
hybrid = ni.libxc.is_hybrid_xc(mf.xc)
|
|
236
|
-
if omega != 0: # For range separated Coulomb
|
|
237
|
-
raise NotImplementedError
|
|
238
296
|
|
|
239
297
|
if not hybrid and isinstance(mf.with_df, multigrid.MultiGridFFTDF):
|
|
240
298
|
dm0 = mf.make_rdm1(mo_coeff, mo_occ)
|
|
@@ -261,16 +319,31 @@ def _gen_rhf_response_gam(mf, mo_coeff=None, mo_occ=None,
|
|
|
261
319
|
v1 = ni.nr_rks_fxc(cell, mf.grids, mf.xc, dm0, dm1, 0, hermi,
|
|
262
320
|
rho0, vxc, fxc, kpt, max_memory=max_memory)
|
|
263
321
|
if hybrid:
|
|
322
|
+
if omega == 0:
|
|
323
|
+
vj, vk = mf.get_jk(cell, dm1, hermi, kpt=kpt)
|
|
324
|
+
vk *= hyb
|
|
325
|
+
elif alpha == 0: # LR=0, only SR exchange
|
|
326
|
+
vj = mf.get_j(cell, dm1, hermi, kpt=kpt)
|
|
327
|
+
vk = mf.get_k(cell, dm1, hermi, kpt=kpt, omega=-omega)
|
|
328
|
+
vk *= hyb
|
|
329
|
+
elif hyb == 0: # SR=0, only LR exchange
|
|
330
|
+
vj = mf.get_j(cell, dm1, hermi, kpt=kpt)
|
|
331
|
+
vk = mf.get_k(cell, dm1, hermi, kpt=kpt, omega=omega)
|
|
332
|
+
vk *= alpha
|
|
333
|
+
else: # SR and LR exchange with different ratios
|
|
334
|
+
vj, vk = mf.get_jk(cell, dm1, hermi, kpt=kpt)
|
|
335
|
+
vk *= hyb
|
|
336
|
+
vk += mf.get_k(cell, dm1, hermi, kpt=kpt, omega=omega) * (alpha-hyb)
|
|
264
337
|
if hermi != 2:
|
|
265
|
-
vj
|
|
266
|
-
v1 += vj - .5 * hyb * vk
|
|
338
|
+
v1 += vj - .5 * vk
|
|
267
339
|
else:
|
|
268
|
-
v1
|
|
340
|
+
v1 += -.5 * vk
|
|
269
341
|
elif hermi != 2:
|
|
270
342
|
v1 += mf.get_j(cell, dm1, hermi=hermi, kpt=kpt)
|
|
271
343
|
return v1
|
|
272
344
|
|
|
273
345
|
elif singlet:
|
|
346
|
+
fxc *= .5
|
|
274
347
|
def vind(dm1):
|
|
275
348
|
if hermi == 2:
|
|
276
349
|
v1 = numpy.zeros_like(dm1)
|
|
@@ -279,13 +352,26 @@ def _gen_rhf_response_gam(mf, mo_coeff=None, mo_occ=None,
|
|
|
279
352
|
v1 = numint.nr_rks_fxc_st(ni, cell, mf.grids, mf.xc, dm0, dm1, 0,
|
|
280
353
|
True, rho0, vxc, fxc, kpt,
|
|
281
354
|
max_memory=max_memory)
|
|
282
|
-
v1 *= .5
|
|
283
355
|
if hybrid:
|
|
356
|
+
if omega == 0:
|
|
357
|
+
vj, vk = mf.get_jk(cell, dm1, hermi, kpt=kpt)
|
|
358
|
+
vk *= hyb
|
|
359
|
+
elif alpha == 0: # LR=0, only SR exchange
|
|
360
|
+
vj = mf.get_j(cell, dm1, hermi, kpt=kpt)
|
|
361
|
+
vk = mf.get_k(cell, dm1, hermi, kpt=kpt, omega=-omega)
|
|
362
|
+
vk *= hyb
|
|
363
|
+
elif hyb == 0: # SR=0, only LR exchange
|
|
364
|
+
vj = mf.get_j(cell, dm1, hermi, kpt=kpt)
|
|
365
|
+
vk = mf.get_k(cell, dm1, hermi, kpt=kpt, omega=omega)
|
|
366
|
+
vk *= alpha
|
|
367
|
+
else: # SR and LR exchange with different ratios
|
|
368
|
+
vj, vk = mf.get_jk(cell, dm1, hermi, kpt=kpt)
|
|
369
|
+
vk *= hyb
|
|
370
|
+
vk += mf.get_k(cell, dm1, hermi, kpt=kpt, omega=omega) * (alpha-hyb)
|
|
284
371
|
if hermi != 2:
|
|
285
|
-
vj
|
|
286
|
-
v1 += vj - .5 * hyb * vk
|
|
372
|
+
v1 += vj - .5 * vk
|
|
287
373
|
else:
|
|
288
|
-
v1
|
|
374
|
+
v1 += -.5 * vk
|
|
289
375
|
elif hermi != 2:
|
|
290
376
|
v1 += mf.get_j(cell, dm1, hermi=hermi, kpt=kpt)
|
|
291
377
|
return v1
|
|
@@ -300,7 +386,16 @@ def _gen_rhf_response_gam(mf, mo_coeff=None, mo_occ=None,
|
|
|
300
386
|
max_memory=max_memory)
|
|
301
387
|
v1 *= .5
|
|
302
388
|
if hybrid:
|
|
303
|
-
|
|
389
|
+
if omega == 0:
|
|
390
|
+
vk = mf.get_k(cell, dm1, hermi, kpt=kpt) * hyb
|
|
391
|
+
elif alpha == 0: # LR=0, only SR exchange
|
|
392
|
+
vk = mf.get_k(cell, dm1, hermi, kpt=kpt, omega=-omega) * hyb
|
|
393
|
+
elif hyb == 0: # SR=0, only LR exchange
|
|
394
|
+
vk = mf.get_k(cell, dm1, hermi, kpt=kpt, omega=omega) * alpha
|
|
395
|
+
else: # SR and LR exchange with different ratios
|
|
396
|
+
vk = mf.get_k(cell, dm1, hermi, kpt=kpt) * hyb
|
|
397
|
+
vk += mf.get_k(cell, dm1, hermi, kpt=kpt, omega=omega) * (alpha-hyb)
|
|
398
|
+
v1 += -.5 * vk
|
|
304
399
|
return v1
|
|
305
400
|
|
|
306
401
|
else: # HF
|
|
@@ -329,8 +424,6 @@ def _gen_uhf_response_gam(mf, mo_coeff=None, mo_occ=None,
|
|
|
329
424
|
|
|
330
425
|
omega, alpha, hyb = ni.rsh_and_hybrid_coeff(mf.xc, spin=cell.spin)
|
|
331
426
|
hybrid = ni.libxc.is_hybrid_xc(mf.xc)
|
|
332
|
-
if omega != 0: # For range separated Coulomb
|
|
333
|
-
raise NotImplementedError
|
|
334
427
|
|
|
335
428
|
if not hybrid and isinstance(mf.with_df, multigrid.MultiGridFFTDF):
|
|
336
429
|
dm0 = mf.make_rdm1(mo_coeff, mo_occ)
|
|
@@ -355,11 +448,25 @@ def _gen_uhf_response_gam(mf, mo_coeff=None, mo_occ=None,
|
|
|
355
448
|
vj = mf.get_j(cell, dm1, hermi=hermi, kpt=kpt)
|
|
356
449
|
v1 += vj[0] + vj[1]
|
|
357
450
|
else:
|
|
451
|
+
if omega == 0:
|
|
452
|
+
vj, vk = mf.get_jk(cell, dm1, hermi, kpt=kpt)
|
|
453
|
+
vk *= hyb
|
|
454
|
+
elif alpha == 0: # LR=0, only SR exchange
|
|
455
|
+
vj = mf.get_j(cell, dm1, hermi, kpt=kpt)
|
|
456
|
+
vk = mf.get_k(cell, dm1, hermi, kpt=kpt, omega=-omega)
|
|
457
|
+
vk *= hyb
|
|
458
|
+
elif hyb == 0: # SR=0, only LR exchange
|
|
459
|
+
vj = mf.get_j(cell, dm1, hermi, kpt=kpt)
|
|
460
|
+
vk = mf.get_k(cell, dm1, hermi, kpt=kpt, omega=omega)
|
|
461
|
+
vk *= alpha
|
|
462
|
+
else: # SR and LR exchange with different ratios
|
|
463
|
+
vj, vk = mf.get_jk(cell, dm1, hermi, kpt=kpt)
|
|
464
|
+
vk *= hyb
|
|
465
|
+
vk += mf.get_k(cell, dm1, hermi, kpt=kpt, omega=omega) * (alpha-hyb)
|
|
358
466
|
if with_j:
|
|
359
|
-
|
|
360
|
-
v1 += vj[0] + vj[1] - vk * hyb
|
|
467
|
+
v1 += vj[0] + vj[1] - vk
|
|
361
468
|
else:
|
|
362
|
-
v1 -=
|
|
469
|
+
v1 -= vk
|
|
363
470
|
return v1
|
|
364
471
|
|
|
365
472
|
elif with_j:
|
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
|
-
|
|
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
|
|
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.
|
|
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
pyscf/pbc/scf/ghf.py
CHANGED
|
@@ -117,7 +117,7 @@ class GHF(pbchf.SCF):
|
|
|
117
117
|
_finalize = mol_ghf.GHF._finalize
|
|
118
118
|
analyze = lib.invalid_method('analyze')
|
|
119
119
|
mulliken_pop = lib.invalid_method('mulliken_pop')
|
|
120
|
-
mulliken_meta =
|
|
120
|
+
mulliken_meta = mol_ghf.GHF.mulliken_meta
|
|
121
121
|
spin_square = mol_ghf.GHF.spin_square
|
|
122
122
|
stability = mol_ghf.GHF.stability
|
|
123
123
|
|
pyscf/pbc/scf/hf.py
CHANGED
|
@@ -35,7 +35,6 @@ from pyscf.lib import logger
|
|
|
35
35
|
from pyscf.data import nist
|
|
36
36
|
from pyscf.pbc import gto
|
|
37
37
|
from pyscf.pbc import tools
|
|
38
|
-
from pyscf.pbc.gto import ecp
|
|
39
38
|
from pyscf.pbc.gto.pseudo import get_pp
|
|
40
39
|
from pyscf.pbc.scf import addons
|
|
41
40
|
from pyscf.pbc import df
|
|
@@ -83,6 +82,7 @@ def get_hcore(cell, kpt=np.zeros(3)):
|
|
|
83
82
|
else:
|
|
84
83
|
hcore += get_nuc(cell, kpt)
|
|
85
84
|
if len(cell._ecpbas) > 0:
|
|
85
|
+
from pyscf.pbc.gto import ecp
|
|
86
86
|
hcore += ecp.ecp_int(cell, kpt)
|
|
87
87
|
return hcore
|
|
88
88
|
|
|
@@ -246,7 +246,7 @@ def dip_moment(cell, dm, unit='Debye', verbose=logger.NOTE,
|
|
|
246
246
|
# With the optimal origin of the unti cell, the net dipole in the unit
|
|
247
247
|
# cell should be strictly zero. However, the integral grids are often not
|
|
248
248
|
# enough to produce the zero dipole. Errors are caused by the sub-optimal
|
|
249
|
-
# origin and the
|
|
249
|
+
# origin and the numerical integration.
|
|
250
250
|
if origin is None:
|
|
251
251
|
origin = _search_dipole_gauge_origin(cell, grids, rho, log)
|
|
252
252
|
|
|
@@ -540,40 +540,16 @@ class SCF(mol_hf.SCF):
|
|
|
540
540
|
|
|
541
541
|
@property
|
|
542
542
|
def kpts(self):
|
|
543
|
-
if 'kpts' in self.__dict__:
|
|
544
|
-
# To handle the attribute kpt loaded from chkfile
|
|
545
|
-
self.kpts = self.__dict__.pop('kpts')
|
|
546
543
|
return self.with_df.kpts
|
|
547
|
-
@kpts.setter
|
|
548
|
-
def kpts(self, x):
|
|
549
|
-
self.with_df.kpts = np.reshape(x, (-1,3))
|
|
550
|
-
if self.rsjk:
|
|
551
|
-
self.rsjk.kpts = self.with_df.kpts
|
|
552
544
|
|
|
553
545
|
def build(self, cell=None):
|
|
554
546
|
# To handle the attribute kpt or kpts loaded from chkfile
|
|
555
|
-
if '
|
|
556
|
-
self.kpts = self.__dict__.pop('kpts')
|
|
557
|
-
elif 'kpt' in self.__dict__:
|
|
547
|
+
if 'kpt' in self.__dict__:
|
|
558
548
|
self.kpt = self.__dict__.pop('kpt')
|
|
559
549
|
|
|
560
|
-
# "vcut_ws" precomputing is triggered by pbc.tools.pbc.get_coulG
|
|
561
|
-
#if self.exxdiv == 'vcut_ws':
|
|
562
|
-
# if self.exx_built is False:
|
|
563
|
-
# self.precompute_exx()
|
|
564
|
-
# logger.info(self, 'WS alpha = %s', self.exx_alpha)
|
|
565
|
-
|
|
566
|
-
kpts = self.kpts
|
|
567
550
|
if self.rsjk:
|
|
568
551
|
if not np.all(self.rsjk.kpts == self.kpt):
|
|
569
|
-
self.rsjk = self.rsjk.__class__(cell,
|
|
570
|
-
|
|
571
|
-
# for GDF and MDF
|
|
572
|
-
with_df = self.with_df
|
|
573
|
-
if len(kpts) > 1 and getattr(with_df, '_j_only', False):
|
|
574
|
-
logger.warn(self, 'df.j_only cannot be used with k-point HF')
|
|
575
|
-
with_df._j_only = False
|
|
576
|
-
with_df.reset()
|
|
552
|
+
self.rsjk = self.rsjk.__class__(cell, self.kpt)
|
|
577
553
|
|
|
578
554
|
if self.verbose >= logger.WARN:
|
|
579
555
|
self.check_sanity()
|
|
@@ -638,6 +614,7 @@ class SCF(mol_hf.SCF):
|
|
|
638
614
|
else:
|
|
639
615
|
nuc = self.with_df.get_nuc(kpt)
|
|
640
616
|
if len(cell._ecpbas) > 0:
|
|
617
|
+
from pyscf.pbc.gto import ecp
|
|
641
618
|
nuc += ecp.ecp_int(cell, kpt)
|
|
642
619
|
return nuc + cell.pbc_intor('int1e_kin', 1, 1, kpt)
|
|
643
620
|
|
|
@@ -680,7 +657,7 @@ class SCF(mol_hf.SCF):
|
|
|
680
657
|
|
|
681
658
|
if with_k and self.exxdiv == 'ewald':
|
|
682
659
|
from pyscf.pbc.df.df_jk import _ewald_exxdiv_for_G0
|
|
683
|
-
# G=0 is not
|
|
660
|
+
# G=0 is not included in the ._eri integrals
|
|
684
661
|
_ewald_exxdiv_for_G0(self.cell, kpt, dm.reshape(-1,nao,nao),
|
|
685
662
|
vk.reshape(-1,nao,nao))
|
|
686
663
|
elif self.rsjk:
|
|
@@ -786,9 +763,21 @@ class SCF(mol_hf.SCF):
|
|
|
786
763
|
def from_chk(self, chk=None, project=None, kpt=None):
|
|
787
764
|
return self.init_guess_by_chkfile(chk, project, kpt)
|
|
788
765
|
|
|
789
|
-
def dump_chk(self,
|
|
790
|
-
|
|
791
|
-
|
|
766
|
+
def dump_chk(self, envs_or_file):
|
|
767
|
+
'''Serialize the SCF object and save it to the specified chkfile.
|
|
768
|
+
|
|
769
|
+
Args:
|
|
770
|
+
envs_or_file:
|
|
771
|
+
If this argument is a file path, the serialized SCF object is
|
|
772
|
+
saved to the file specified by this argument.
|
|
773
|
+
If this attribute is a dict (created by locals()), the necessary
|
|
774
|
+
variables are saved to the file specified by the attribute mf.chkfile.
|
|
775
|
+
'''
|
|
776
|
+
mol_hf.SCF.dump_chk(self, envs_or_file)
|
|
777
|
+
if isinstance(envs_or_file, str):
|
|
778
|
+
with lib.H5FileWrap(envs_or_file, 'a') as fh5:
|
|
779
|
+
fh5['scf/kpt'] = self.kpt
|
|
780
|
+
elif self.chkfile:
|
|
792
781
|
with lib.H5FileWrap(self.chkfile, 'a') as fh5:
|
|
793
782
|
fh5['scf/kpt'] = self.kpt
|
|
794
783
|
return self
|
pyscf/pbc/scf/kghf.py
CHANGED
|
@@ -136,38 +136,41 @@ def get_occ(mf, mo_energy_kpts=None, mo_coeff_kpts=None):
|
|
|
136
136
|
|
|
137
137
|
return mo_occ_kpts
|
|
138
138
|
|
|
139
|
-
def
|
|
139
|
+
def _make_rdm1_meta(cell, dm_ao_kpts, kpts, pre_orth_method, s):
|
|
140
|
+
from pyscf.lo import orth
|
|
141
|
+
from pyscf.pbc.tools import k2gamma
|
|
142
|
+
|
|
143
|
+
kmesh = k2gamma.kpts_to_kmesh(cell, kpts-kpts[0])
|
|
144
|
+
nkpts, nso = dm_ao_kpts.shape[:2]
|
|
145
|
+
nao = nso // 2
|
|
146
|
+
scell, phase = k2gamma.get_phase(cell, kpts, kmesh)
|
|
147
|
+
s_sc = k2gamma.to_supercell_ao_integrals(cell, kpts, s, kmesh=kmesh, force_real=False)
|
|
148
|
+
orth_coeff = orth.orth_ao(scell, 'meta_lowdin', pre_orth_method, s=s_sc)[:,:nao] # cell 0 only
|
|
149
|
+
c_inv = np.dot(orth_coeff.T.conj(), s_sc)
|
|
150
|
+
c_inv = lib.einsum('aRp,Rk->kap', c_inv.reshape(nao,nkpts,nao), phase)
|
|
151
|
+
dm_aa = lib.einsum('kap,kpq,kbq->ab', c_inv, dm_ao_kpts[:,:nao,:nao], c_inv.conj())
|
|
152
|
+
dm_bb = lib.einsum('kap,kpq,kbq->ab', c_inv, dm_ao_kpts[:,nao:,nao:], c_inv.conj())
|
|
153
|
+
|
|
154
|
+
return (dm_aa, dm_bb)
|
|
155
|
+
|
|
156
|
+
def mulliken_meta(cell, dm_ao_kpts, kpts, verbose=logger.DEBUG,
|
|
140
157
|
pre_orth_method=PRE_ORTH_METHOD, s=None):
|
|
141
158
|
'''A modified Mulliken population analysis, based on meta-Lowdin AOs.
|
|
142
|
-
|
|
143
|
-
Note this function only computes the Mulliken population for the gamma
|
|
144
|
-
point density matrix.
|
|
159
|
+
The results are equivalent to the corresponding supercell calculation.
|
|
145
160
|
'''
|
|
146
|
-
from pyscf.lo import orth
|
|
147
|
-
if s is None:
|
|
148
|
-
s = khf.get_ovlp(cell)
|
|
149
161
|
log = logger.new_logger(cell, verbose)
|
|
150
|
-
log.note('Analyze output for *gamma point*.')
|
|
151
|
-
log.info(' To include the contributions from k-points, transform to a '
|
|
152
|
-
'supercell then run the population analysis on the supercell\n'
|
|
153
|
-
' from pyscf.pbc.tools import k2gamma\n'
|
|
154
|
-
' k2gamma.k2gamma(mf).mulliken_meta()')
|
|
155
|
-
log.note("KGHF mulliken_meta")
|
|
156
|
-
dm_ao_gamma = dm_ao_kpts[0,:,:]
|
|
157
|
-
nso = dm_ao_gamma.shape[-1]
|
|
158
|
-
nao = nso // 2
|
|
159
162
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
dm_bb =
|
|
163
|
+
if s is None:
|
|
164
|
+
s = khf.get_ovlp(None, cell=cell, kpts=kpts)
|
|
165
|
+
if s is not None:
|
|
166
|
+
if s[0].shape == dm_ao_kpts[0].shape: # s in SO
|
|
167
|
+
nao = dm_ao_kpts[0].shape[0]//2
|
|
168
|
+
s = lib.asarray(s[:,:nao,:nao], order='C') # keep only one spin sector
|
|
169
|
+
|
|
170
|
+
dm_aa, dm_bb = _make_rdm1_meta(cell, dm_ao_kpts, kpts, pre_orth_method, s)
|
|
168
171
|
|
|
169
172
|
log.note(' ** Mulliken pop alpha/beta on meta-lowdin orthogonal AOs **')
|
|
170
|
-
return mol_uhf.mulliken_pop(cell, (dm_aa,dm_bb), np.eye(
|
|
173
|
+
return mol_uhf.mulliken_pop(cell, (dm_aa,dm_bb), np.eye(dm_aa.shape[0]), log)
|
|
171
174
|
|
|
172
175
|
def _cast_mol_init_guess(fn):
|
|
173
176
|
def fn_init_guess(mf, cell=None, kpts=None):
|
|
@@ -259,12 +262,13 @@ class KGHF(khf.KSCF):
|
|
|
259
262
|
raise NotImplementedError
|
|
260
263
|
|
|
261
264
|
@lib.with_doc(mulliken_meta.__doc__)
|
|
262
|
-
def mulliken_meta(self, cell=None, dm=None, verbose=logger.DEBUG,
|
|
265
|
+
def mulliken_meta(self, cell=None, dm=None, kpts=None, verbose=logger.DEBUG,
|
|
263
266
|
pre_orth_method=PRE_ORTH_METHOD, s=None):
|
|
264
267
|
if cell is None: cell = self.cell
|
|
265
268
|
if dm is None: dm = self.make_rdm1()
|
|
266
|
-
if
|
|
267
|
-
|
|
269
|
+
if kpts is None: kpts = self.kpts
|
|
270
|
+
if s is None: s = khf.get_ovlp(self, cell, kpts)
|
|
271
|
+
return mulliken_meta(cell, dm, kpts, s=s, verbose=verbose,
|
|
268
272
|
pre_orth_method=pre_orth_method)
|
|
269
273
|
|
|
270
274
|
def mulliken_pop(self):
|
|
@@ -303,7 +307,7 @@ if __name__ == '__main__':
|
|
|
303
307
|
mf = KGHF(cell, kpts=kpts)
|
|
304
308
|
mf.kernel()
|
|
305
309
|
|
|
306
|
-
# x2c1e
|
|
310
|
+
# x2c1e decorator to KGHF class.
|
|
307
311
|
#mf = KGHF(cell, kpts=kpts).x2c1e()
|
|
308
312
|
# or
|
|
309
313
|
#mf = KGHF(cell, kpts=kpts).sfx2c1e()
|