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
pyscf/tdscf/dhf.py
CHANGED
|
@@ -23,11 +23,11 @@ TDA and TDHF for no-pair DKS Hamiltonian
|
|
|
23
23
|
from functools import reduce
|
|
24
24
|
import numpy
|
|
25
25
|
from pyscf import lib
|
|
26
|
-
from pyscf import
|
|
26
|
+
from pyscf import scf
|
|
27
27
|
from pyscf import ao2mo
|
|
28
28
|
from pyscf.lib import logger
|
|
29
29
|
from pyscf.tdscf import rhf
|
|
30
|
-
from pyscf.
|
|
30
|
+
from pyscf.tdscf._lr_eig import eigh as lr_eigh, eig as lr_eig
|
|
31
31
|
from pyscf import __config__
|
|
32
32
|
|
|
33
33
|
OUTPUT_THRESHOLD = getattr(__config__, 'tdscf_uhf_get_nto_threshold', 0.3)
|
|
@@ -36,6 +36,7 @@ REAL_EIG_THRESHOLD = getattr(__config__, 'tdscf_uhf_TDDFT_pick_eig_threshold', 1
|
|
|
36
36
|
def gen_tda_operation(mf, fock_ao=None):
|
|
37
37
|
'''A x
|
|
38
38
|
'''
|
|
39
|
+
assert fock_ao is None
|
|
39
40
|
mo_coeff = mf.mo_coeff
|
|
40
41
|
mo_energy = mf.mo_energy
|
|
41
42
|
mo_occ = mf.mo_occ
|
|
@@ -49,28 +50,19 @@ def gen_tda_operation(mf, fock_ao=None):
|
|
|
49
50
|
orbv = mo_coeff[:,viridx]
|
|
50
51
|
orbo = mo_coeff[:,occidx]
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
#fock_ao = mf.get_hcore() + mf.get_veff(mol, dm0)
|
|
55
|
-
foo = numpy.diag(mo_energy[occidx])
|
|
56
|
-
fvv = numpy.diag(mo_energy[viridx])
|
|
57
|
-
else:
|
|
58
|
-
fock = reduce(numpy.dot, (mo_coeff.conj().T, fock_ao, mo_coeff))
|
|
59
|
-
foo = fock[occidx[:,None],occidx]
|
|
60
|
-
fvv = fock[viridx[:,None],viridx]
|
|
61
|
-
hdiag = (fvv.diagonal() - foo.diagonal()[:,None]).ravel()
|
|
53
|
+
e_ia = hdiag = mo_energy[viridx] - mo_energy[occidx,None]
|
|
54
|
+
hdiag = hdiag.ravel()
|
|
62
55
|
|
|
63
56
|
mo_coeff = numpy.asarray(numpy.hstack((orbo,orbv)), order='F')
|
|
64
57
|
vresp = mf.gen_response(hermi=0)
|
|
65
58
|
|
|
66
59
|
def vind(zs):
|
|
67
60
|
zs = numpy.asarray(zs).reshape(-1,nocc,nvir)
|
|
68
|
-
|
|
69
|
-
v1ao = vresp(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return v1ov.reshape(v1ov.shape[0], -1)
|
|
61
|
+
dms = lib.einsum('xov,pv,qo->xpq', zs, orbv, orbo.conj())
|
|
62
|
+
v1ao = vresp(dms)
|
|
63
|
+
v1mo = lib.einsum('xpq,qo,pv->xov', v1ao, orbo, orbv.conj())
|
|
64
|
+
v1mo += numpy.einsum('xia,ia->xia', zs, e_ia)
|
|
65
|
+
return v1mo.reshape(v1mo.shape[0], -1)
|
|
74
66
|
|
|
75
67
|
return vind, hdiag
|
|
76
68
|
gen_tda_hop = gen_tda_operation
|
|
@@ -78,8 +70,8 @@ gen_tda_hop = gen_tda_operation
|
|
|
78
70
|
def get_ab(mf, mo_energy=None, mo_coeff=None, mo_occ=None):
|
|
79
71
|
r'''A and B matrices for TDDFT response function.
|
|
80
72
|
|
|
81
|
-
A[i,a,j,b] = \delta_{ab}\delta_{ij}(E_a - E_i) + (
|
|
82
|
-
B[i,a,j,b] = (
|
|
73
|
+
A[i,a,j,b] = \delta_{ab}\delta_{ij}(E_a - E_i) + (ai||jb)
|
|
74
|
+
B[i,a,j,b] = (ai||bj)
|
|
83
75
|
'''
|
|
84
76
|
if mo_energy is None: mo_energy = mf.mo_energy
|
|
85
77
|
if mo_coeff is None: mo_coeff = mf.mo_coeff
|
|
@@ -102,7 +94,7 @@ def get_ab(mf, mo_energy=None, mo_coeff=None, mo_occ=None):
|
|
|
102
94
|
orboL = moL[:,:nocc]
|
|
103
95
|
orboS = moS[:,:nocc]
|
|
104
96
|
|
|
105
|
-
e_ia =
|
|
97
|
+
e_ia = mo_energy[viridx] - mo_energy[occidx,None]
|
|
106
98
|
a = numpy.diag(e_ia.ravel()).reshape(nocc,nvir,nocc,nvir)
|
|
107
99
|
b = numpy.zeros_like(a)
|
|
108
100
|
|
|
@@ -113,13 +105,13 @@ def get_ab(mf, mo_energy=None, mo_coeff=None, mo_occ=None):
|
|
|
113
105
|
eri_mo+= ao2mo.kernel(mol, [moS, moS, orboL, moL], intor='int2e_spsp1_spinor').T
|
|
114
106
|
eri_mo = eri_mo.reshape(nocc,nmo,nmo,nmo)
|
|
115
107
|
|
|
116
|
-
a = a + numpy.einsum('iabj->iajb', eri_mo[:nocc,nocc:,nocc:,:nocc])
|
|
117
|
-
a = a - numpy.einsum('ijba->iajb', eri_mo[:nocc,:nocc,nocc:,nocc:]) * hyb
|
|
118
|
-
b = b + numpy.einsum('iajb->iajb', eri_mo[:nocc,nocc:,:nocc,nocc:])
|
|
119
|
-
b = b - numpy.einsum('jaib->iajb', eri_mo[:nocc,nocc:,:nocc,nocc:]) * hyb
|
|
108
|
+
a = a + numpy.einsum('iabj->iajb', eri_mo[:nocc,nocc:,nocc:,:nocc].conj())
|
|
109
|
+
a = a - numpy.einsum('ijba->iajb', eri_mo[:nocc,:nocc,nocc:,nocc:].conj()) * hyb
|
|
110
|
+
b = b + numpy.einsum('iajb->iajb', eri_mo[:nocc,nocc:,:nocc,nocc:].conj())
|
|
111
|
+
b = b - numpy.einsum('jaib->iajb', eri_mo[:nocc,nocc:,:nocc,nocc:].conj()) * hyb
|
|
120
112
|
return a, b
|
|
121
113
|
|
|
122
|
-
if isinstance(mf,
|
|
114
|
+
if isinstance(mf, scf.hf.KohnShamDFT):
|
|
123
115
|
from pyscf.dft import xc_deriv
|
|
124
116
|
ni = mf._numint
|
|
125
117
|
ni.libxc.test_deriv_order(mf.xc, 2, raise_error=True)
|
|
@@ -127,6 +119,7 @@ def get_ab(mf, mo_energy=None, mo_coeff=None, mo_occ=None):
|
|
|
127
119
|
raise NotImplementedError('DKS-TDDFT for NLC functionals')
|
|
128
120
|
|
|
129
121
|
omega, alpha, hyb = ni.rsh_and_hybrid_coeff(mf.xc, mol.spin)
|
|
122
|
+
assert omega == 0.
|
|
130
123
|
|
|
131
124
|
a, b = add_hf_(a, b, hyb)
|
|
132
125
|
|
|
@@ -184,9 +177,9 @@ def get_ab(mf, mo_energy=None, mo_coeff=None, mo_occ=None):
|
|
|
184
177
|
rhoS_ov = ud2tm(rhoS_ov_aa, rhoS_ov_ab, rhoS_ov_ba, rhoS_ov_bb)
|
|
185
178
|
rho_ov = addLS(rhoL_ov, rhoS_ov)
|
|
186
179
|
rho_vo = rho_ov.conj()
|
|
187
|
-
|
|
188
|
-
a += lib.einsum('sria,srjb->iajb',
|
|
189
|
-
b += lib.einsum('sria,srjb->iajb',
|
|
180
|
+
w_vo = numpy.einsum('tsr,tria->sria', wfxc, rho_vo)
|
|
181
|
+
a += lib.einsum('sria,srjb->iajb', w_vo, rho_ov)
|
|
182
|
+
b += lib.einsum('sria,srjb->iajb', w_vo, rho_vo)
|
|
190
183
|
elif ni.collinear[0] == 'c':
|
|
191
184
|
rho = ni.eval_rho(mol, ao, dm0, mask, xctype, hermi=1, with_lapl=False)
|
|
192
185
|
fxc = ni.eval_xc_eff(mf.xc, rho, deriv=2)[2]
|
|
@@ -200,19 +193,19 @@ def get_ab(mf, mo_energy=None, mo_coeff=None, mo_occ=None):
|
|
|
200
193
|
rhoL_vo_b = rhoL_ov_b.conj()
|
|
201
194
|
rhoS_vo_a = rhoS_ov_a.conj()
|
|
202
195
|
rhoS_vo_b = rhoS_ov_b.conj()
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
a += lib.einsum('ria,rjb->iajb',
|
|
209
|
-
a += lib.einsum('ria,rjb->iajb',
|
|
210
|
-
a += lib.einsum('ria,rjb->iajb',
|
|
211
|
-
a += lib.einsum('ria,rjb->iajb',
|
|
212
|
-
b += lib.einsum('ria,rjb->iajb',
|
|
213
|
-
b += lib.einsum('ria,rjb->iajb',
|
|
214
|
-
b += lib.einsum('ria,rjb->iajb',
|
|
215
|
-
b += lib.einsum('ria,rjb->iajb',
|
|
196
|
+
w_vo = wv_a[:,:,None,None] * rhoL_vo_a
|
|
197
|
+
w_vo += wv_b[:,:,None,None] * rhoL_vo_b
|
|
198
|
+
w_vo += wv_b[:,:,None,None] * rhoS_vo_a # for beta*Sigma
|
|
199
|
+
w_vo += wv_a[:,:,None,None] * rhoS_vo_b
|
|
200
|
+
wa_vo, wb_vo = w_vo
|
|
201
|
+
a += lib.einsum('ria,rjb->iajb', wa_vo, rhoL_ov_a)
|
|
202
|
+
a += lib.einsum('ria,rjb->iajb', wb_vo, rhoL_ov_b)
|
|
203
|
+
a += lib.einsum('ria,rjb->iajb', wb_vo, rhoS_ov_a)
|
|
204
|
+
a += lib.einsum('ria,rjb->iajb', wa_vo, rhoS_ov_b)
|
|
205
|
+
b += lib.einsum('ria,rjb->iajb', wa_vo, rhoL_vo_a)
|
|
206
|
+
b += lib.einsum('ria,rjb->iajb', wb_vo, rhoL_vo_b)
|
|
207
|
+
b += lib.einsum('ria,rjb->iajb', wb_vo, rhoS_vo_a)
|
|
208
|
+
b += lib.einsum('ria,rjb->iajb', wa_vo, rhoS_vo_b)
|
|
216
209
|
else:
|
|
217
210
|
raise NotImplementedError(ni.collinear)
|
|
218
211
|
|
|
@@ -247,9 +240,9 @@ def get_ab(mf, mo_energy=None, mo_coeff=None, mo_occ=None):
|
|
|
247
240
|
rhoS_ov = ud2tm(rhoS_ov_aa, rhoS_ov_ab, rhoS_ov_ba, rhoS_ov_bb)
|
|
248
241
|
rho_ov = addLS(rhoL_ov, rhoS_ov)
|
|
249
242
|
rho_vo = rho_ov.conj()
|
|
250
|
-
|
|
251
|
-
a += lib.einsum('syria,syrjb->iajb',
|
|
252
|
-
b += lib.einsum('syria,syrjb->iajb',
|
|
243
|
+
w_vo = numpy.einsum('txsyr,txria->syria', wfxc, rho_vo)
|
|
244
|
+
a += lib.einsum('syria,syrjb->iajb', w_vo, rho_ov)
|
|
245
|
+
b += lib.einsum('syria,syrjb->iajb', w_vo, rho_vo)
|
|
253
246
|
elif ni.collinear[0] == 'c':
|
|
254
247
|
rho = ni.eval_rho(mol, ao, dm0, mask, xctype, hermi=1, with_lapl=False)
|
|
255
248
|
fxc = ni.eval_xc_eff(mf.xc, rho, deriv=2)[2]
|
|
@@ -269,9 +262,9 @@ def get_ab(mf, mo_energy=None, mo_coeff=None, mo_occ=None):
|
|
|
269
262
|
rhoS_ov[1] *= -1
|
|
270
263
|
rho_ov = rhoL_ov + rhoS_ov
|
|
271
264
|
rho_vo = rho_ov.conj()
|
|
272
|
-
|
|
273
|
-
a += lib.einsum('syria,syrjb->iajb',
|
|
274
|
-
b += lib.einsum('syria,syrjb->iajb',
|
|
265
|
+
w_vo = numpy.einsum('txsyr,txria->syria', wfxc, rho_vo)
|
|
266
|
+
a += lib.einsum('syria,syrjb->iajb', w_vo, rho_ov)
|
|
267
|
+
b += lib.einsum('syria,syrjb->iajb', w_vo, rho_vo)
|
|
275
268
|
else:
|
|
276
269
|
raise NotImplementedError(ni.collinear)
|
|
277
270
|
|
|
@@ -328,9 +321,9 @@ def get_ab(mf, mo_energy=None, mo_coeff=None, mo_occ=None):
|
|
|
328
321
|
rhoS_ov = ud2tm(rhoS_ov_aa, rhoS_ov_ab, rhoS_ov_ba, rhoS_ov_bb)
|
|
329
322
|
rho_ov = addLS(rhoL_ov, rhoS_ov)
|
|
330
323
|
rho_vo = rho_ov.conj()
|
|
331
|
-
|
|
332
|
-
a += lib.einsum('syria,syrjb->iajb',
|
|
333
|
-
b += lib.einsum('syria,syrjb->iajb',
|
|
324
|
+
w_vo = numpy.einsum('txsyr,txria->syria', wfxc, rho_vo)
|
|
325
|
+
a += lib.einsum('syria,syrjb->iajb', w_vo, rho_ov)
|
|
326
|
+
b += lib.einsum('syria,syrjb->iajb', w_vo, rho_vo)
|
|
334
327
|
elif ni.collinear[0] == 'c':
|
|
335
328
|
rho = ni.eval_rho(mol, ao, dm0, mask, xctype, hermi=1, with_lapl=False)
|
|
336
329
|
fxc = ni.eval_xc_eff(mf.xc, rho, deriv=2)[2]
|
|
@@ -358,9 +351,9 @@ def get_ab(mf, mo_energy=None, mo_coeff=None, mo_occ=None):
|
|
|
358
351
|
rhoS_ov[1] *= -1
|
|
359
352
|
rho_ov = rhoL_ov + rhoS_ov
|
|
360
353
|
rho_vo = rho_ov.conj()
|
|
361
|
-
|
|
362
|
-
a += lib.einsum('syria,syrjb->iajb',
|
|
363
|
-
b += lib.einsum('syria,syrjb->iajb',
|
|
354
|
+
w_vo = numpy.einsum('txsyr,txria->syria', wfxc, rho_vo)
|
|
355
|
+
a += lib.einsum('syria,syrjb->iajb', w_vo, rho_ov)
|
|
356
|
+
b += lib.einsum('syria,syrjb->iajb', w_vo, rho_vo)
|
|
364
357
|
else:
|
|
365
358
|
raise NotImplementedError(ni.collinear)
|
|
366
359
|
|
|
@@ -396,6 +389,9 @@ class TDBase(rhf.TDBase):
|
|
|
396
389
|
|
|
397
390
|
@lib.with_doc(rhf.TDA.__doc__)
|
|
398
391
|
class TDA(TDBase):
|
|
392
|
+
|
|
393
|
+
singlet = None
|
|
394
|
+
|
|
399
395
|
def gen_vind(self, mf=None):
|
|
400
396
|
'''Generate function to compute Ax'''
|
|
401
397
|
if mf is None:
|
|
@@ -447,14 +443,10 @@ class TDA(TDBase):
|
|
|
447
443
|
if x0 is None:
|
|
448
444
|
x0 = self.init_guess(self._scf, self.nstates)
|
|
449
445
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
nroots=nstates, lindep=self.lindep,
|
|
455
|
-
max_cycle=self.max_cycle,
|
|
456
|
-
max_space=self.max_space, pick=pickeig,
|
|
457
|
-
verbose=log)
|
|
446
|
+
self.converged, self.e, x1 = lr_eigh(
|
|
447
|
+
vind, x0, precond, tol_residual=self.conv_tol, lindep=self.lindep,
|
|
448
|
+
nroots=nstates, pick=pickeig, max_cycle=self.max_cycle,
|
|
449
|
+
max_memory=self.max_memory, verbose=log)
|
|
458
450
|
|
|
459
451
|
nocc = (self._scf.mo_occ>0).sum()
|
|
460
452
|
nmo = self._scf.mo_occ.size
|
|
@@ -489,9 +481,8 @@ def gen_tdhf_operation(mf, fock_ao=None):
|
|
|
489
481
|
orbv = mo_coeff[:,viridx]
|
|
490
482
|
orbo = mo_coeff[:,occidx]
|
|
491
483
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
hdiag = fvv.diagonal() - foo.diagonal()[:,None]
|
|
484
|
+
assert fock_ao is None
|
|
485
|
+
e_ia = hdiag = mo_energy[viridx] - mo_energy[occidx,None]
|
|
495
486
|
hdiag = numpy.hstack((hdiag.ravel(), -hdiag.ravel())).real
|
|
496
487
|
|
|
497
488
|
mo_coeff = numpy.asarray(numpy.hstack((orbo,orbv)), order='F')
|
|
@@ -500,27 +491,33 @@ def gen_tdhf_operation(mf, fock_ao=None):
|
|
|
500
491
|
def vind(xys):
|
|
501
492
|
xys = numpy.asarray(xys).reshape(-1,2,nocc,nvir)
|
|
502
493
|
xs, ys = xys.transpose(1,0,2,3)
|
|
503
|
-
|
|
504
|
-
dms
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
494
|
+
dms = lib.einsum('xov,pv,qo->xpq', xs, orbv, orbo.conj())
|
|
495
|
+
dms += lib.einsum('xov,qv,po->xpq', ys, orbv.conj(), orbo)
|
|
496
|
+
v1ao = vresp(dms) # = <mj||nb> Xjb + <mb||nj> Yjb
|
|
497
|
+
# A ~= <aj||ib>, B = <ab||ij>
|
|
498
|
+
# AX + BY
|
|
499
|
+
# = <aj||ib> Xjb + <ab||ij> Yjb
|
|
500
|
+
# = (<mj||nb> Xjb + <mb||nj> Yjb) Cma* Cni
|
|
501
|
+
v1_top = lib.einsum('xpq,qo,pv->xov', v1ao, orbo, orbv.conj())
|
|
502
|
+
# (B*)X + (A*)Y
|
|
503
|
+
# = <ij||ab> Xjb + <ib||aj> Yjb
|
|
504
|
+
# = (<mj||nb> Xjb + <mb||nj> Yjb) Cmi* Cna
|
|
505
|
+
v1_bot = lib.einsum('xpq,po,qv->xov', v1ao, orbo.conj(), orbv)
|
|
506
|
+
v1_top += numpy.einsum('xia,ia->xia', xs, e_ia) # AX
|
|
507
|
+
v1_bot += numpy.einsum('xia,ia->xia', ys, e_ia) # (A*)Y
|
|
514
508
|
|
|
515
509
|
# (AX, (-A*)Y)
|
|
516
510
|
nz = xys.shape[0]
|
|
517
|
-
hx = numpy.hstack((
|
|
511
|
+
hx = numpy.hstack((v1_top.reshape(nz,-1), -v1_bot.reshape(nz,-1)))
|
|
518
512
|
return hx
|
|
519
513
|
|
|
520
514
|
return vind, hdiag
|
|
521
515
|
|
|
522
516
|
|
|
523
517
|
class TDHF(TDBase):
|
|
518
|
+
|
|
519
|
+
singlet = None
|
|
520
|
+
|
|
524
521
|
@lib.with_doc(gen_tdhf_operation.__doc__)
|
|
525
522
|
def gen_vind(self, mf=None):
|
|
526
523
|
if mf is None:
|
|
@@ -530,7 +527,9 @@ class TDHF(TDBase):
|
|
|
530
527
|
def init_guess(self, mf, nstates=None, wfnsym=None):
|
|
531
528
|
x0 = TDA.init_guess(self, mf, nstates, wfnsym)
|
|
532
529
|
y0 = numpy.zeros_like(x0)
|
|
533
|
-
return numpy.
|
|
530
|
+
return numpy.hstack([x0, y0])
|
|
531
|
+
|
|
532
|
+
get_precond = rhf.TDHF.get_precond
|
|
534
533
|
|
|
535
534
|
def kernel(self, x0=None, nstates=None):
|
|
536
535
|
'''TDHF diagonalization with non-Hermitian eigenvalue solver
|
|
@@ -558,13 +557,10 @@ class TDHF(TDBase):
|
|
|
558
557
|
if x0 is None:
|
|
559
558
|
x0 = self.init_guess(self._scf, self.nstates)
|
|
560
559
|
|
|
561
|
-
self.converged, w, x1 =
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
max_cycle=self.max_cycle,
|
|
566
|
-
max_space=self.max_space, pick=pickeig,
|
|
567
|
-
verbose=log)
|
|
560
|
+
self.converged, w, x1 = lr_eig(
|
|
561
|
+
vind, x0, precond, tol_residual=self.conv_tol, lindep=self.lindep,
|
|
562
|
+
nroots=nstates, pick=pickeig, max_cycle=self.max_cycle,
|
|
563
|
+
max_memory=self.max_memory, verbose=log)
|
|
568
564
|
|
|
569
565
|
nocc = (self._scf.mo_occ>0).sum()
|
|
570
566
|
nmo = self._scf.mo_occ.size
|
|
@@ -574,7 +570,9 @@ class TDHF(TDBase):
|
|
|
574
570
|
def norm_xy(z):
|
|
575
571
|
x, y = z.reshape(2,nocc,nvir)
|
|
576
572
|
norm = lib.norm(x)**2 - lib.norm(y)**2
|
|
577
|
-
norm
|
|
573
|
+
if norm < 0:
|
|
574
|
+
log.warn('TDDFT amplitudes |X| smaller than |Y|')
|
|
575
|
+
norm = abs(norm)**-.5
|
|
578
576
|
return x*norm, y*norm
|
|
579
577
|
self.xy = [norm_xy(z) for z in x1]
|
|
580
578
|
|
|
@@ -586,7 +584,6 @@ class TDHF(TDBase):
|
|
|
586
584
|
self._finalize()
|
|
587
585
|
return self.e, self.xy
|
|
588
586
|
|
|
589
|
-
from pyscf import scf
|
|
590
587
|
scf.dhf.DHF.TDA = scf.dhf.RDHF.TDA = lib.class_as_method(TDA)
|
|
591
588
|
scf.dhf.DHF.TDHF = scf.dhf.RDHF.TDHF = lib.class_as_method(TDHF)
|
|
592
589
|
|