pyscf 2.4.0__py3-none-macosx_11_0_arm64.whl → 2.6.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 +1 -1
- pyscf/adc/__init__.py +9 -12
- pyscf/adc/radc.py +2 -2
- pyscf/adc/radc_ea.py +2 -2
- pyscf/adc/radc_ip.py +2 -2
- pyscf/adc/radc_ip_cvs.py +2 -2
- pyscf/adc/uadc.py +2 -2
- pyscf/adc/uadc_ea.py +2 -2
- pyscf/adc/uadc_ip.py +2 -2
- pyscf/adc/uadc_ip_cvs.py +2 -2
- pyscf/agf2/__init__.py +1 -1
- pyscf/agf2/chempot.py +2 -2
- pyscf/agf2/dfragf2.py +4 -4
- pyscf/agf2/dfuagf2.py +4 -4
- pyscf/agf2/ragf2.py +5 -5
- pyscf/agf2/ragf2_slow.py +2 -2
- pyscf/agf2/uagf2.py +3 -3
- pyscf/agf2/uagf2_slow.py +2 -2
- pyscf/ao2mo/outcore.py +6 -6
- pyscf/cc/__init__.py +28 -35
- pyscf/cc/addons.py +2 -4
- pyscf/cc/ccsd.py +13 -2
- pyscf/cc/ccsd_t.py +1 -1
- pyscf/cc/ccsd_t_slow.py +1 -1
- pyscf/cc/dfccsd.py +4 -1
- pyscf/cc/eom_rccsd.py +2 -2
- pyscf/cc/gccsd.py +5 -1
- pyscf/cc/gccsd_t.py +2 -2
- pyscf/cc/gccsd_t_rdm.py +1 -1
- pyscf/cc/momgfccsd.py +2 -2
- pyscf/cc/qcisd_t_slow.py +1 -1
- pyscf/cc/rccsd.py +2 -0
- pyscf/cc/rccsd_slow.py +1 -1
- pyscf/cc/uccsd.py +5 -1
- pyscf/cc/uccsd_slow.py +1 -1
- pyscf/ci/__init__.py +31 -25
- pyscf/ci/addons.py +1 -2
- pyscf/ci/cisd.py +4 -2
- pyscf/data/elements.py +2 -2
- pyscf/df/addons.py +9 -9
- pyscf/df/df.py +9 -2
- pyscf/df/df_jk.py +14 -10
- pyscf/df/grad/casdm2_util.py +1 -1
- pyscf/df/grad/casscf.py +2 -0
- pyscf/df/grad/rhf.py +12 -8
- pyscf/df/grad/rks.py +6 -5
- pyscf/df/grad/sacasscf.py +2 -0
- pyscf/df/grad/uhf.py +4 -3
- pyscf/df/grad/uks.py +5 -5
- pyscf/df/hessian/rhf.py +9 -2
- pyscf/df/hessian/rks.py +2 -2
- pyscf/df/hessian/uhf.py +3 -3
- pyscf/df/hessian/uks.py +2 -2
- pyscf/df/incore.py +6 -5
- pyscf/df/outcore.py +16 -2
- pyscf/dft/LebedevGrid.py +5047 -0
- pyscf/dft/__init__.py +1 -0
- pyscf/dft/dft_parser.py +24 -0
- pyscf/dft/dks.py +10 -1
- pyscf/dft/gen_grid.py +9 -46
- pyscf/dft/gks.py +3 -1
- pyscf/dft/gks_symm.py +3 -0
- pyscf/dft/libxc.py +265 -147
- pyscf/dft/numint.py +24 -34
- pyscf/dft/numint2c.py +17 -30
- pyscf/dft/rks.py +47 -13
- pyscf/dft/rks_symm.py +6 -1
- pyscf/dft/roks.py +2 -0
- pyscf/dft/uks.py +4 -2
- pyscf/dft/uks_symm.py +3 -0
- pyscf/dft/xc_deriv.py +187 -82
- pyscf/dft/xcfun.py +117 -86
- pyscf/eph/rhf.py +1 -1
- pyscf/eph/rks.py +1 -1
- pyscf/eph/uhf.py +2 -2
- pyscf/eph/uks.py +2 -2
- pyscf/fci/addons.py +18 -15
- pyscf/fci/cistring.py +43 -10
- pyscf/fci/direct_nosym.py +45 -56
- pyscf/fci/direct_spin0.py +4 -2
- pyscf/fci/direct_spin1.py +11 -7
- pyscf/fci/direct_spin1_cyl_sym.py +7 -3
- pyscf/fci/direct_spin1_symm.py +12 -0
- pyscf/fci/selected_ci.py +2 -2
- pyscf/geomopt/geometric_solver.py +1 -1
- pyscf/grad/__init__.py +1 -0
- pyscf/grad/casci.py +5 -3
- pyscf/grad/casscf.py +2 -0
- pyscf/grad/ccsd.py +2 -0
- pyscf/grad/cisd.py +2 -0
- pyscf/grad/dhf.py +3 -1
- pyscf/grad/dispersion.py +66 -0
- pyscf/grad/mp2.py +9 -3
- pyscf/grad/rhf.py +11 -0
- pyscf/grad/rks.py +4 -8
- pyscf/grad/tdrhf.py +3 -1
- pyscf/grad/uks.py +3 -4
- pyscf/gto/basis/__init__.py +8 -2
- pyscf/gto/basis/parse_cp2k.py +13 -8
- pyscf/gto/basis/parse_cp2k_pp.py +18 -5
- pyscf/gto/ecp.py +5 -5
- pyscf/gto/mole.py +83 -79
- pyscf/gto/moleintor.py +1 -0
- pyscf/gw/gw_ac.py +2 -2
- pyscf/gw/gw_cd.py +2 -2
- pyscf/gw/gw_exact.py +2 -2
- pyscf/gw/gw_slow.py +1 -1
- pyscf/gw/rpa.py +237 -96
- pyscf/gw/ugw_ac.py +2 -2
- pyscf/gw/urpa.py +135 -127
- pyscf/hessian/__init__.py +1 -0
- pyscf/hessian/dispersion.py +104 -0
- pyscf/hessian/rhf.py +44 -15
- pyscf/hessian/rks.py +37 -7
- pyscf/hessian/uhf.py +13 -8
- pyscf/hessian/uks.py +7 -5
- pyscf/lib/CMakeLists.txt +59 -10
- pyscf/lib/ao2mo/nr_ao2mo.c +6 -1
- pyscf/lib/ao2mo/nrr_ao2mo.c +6 -1
- pyscf/lib/ao2mo/r_ao2mo.c +6 -1
- pyscf/lib/cc/ccsd_t.c +37 -6
- pyscf/lib/cc/uccsd_t.c +25 -4
- pyscf/lib/chkfile.py +1 -2
- pyscf/lib/config.h +1 -1
- pyscf/lib/config.h.in +1 -1
- pyscf/lib/deps/include/cint.h +1 -1
- pyscf/lib/deps/include/cint_funcs.h +47 -16
- pyscf/lib/deps/lib/libcint.6.dylib +0 -0
- pyscf/lib/deps/lib/libxcfun.2.dylib +0 -0
- pyscf/lib/dft/CMakeLists.txt +10 -6
- pyscf/lib/dft/grid_collocate.c +655 -0
- pyscf/lib/dft/grid_common.c +660 -0
- pyscf/lib/dft/grid_common.h +109 -0
- pyscf/lib/dft/grid_integrate.c +1358 -0
- pyscf/lib/dft/libxc_itrf.c +587 -357
- pyscf/lib/dft/multigrid.c +744 -0
- pyscf/lib/dft/multigrid.h +72 -0
- pyscf/lib/dft/utils.c +71 -0
- pyscf/lib/dft/utils.h +27 -0
- pyscf/lib/dft/xc_deriv.c +85 -89
- pyscf/lib/dft/xcfun_itrf.c +24 -17
- pyscf/lib/diis.py +2 -0
- pyscf/lib/gto/fill_r_4c.c +5 -0
- 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/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 +2 -2
- pyscf/lib/mcscf/fci_contract.c +25 -19
- pyscf/lib/mcscf/fci_contract_nosym.c +11 -5
- pyscf/lib/mcscf/fci_string.c +29 -29
- pyscf/lib/misc.py +121 -19
- pyscf/lib/np_helper/np_helper.h +7 -0
- pyscf/lib/numpy_helper.py +11 -4
- pyscf/lib/pbc/CMakeLists.txt +11 -1
- pyscf/lib/pbc/cell.c +280 -0
- pyscf/lib/pbc/cell.h +29 -0
- pyscf/lib/pbc/fft.c +147 -0
- pyscf/lib/pbc/fft.h +26 -0
- pyscf/lib/pbc/fill_ints.c +3 -3
- pyscf/lib/pbc/fill_ints.h +29 -0
- pyscf/lib/pbc/fill_ints_screened.c +1012 -0
- pyscf/lib/pbc/hf_grad.c +95 -0
- pyscf/lib/pbc/neighbor_list.c +206 -0
- pyscf/lib/pbc/neighbor_list.h +41 -0
- pyscf/lib/pbc/optimizer.c +37 -1
- pyscf/lib/pbc/optimizer.h +3 -3
- pyscf/lib/pbc/pp.c +448 -0
- pyscf/lib/solvent/CMakeLists.txt +38 -0
- pyscf/lib/vhf/nr_sgx_direct.c +5 -0
- pyscf/lib/vhf/optimizer.c +10 -0
- pyscf/lo/boys.py +4 -1
- pyscf/lo/pipek.py +77 -71
- pyscf/lo/pipek_jacobi.py +161 -0
- pyscf/mcscf/__init__.py +31 -31
- pyscf/mcscf/addons.py +20 -12
- pyscf/mcscf/casci.py +5 -3
- pyscf/mcscf/casci_symm.py +3 -1
- pyscf/mcscf/df.py +2 -2
- pyscf/mcscf/mc1step.py +14 -8
- pyscf/mcscf/newton_casscf_symm.py +1 -1
- pyscf/mcscf/ucasci.py +1 -1
- pyscf/mcscf/umc1step.py +3 -3
- pyscf/mp/__init__.py +10 -12
- pyscf/mp/dfgmp2.py +3 -2
- pyscf/mp/dfmp2.py +3 -3
- pyscf/mp/dfmp2_native.py +4 -2
- pyscf/mp/dfump2_native.py +4 -3
- pyscf/mp/gmp2.py +6 -3
- pyscf/mp/mp2.py +48 -14
- pyscf/mp/ump2.py +56 -23
- pyscf/mrpt/nevpt2.py +2 -2
- pyscf/nac/__init__.py +32 -0
- pyscf/nac/sacasscf.py +293 -0
- pyscf/pbc/__all__.py +3 -0
- pyscf/pbc/adc/__init__.py +1 -1
- pyscf/pbc/adc/kadc_rhf.py +2 -2
- pyscf/pbc/adc/kadc_rhf_ea.py +2 -2
- pyscf/pbc/adc/kadc_rhf_ip.py +2 -2
- pyscf/pbc/cc/__init__.py +10 -7
- pyscf/pbc/cc/kccsd.py +3 -1
- pyscf/pbc/cc/kccsd_rhf.py +4 -2
- pyscf/pbc/cc/kccsd_rhf_ksymm.py +1 -1
- pyscf/pbc/cc/kccsd_uhf.py +3 -1
- pyscf/pbc/cc/kintermediates.py +1 -1
- pyscf/pbc/ci/__init__.py +4 -4
- pyscf/pbc/df/aft.py +5 -4
- pyscf/pbc/df/aft_jk.py +1 -1
- pyscf/pbc/df/df.py +7 -2
- pyscf/pbc/df/df_jk.py +12 -11
- pyscf/pbc/df/fft.py +7 -2
- pyscf/pbc/df/ft_ao.py +17 -9
- pyscf/pbc/df/gdf_builder.py +8 -7
- pyscf/pbc/df/incore.py +246 -2
- pyscf/pbc/df/mdf.py +3 -0
- pyscf/pbc/df/mdf_jk.py +0 -3
- pyscf/pbc/df/rsdf_builder.py +20 -11
- pyscf/pbc/df/rsdf_helper.py +16 -13
- pyscf/pbc/dft/gen_grid.py +14 -9
- pyscf/pbc/dft/gks.py +4 -2
- pyscf/pbc/dft/kgks.py +13 -4
- pyscf/pbc/dft/krks.py +15 -25
- pyscf/pbc/dft/krks_ksymm.py +16 -15
- pyscf/pbc/dft/krkspu.py +3 -3
- pyscf/pbc/dft/krkspu_ksymm.py +2 -2
- pyscf/pbc/dft/kroks.py +9 -19
- pyscf/pbc/dft/kuks.py +14 -24
- pyscf/pbc/dft/kuks_ksymm.py +16 -15
- pyscf/pbc/dft/kukspu.py +3 -3
- pyscf/pbc/dft/kukspu_ksymm.py +2 -2
- pyscf/pbc/dft/multigrid/__init__.py +57 -0
- pyscf/pbc/dft/{multigrid.py → multigrid/multigrid.py} +87 -94
- pyscf/pbc/dft/multigrid/multigrid_pair.py +1405 -0
- pyscf/pbc/dft/multigrid/pp.py +290 -0
- pyscf/pbc/dft/multigrid/utils.py +70 -0
- pyscf/pbc/dft/numint.py +5 -0
- pyscf/pbc/dft/rks.py +12 -8
- pyscf/pbc/dft/roks.py +2 -0
- pyscf/pbc/dft/uks.py +6 -4
- pyscf/pbc/geomopt/geometric_solver.py +1 -1
- pyscf/pbc/grad/__init__.py +5 -2
- pyscf/pbc/grad/krhf.py +7 -1
- pyscf/pbc/grad/krks.py +1 -1
- pyscf/pbc/grad/kuks.py +1 -1
- pyscf/pbc/grad/rhf.py +167 -0
- pyscf/pbc/grad/rks.py +24 -0
- pyscf/pbc/grad/uhf.py +92 -0
- pyscf/pbc/grad/uks.py +24 -0
- pyscf/pbc/gto/__init__.py +1 -0
- pyscf/pbc/gto/_pbcintor.py +14 -7
- pyscf/pbc/gto/cell.py +228 -23
- pyscf/pbc/gto/ewald_methods.py +293 -0
- pyscf/pbc/gto/neighborlist.py +199 -0
- pyscf/pbc/gto/pseudo/pp_int.py +350 -17
- pyscf/pbc/gw/__init__.py +44 -1
- pyscf/pbc/gw/kgw_slow_supercell.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 +7 -4
- pyscf/pbc/lib/kpts_helper.py +1 -1
- pyscf/pbc/mp/__init__.py +3 -3
- pyscf/pbc/mp/kmp2.py +3 -1
- pyscf/pbc/mpicc/__init__.py +4 -2
- pyscf/pbc/scf/addons.py +22 -18
- pyscf/pbc/scf/ghf.py +3 -1
- pyscf/pbc/scf/hf.py +34 -20
- pyscf/pbc/scf/kghf.py +3 -1
- pyscf/pbc/scf/khf.py +15 -15
- pyscf/pbc/scf/khf_ksymm.py +8 -6
- pyscf/pbc/scf/krohf.py +6 -4
- pyscf/pbc/scf/kuhf.py +14 -10
- pyscf/pbc/scf/kuhf_ksymm.py +4 -2
- pyscf/pbc/scf/rohf.py +2 -1
- pyscf/pbc/scf/rsjk.py +14 -4
- pyscf/pbc/scf/uhf.py +9 -5
- pyscf/pbc/symm/geom.py +1 -1
- pyscf/pbc/symm/pyscf_spglib.py +1 -1
- pyscf/pbc/symm/symmetry.py +1 -1
- pyscf/pbc/tdscf/__init__.py +6 -9
- pyscf/pbc/tdscf/krhf.py +1 -1
- pyscf/pbc/tdscf/krhf_slow_supercell.py +3 -3
- pyscf/pbc/tdscf/rhf.py +1 -1
- pyscf/pbc/tools/k2gamma.py +27 -15
- pyscf/pbc/tools/pbc.py +55 -10
- pyscf/pbc/x2c/sfx2c1e.py +1 -1
- pyscf/pbc/x2c/x2c1e.py +1 -1
- pyscf/post_scf.py +3 -0
- pyscf/qmmm/itrf.py +13 -1
- pyscf/scf/__init__.py +3 -1
- pyscf/scf/_response_functions.py +5 -4
- pyscf/scf/addons.py +50 -51
- pyscf/scf/atom_hf.py +16 -3
- pyscf/scf/atom_hf_pp.py +154 -0
- pyscf/scf/atom_ks.py +1 -1
- pyscf/scf/cphf.py +39 -17
- pyscf/scf/dhf.py +6 -8
- pyscf/scf/diis.py +12 -11
- pyscf/scf/dispersion.py +177 -0
- pyscf/scf/ghf.py +8 -8
- pyscf/scf/ghf_symm.py +3 -1
- pyscf/scf/hf.py +150 -54
- pyscf/scf/hf_symm.py +9 -4
- pyscf/scf/rohf.py +30 -7
- pyscf/scf/ucphf.py +46 -30
- pyscf/scf/uhf.py +17 -19
- pyscf/scf/uhf_symm.py +7 -5
- pyscf/sgx/sgx.py +9 -4
- pyscf/solvent/__init__.py +26 -2
- pyscf/solvent/_attach_solvent.py +58 -11
- pyscf/solvent/_ddcosmo_tdscf_grad.py +2 -2
- pyscf/solvent/ddcosmo.py +7 -6
- pyscf/solvent/ddpcm.py +1 -0
- pyscf/solvent/grad/__init__.py +17 -0
- pyscf/solvent/{ddcosmo_grad.py → grad/ddcosmo_grad.py} +1 -1
- pyscf/solvent/grad/pcm.py +384 -0
- pyscf/solvent/grad/smd.py +176 -0
- pyscf/solvent/grad/smd_experiment.py +216 -0
- pyscf/solvent/hessian/__init__.py +0 -0
- pyscf/solvent/hessian/pcm.py +230 -0
- pyscf/solvent/hessian/smd.py +171 -0
- pyscf/solvent/hessian/smd_experiment.py +208 -0
- pyscf/solvent/pcm.py +138 -57
- pyscf/solvent/pol_embed.py +3 -3
- pyscf/solvent/smd.py +433 -0
- pyscf/solvent/smd_experiment.py +273 -0
- pyscf/soscf/newton_ah.py +21 -10
- pyscf/symm/basis.py +1 -1
- pyscf/symm/geom.py +3 -7
- pyscf/tdscf/common_slow.py +4 -7
- pyscf/tdscf/dhf.py +1 -1
- pyscf/tdscf/ghf.py +1 -1
- pyscf/tdscf/proxy.py +1 -1
- pyscf/tdscf/rhf.py +10 -3
- pyscf/tdscf/rhf_slow.py +1 -1
- pyscf/tdscf/uhf.py +5 -1
- pyscf/tools/chgcar.py +1 -5
- pyscf/tools/molden.py +15 -2
- pyscf/x2c/sfx2c1e.py +8 -3
- pyscf/x2c/tdscf.py +1 -1
- pyscf/x2c/x2c.py +10 -2
- pyscf-2.6.0.dist-info/METADATA +140 -0
- {pyscf-2.4.0.dist-info → pyscf-2.6.0.dist-info}/NOTICE +8 -1
- {pyscf-2.4.0.dist-info → pyscf-2.6.0.dist-info}/RECORD +355 -307
- {pyscf-2.4.0.dist-info → pyscf-2.6.0.dist-info}/WHEEL +1 -1
- pyscf-2.4.0.dist-info/METADATA +0 -81
- {pyscf-2.4.0.dist-info → pyscf-2.6.0.dist-info}/LICENSE +0 -0
- {pyscf-2.4.0.dist-info → pyscf-2.6.0.dist-info}/top_level.txt +0 -0
pyscf/cc/ccsd.py
CHANGED
|
@@ -923,7 +923,7 @@ class CCSDBase(lib.StreamObject):
|
|
|
923
923
|
cc2 = getattr(__config__, 'cc_ccsd_CCSD_cc2', False)
|
|
924
924
|
callback = None
|
|
925
925
|
|
|
926
|
-
_keys =
|
|
926
|
+
_keys = {
|
|
927
927
|
'max_cycle', 'conv_tol', 'iterative_damping',
|
|
928
928
|
'conv_tol_normt', 'diis', 'diis_space', 'diis_file',
|
|
929
929
|
'diis_start_cycle', 'diis_start_energy_diff', 'direct',
|
|
@@ -931,7 +931,7 @@ class CCSDBase(lib.StreamObject):
|
|
|
931
931
|
'mol', 'verbose', 'stdout', 'frozen', 'level_shift',
|
|
932
932
|
'mo_coeff', 'mo_occ', 'converged', 'converged_lambda', 'emp2', 'e_hf',
|
|
933
933
|
'e_corr', 't1', 't2', 'l1', 'l2', 'chkfile',
|
|
934
|
-
|
|
934
|
+
}
|
|
935
935
|
|
|
936
936
|
def __init__(self, mf, frozen=None, mo_coeff=None, mo_occ=None):
|
|
937
937
|
from pyscf.scf import hf
|
|
@@ -1240,6 +1240,15 @@ class CCSDBase(lib.StreamObject):
|
|
|
1240
1240
|
def nuc_grad_method(self):
|
|
1241
1241
|
raise NotImplementedError
|
|
1242
1242
|
|
|
1243
|
+
# to_gpu can be reused only when __init__ still takes mf
|
|
1244
|
+
def to_gpu(self):
|
|
1245
|
+
mf = self.base.to_gpu()
|
|
1246
|
+
from importlib import import_module
|
|
1247
|
+
mod = import_module(self.__module__.replace('pyscf', 'gpu4pyscf'))
|
|
1248
|
+
cls = getattr(mod, self.__class__.__name__)
|
|
1249
|
+
obj = cls(mf)
|
|
1250
|
+
return obj
|
|
1251
|
+
|
|
1243
1252
|
class CCSD(CCSDBase):
|
|
1244
1253
|
__doc__ = CCSDBase.__doc__
|
|
1245
1254
|
|
|
@@ -1496,6 +1505,8 @@ def _make_eris_incore(mycc, mo_coeff=None):
|
|
|
1496
1505
|
return eris
|
|
1497
1506
|
|
|
1498
1507
|
def _make_eris_outcore(mycc, mo_coeff=None):
|
|
1508
|
+
from pyscf.scf.hf import RHF
|
|
1509
|
+
assert isinstance(mycc._scf, RHF)
|
|
1499
1510
|
cput0 = (logger.process_clock(), logger.perf_counter())
|
|
1500
1511
|
log = logger.Logger(mycc.stdout, mycc.verbose)
|
|
1501
1512
|
eris = _ChemistsERIs()
|
pyscf/cc/ccsd_t.py
CHANGED
|
@@ -176,7 +176,7 @@ def _sort_eri(mycc, eris, nocc, nvir, vvop, log):
|
|
|
176
176
|
|
|
177
177
|
def _sort_t2_vooo_(mycc, orbsym, t1, t2, eris):
|
|
178
178
|
assert (t2.flags.c_contiguous)
|
|
179
|
-
vooo = numpy.asarray(eris.ovoo).transpose(1,0,3
|
|
179
|
+
vooo = numpy.asarray(eris.ovoo).transpose(1,0,2,3).conj().copy()
|
|
180
180
|
nocc, nvir = t1.shape
|
|
181
181
|
if mycc.mol.symmetry:
|
|
182
182
|
orbsym = numpy.asarray(orbsym, dtype=numpy.int32)
|
pyscf/cc/ccsd_t_slow.py
CHANGED
|
@@ -45,7 +45,7 @@ def kernel(mycc, eris, t1=None, t2=None, verbose=logger.NOTE):
|
|
|
45
45
|
eijk = lib.direct_sum('i,j,k->ijk', e_occ, e_occ, e_occ)
|
|
46
46
|
|
|
47
47
|
eris_vvov = eris.get_ovvv().conj().transpose(1,3,0,2)
|
|
48
|
-
eris_vooo = numpy.asarray(eris.ovoo).conj().transpose(1,0,3
|
|
48
|
+
eris_vooo = numpy.asarray(eris.ovoo).conj().transpose(1,0,2,3)
|
|
49
49
|
eris_vvoo = numpy.asarray(eris.ovov).conj().transpose(1,3,0,2)
|
|
50
50
|
fvo = eris.fock[nocc:,:nocc]
|
|
51
51
|
def get_w(a, b, c):
|
pyscf/cc/dfccsd.py
CHANGED
|
@@ -27,7 +27,7 @@ from pyscf import __config__
|
|
|
27
27
|
MEMORYMIN = getattr(__config__, 'cc_ccsd_memorymin', 2000)
|
|
28
28
|
|
|
29
29
|
class RCCSD(ccsd.CCSD):
|
|
30
|
-
_keys =
|
|
30
|
+
_keys = {'with_df'}
|
|
31
31
|
|
|
32
32
|
def __init__(self, mf, frozen=None, mo_coeff=None, mo_occ=None):
|
|
33
33
|
ccsd.CCSD.__init__(self, mf, frozen, mo_coeff, mo_occ)
|
|
@@ -48,6 +48,8 @@ class RCCSD(ccsd.CCSD):
|
|
|
48
48
|
assert (not self.direct)
|
|
49
49
|
return ccsd.CCSD._add_vvvv(self, t1, t2, eris, out, with_ovvv, t2sym)
|
|
50
50
|
|
|
51
|
+
to_gpu = lib.to_gpu
|
|
52
|
+
|
|
51
53
|
|
|
52
54
|
def _contract_vvvv_t2(mycc, mol, vvL, t2, out=None, verbose=None):
|
|
53
55
|
'''Ht2 = numpy.einsum('ijcd,acdb->ijab', t2, vvvv)
|
|
@@ -121,6 +123,7 @@ class _ChemistsERIs(ccsd._ChemistsERIs):
|
|
|
121
123
|
return _contract_vvvv_t2(mycc, self.mol, self.vvL, t2, out, verbose)
|
|
122
124
|
|
|
123
125
|
def _make_df_eris(cc, mo_coeff=None):
|
|
126
|
+
assert cc._scf.istype('RHF')
|
|
124
127
|
eris = _ChemistsERIs()
|
|
125
128
|
eris._common_init_(cc, mo_coeff)
|
|
126
129
|
nocc = eris.nocc
|
pyscf/cc/eom_rccsd.py
CHANGED
|
@@ -96,10 +96,10 @@ def kernel(eom, nroots=1, koopmans=False, guess=None, left=False,
|
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
class EOM(lib.StreamObject):
|
|
99
|
-
_keys =
|
|
99
|
+
_keys = {
|
|
100
100
|
'mol', 'max_space', 'max_cycle', 'conv_tol', 'partition',
|
|
101
101
|
'e', 'v', 'nocc', 'nmo',
|
|
102
|
-
|
|
102
|
+
}
|
|
103
103
|
|
|
104
104
|
def __init__(self, cc):
|
|
105
105
|
self.mol = cc.mol
|
pyscf/cc/gccsd.py
CHANGED
|
@@ -117,7 +117,6 @@ class GCCSD(ccsd.CCSDBase):
|
|
|
117
117
|
conv_tol_normt = getattr(__config__, 'cc_gccsd_GCCSD_conv_tol_normt', 1e-6)
|
|
118
118
|
|
|
119
119
|
def __init__(self, mf, frozen=None, mo_coeff=None, mo_occ=None):
|
|
120
|
-
assert (isinstance(mf, scf.ghf.GHF))
|
|
121
120
|
ccsd.CCSDBase.__init__(self, mf, frozen, mo_coeff, mo_occ)
|
|
122
121
|
|
|
123
122
|
def init_amps(self, eris=None):
|
|
@@ -290,6 +289,8 @@ class GCCSD(ccsd.CCSDBase):
|
|
|
290
289
|
orbspin = orbspin[self.get_frozen_mask()]
|
|
291
290
|
return spin2spatial(tx, orbspin)
|
|
292
291
|
|
|
292
|
+
to_gpu = lib.to_gpu
|
|
293
|
+
|
|
293
294
|
CCSD = GCCSD
|
|
294
295
|
|
|
295
296
|
|
|
@@ -363,6 +364,7 @@ def _make_eris_incore(mycc, mo_coeff=None, ao2mofn=None):
|
|
|
363
364
|
mo = mo_a + mo_b
|
|
364
365
|
eri = ao2mo.kernel(mycc._scf._eri, mo)
|
|
365
366
|
if eri.size == nmo**4: # if mycc._scf._eri is a complex array
|
|
367
|
+
eri = eri.reshape(nmo**2, nmo**2)
|
|
366
368
|
sym_forbid = (orbspin[:,None] != orbspin).ravel()
|
|
367
369
|
else: # 4-fold symmetry
|
|
368
370
|
sym_forbid = (orbspin[:,None] != orbspin)[np.tril_indices(nmo)]
|
|
@@ -385,6 +387,8 @@ def _make_eris_incore(mycc, mo_coeff=None, ao2mofn=None):
|
|
|
385
387
|
return eris
|
|
386
388
|
|
|
387
389
|
def _make_eris_outcore(mycc, mo_coeff=None):
|
|
390
|
+
from pyscf.scf.ghf import GHF
|
|
391
|
+
assert isinstance(mycc._scf, GHF)
|
|
388
392
|
cput0 = (logger.process_clock(), logger.perf_counter())
|
|
389
393
|
log = logger.Logger(mycc.stdout, mycc.verbose)
|
|
390
394
|
|
pyscf/cc/gccsd_t.py
CHANGED
|
@@ -85,13 +85,13 @@ if __name__ == '__main__':
|
|
|
85
85
|
mycc = cc.CCSD(mf).set(conv_tol=1e-11).run()
|
|
86
86
|
et = mycc.ccsd_t()
|
|
87
87
|
|
|
88
|
-
mycc = cc.GCCSD(
|
|
88
|
+
mycc = cc.GCCSD(mf.to_ghf()).set(conv_tol=1e-11).run()
|
|
89
89
|
eris = mycc.ao2mo()
|
|
90
90
|
print(kernel(mycc, eris) - et)
|
|
91
91
|
|
|
92
92
|
numpy.random.seed(1)
|
|
93
93
|
mf.mo_coeff = numpy.random.random(mf.mo_coeff.shape) - .9
|
|
94
|
-
mycc = cc.GCCSD(
|
|
94
|
+
mycc = cc.GCCSD(mf.to_ghf())
|
|
95
95
|
eris = mycc.ao2mo()
|
|
96
96
|
nocc = 10
|
|
97
97
|
nvir = mol.nao_nr() * 2 - nocc
|
pyscf/cc/gccsd_t_rdm.py
CHANGED
|
@@ -120,7 +120,7 @@ if __name__ == '__main__':
|
|
|
120
120
|
mol.basis = '631g'
|
|
121
121
|
mol.build()
|
|
122
122
|
mf0 = mf = scf.RHF(mol).run(conv_tol=1.)
|
|
123
|
-
mf =
|
|
123
|
+
mf = mf.to_ghf()
|
|
124
124
|
|
|
125
125
|
from pyscf.cc import ccsd_t_lambda_slow as ccsd_t_lambda
|
|
126
126
|
from pyscf.cc import ccsd_t_rdm_slow as ccsd_t_rdm
|
pyscf/cc/momgfccsd.py
CHANGED
|
@@ -607,10 +607,10 @@ class MomGFCCSD(lib.StreamObject):
|
|
|
607
607
|
particle Green's function
|
|
608
608
|
"""
|
|
609
609
|
|
|
610
|
-
_keys =
|
|
610
|
+
_keys = {
|
|
611
611
|
'verbose', 'stdout', 'niter', 'weight_tol',
|
|
612
612
|
'hermi_moments', 'hermi_solver', 'eh', 'ep', 'vh', 'vp', 'chkfile',
|
|
613
|
-
|
|
613
|
+
}
|
|
614
614
|
|
|
615
615
|
def __init__(self, mycc, niter=(2, 2)):
|
|
616
616
|
self._cc = mycc
|
pyscf/cc/qcisd_t_slow.py
CHANGED
|
@@ -47,7 +47,7 @@ def kernel(mycc, eris, t1=None, t2=None, verbose=logger.NOTE):
|
|
|
47
47
|
eijk = lib.direct_sum('i,j,k->ijk', e_occ, e_occ, e_occ)
|
|
48
48
|
|
|
49
49
|
eris_vvov = eris.get_ovvv().conj().transpose(1,3,0,2)
|
|
50
|
-
eris_vooo = numpy.asarray(eris.ovoo).conj().transpose(1,0,3
|
|
50
|
+
eris_vooo = numpy.asarray(eris.ovoo).conj().transpose(1,0,2,3)
|
|
51
51
|
eris_vvoo = numpy.asarray(eris.ovov).conj().transpose(1,3,0,2)
|
|
52
52
|
fvo = eris.fock[nocc:,:nocc]
|
|
53
53
|
def get_w(a, b, c):
|
pyscf/cc/rccsd.py
CHANGED
|
@@ -259,6 +259,8 @@ def _make_eris_incore(mycc, mo_coeff=None, ao2mofn=None):
|
|
|
259
259
|
return eris
|
|
260
260
|
|
|
261
261
|
def _make_eris_outcore(mycc, mo_coeff=None):
|
|
262
|
+
from pyscf.scf.hf import RHF
|
|
263
|
+
assert isinstance(mycc._scf, RHF)
|
|
262
264
|
cput0 = (logger.process_clock(), logger.perf_counter())
|
|
263
265
|
log = logger.Logger(mycc.stdout, mycc.verbose)
|
|
264
266
|
eris = _ChemistsERIs()
|
pyscf/cc/rccsd_slow.py
CHANGED
|
@@ -148,7 +148,7 @@ def energy(cc, t1, t2, eris):
|
|
|
148
148
|
|
|
149
149
|
|
|
150
150
|
class RCCSD(ccsd.CCSD):
|
|
151
|
-
_keys =
|
|
151
|
+
_keys = {'max_space'}
|
|
152
152
|
|
|
153
153
|
def __init__(self, mf, frozen=None, mo_coeff=None, mo_occ=None):
|
|
154
154
|
ccsd.CCSD.__init__(self, mf, frozen, mo_coeff, mo_occ)
|
pyscf/cc/uccsd.py
CHANGED
|
@@ -547,7 +547,6 @@ class UCCSD(ccsd.CCSDBase):
|
|
|
547
547
|
# * A pair of list : First list is the orbital indices to be frozen for alpha
|
|
548
548
|
# orbitals, second list is for beta orbitals
|
|
549
549
|
def __init__(self, mf, frozen=None, mo_coeff=None, mo_occ=None):
|
|
550
|
-
assert isinstance(mf, scf.uhf.UHF)
|
|
551
550
|
ccsd.CCSDBase.__init__(self, mf, frozen, mo_coeff, mo_occ)
|
|
552
551
|
|
|
553
552
|
get_nocc = get_nocc
|
|
@@ -759,6 +758,8 @@ class UCCSD(ccsd.CCSDBase):
|
|
|
759
758
|
def amplitudes_from_rccsd(self, t1, t2):
|
|
760
759
|
return amplitudes_from_rccsd(t1, t2)
|
|
761
760
|
|
|
761
|
+
to_gpu = lib.to_gpu
|
|
762
|
+
|
|
762
763
|
CCSD = UCCSD
|
|
763
764
|
|
|
764
765
|
|
|
@@ -942,6 +943,7 @@ def _make_eris_incore(mycc, mo_coeff=None, ao2mofn=None):
|
|
|
942
943
|
return eris
|
|
943
944
|
|
|
944
945
|
def _make_df_eris_outcore(mycc, mo_coeff=None):
|
|
946
|
+
assert mycc._scf.istype('UHF')
|
|
945
947
|
cput0 = (logger.process_clock(), logger.perf_counter())
|
|
946
948
|
log = logger.Logger(mycc.stdout, mycc.verbose)
|
|
947
949
|
eris = _ChemistsERIs()
|
|
@@ -1059,6 +1061,8 @@ def _make_df_eris_outcore(mycc, mo_coeff=None):
|
|
|
1059
1061
|
return eris
|
|
1060
1062
|
|
|
1061
1063
|
def _make_eris_outcore(mycc, mo_coeff=None):
|
|
1064
|
+
from pyscf.scf.uhf import UHF
|
|
1065
|
+
assert isinstance(mycc._scf, UHF)
|
|
1062
1066
|
eris = _ChemistsERIs()
|
|
1063
1067
|
eris._common_init_(mycc, mo_coeff)
|
|
1064
1068
|
|
pyscf/cc/uccsd_slow.py
CHANGED
|
@@ -610,7 +610,7 @@ def uspatial2spin(cc, moidx, mo_coeff):
|
|
|
610
610
|
|
|
611
611
|
dm = cc._scf.make_rdm1(cc.mo_coeff, cc.mo_occ)
|
|
612
612
|
fockao = cc._scf.get_hcore() + cc._scf.get_veff(cc.mol, dm)
|
|
613
|
-
fockab =
|
|
613
|
+
fockab = []
|
|
614
614
|
for a in range(2):
|
|
615
615
|
fockab.append( reduce(numpy.dot, (mo_coeff[a].T, fockao[a], mo_coeff[a])) )
|
|
616
616
|
|
pyscf/ci/__init__.py
CHANGED
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
|
-
from pyscf import lib
|
|
17
16
|
from pyscf import scf
|
|
18
17
|
from pyscf.ci import cisd
|
|
19
18
|
from pyscf.ci import ucisd
|
|
@@ -21,11 +20,10 @@ from pyscf.ci import gcisd
|
|
|
21
20
|
from pyscf.cc import qcisd
|
|
22
21
|
|
|
23
22
|
def CISD(mf, frozen=None, mo_coeff=None, mo_occ=None):
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if isinstance(mf, scf.uhf.UHF):
|
|
23
|
+
if mf.istype('UHF'):
|
|
27
24
|
return UCISD(mf, frozen, mo_coeff, mo_occ)
|
|
28
|
-
elif
|
|
25
|
+
elif mf.istype('ROHF'):
|
|
26
|
+
from pyscf import lib
|
|
29
27
|
lib.logger.warn(mf, 'RCISD method does not support ROHF method. ROHF object '
|
|
30
28
|
'is converted to UHF object and UCISD method is called.')
|
|
31
29
|
return UCISD(mf, frozen, mo_coeff, mo_occ)
|
|
@@ -34,24 +32,32 @@ def CISD(mf, frozen=None, mo_coeff=None, mo_occ=None):
|
|
|
34
32
|
CISD.__doc__ = cisd.CISD.__doc__
|
|
35
33
|
|
|
36
34
|
def RCISD(mf, frozen=None, mo_coeff=None, mo_occ=None):
|
|
37
|
-
from pyscf.
|
|
35
|
+
from pyscf.df.df_jk import _DFHF
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
mf = mf.remove_soscf()
|
|
38
|
+
if not mf.istype('RHF'):
|
|
39
|
+
mf = mf.to_rhf()
|
|
41
40
|
|
|
42
|
-
if
|
|
41
|
+
if isinstance(mf, _DFHF) and mf.with_df:
|
|
42
|
+
from pyscf import lib
|
|
43
|
+
lib.logger.warn(mf, f'DF-RCISD for DFHF method {mf} is not available. '
|
|
44
|
+
'Normal RCISD method is called.')
|
|
43
45
|
return cisd.RCISD(mf, frozen, mo_coeff, mo_occ)
|
|
44
46
|
else:
|
|
45
47
|
return cisd.RCISD(mf, frozen, mo_coeff, mo_occ)
|
|
46
48
|
RCISD.__doc__ = cisd.RCISD.__doc__
|
|
47
49
|
|
|
48
50
|
def UCISD(mf, frozen=None, mo_coeff=None, mo_occ=None):
|
|
49
|
-
from pyscf.
|
|
51
|
+
from pyscf.df.df_jk import _DFHF
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
mf = mf.remove_soscf()
|
|
54
|
+
if not mf.istype('UHF'):
|
|
55
|
+
mf = mf.to_uhf()
|
|
53
56
|
|
|
54
|
-
if
|
|
57
|
+
if isinstance(mf, _DFHF) and mf.with_df:
|
|
58
|
+
from pyscf import lib
|
|
59
|
+
lib.logger.warn(mf, f'DF-UCISD for DFHF method {mf} is not available. '
|
|
60
|
+
'Normal UCISD method is called.')
|
|
55
61
|
return ucisd.UCISD(mf, frozen, mo_coeff, mo_occ)
|
|
56
62
|
else:
|
|
57
63
|
return ucisd.UCISD(mf, frozen, mo_coeff, mo_occ)
|
|
@@ -59,12 +65,13 @@ UCISD.__doc__ = ucisd.UCISD.__doc__
|
|
|
59
65
|
|
|
60
66
|
|
|
61
67
|
def GCISD(mf, frozen=None, mo_coeff=None, mo_occ=None):
|
|
62
|
-
from pyscf.
|
|
68
|
+
from pyscf.df.df_jk import _DFHF
|
|
63
69
|
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
mf = mf.remove_soscf()
|
|
71
|
+
if not mf.istype('GHF'):
|
|
72
|
+
mf = mf.to_ghf()
|
|
66
73
|
|
|
67
|
-
if
|
|
74
|
+
if isinstance(mf, _DFHF) and mf.with_df:
|
|
68
75
|
raise NotImplementedError('DF-GCISD')
|
|
69
76
|
else:
|
|
70
77
|
return gcisd.GCISD(mf, frozen, mo_coeff, mo_occ)
|
|
@@ -72,9 +79,9 @@ GCISD.__doc__ = gcisd.GCISD.__doc__
|
|
|
72
79
|
|
|
73
80
|
|
|
74
81
|
def QCISD(mf, frozen=None, mo_coeff=None, mo_occ=None):
|
|
75
|
-
if
|
|
82
|
+
if mf.istype('UHF'):
|
|
76
83
|
raise NotImplementedError
|
|
77
|
-
elif
|
|
84
|
+
elif mf.istype('GHF'):
|
|
78
85
|
raise NotImplementedError
|
|
79
86
|
else:
|
|
80
87
|
return RQCISD(mf, frozen, mo_coeff, mo_occ)
|
|
@@ -85,18 +92,17 @@ scf.hf.SCF.QCISD = QCISD
|
|
|
85
92
|
def RQCISD(mf, frozen=None, mo_coeff=None, mo_occ=None):
|
|
86
93
|
import numpy
|
|
87
94
|
from pyscf import lib
|
|
88
|
-
from pyscf.soscf import newton_ah
|
|
89
95
|
|
|
90
|
-
if
|
|
96
|
+
if mf.istype('UHF'):
|
|
91
97
|
raise RuntimeError('RQCISD cannot be used with UHF method.')
|
|
92
|
-
elif
|
|
98
|
+
elif mf.istype('ROHF'):
|
|
93
99
|
lib.logger.warn(mf, 'RQCISD method does not support ROHF method. ROHF object '
|
|
94
100
|
'is converted to UHF object and UQCISD method is called.')
|
|
95
|
-
mf = scf.addons.convert_to_uhf(mf)
|
|
96
101
|
raise NotImplementedError
|
|
97
102
|
|
|
98
|
-
|
|
99
|
-
|
|
103
|
+
mf = mf.remove_soscf()
|
|
104
|
+
if not mf.istype('RHF'):
|
|
105
|
+
mf = mf.to_rhf()
|
|
100
106
|
|
|
101
107
|
elif numpy.iscomplexobj(mo_coeff) or numpy.iscomplexobj(mf.mo_coeff):
|
|
102
108
|
raise NotImplementedError
|
pyscf/ci/addons.py
CHANGED
|
@@ -17,14 +17,13 @@
|
|
|
17
17
|
#
|
|
18
18
|
|
|
19
19
|
import numpy as np
|
|
20
|
-
from pyscf import scf
|
|
21
20
|
|
|
22
21
|
def convert_to_gcisd(myci):
|
|
23
22
|
from pyscf.ci import gcisd
|
|
24
23
|
if isinstance(myci, gcisd.GCISD):
|
|
25
24
|
return myci
|
|
26
25
|
|
|
27
|
-
mf =
|
|
26
|
+
mf = myci._scf.to_ghf()
|
|
28
27
|
gci = gcisd.GCISD(mf)
|
|
29
28
|
assert (myci._nocc is None)
|
|
30
29
|
assert (myci._nmo is None)
|
pyscf/ci/cisd.py
CHANGED
|
@@ -860,12 +860,12 @@ class CISD(lib.StreamObject):
|
|
|
860
860
|
direct = getattr(__config__, 'ci_cisd_CISD_direct', False)
|
|
861
861
|
async_io = getattr(__config__, 'ci_cisd_CISD_async_io', True)
|
|
862
862
|
|
|
863
|
-
_keys =
|
|
863
|
+
_keys = {
|
|
864
864
|
'conv_tol', 'max_cycle', 'max_space', 'lindep',
|
|
865
865
|
'level_shift', 'direct', 'async_io', 'mol', 'max_memory',
|
|
866
866
|
'nroots', 'frozen', 'chkfile', 'converged', 'mo_coeff', 'mo_occ',
|
|
867
867
|
'e_hf', 'e_corr', 'emp2', 'ci',
|
|
868
|
-
|
|
868
|
+
}
|
|
869
869
|
|
|
870
870
|
def __init__(self, mf, frozen=None, mo_coeff=None, mo_occ=None):
|
|
871
871
|
from pyscf.scf import hf
|
|
@@ -1131,6 +1131,8 @@ class CISD(lib.StreamObject):
|
|
|
1131
1131
|
from pyscf.grad import cisd
|
|
1132
1132
|
return cisd.Gradients(self)
|
|
1133
1133
|
|
|
1134
|
+
to_gpu = lib.to_gpu
|
|
1135
|
+
|
|
1134
1136
|
class RCISD(CISD):
|
|
1135
1137
|
pass
|
|
1136
1138
|
|
pyscf/data/elements.py
CHANGED
|
@@ -30,7 +30,7 @@ ELEMENTS = [
|
|
|
30
30
|
'Md', 'No', 'Lr', 'Rf', 'Db', 'Sg', 'Bh', 'Hs', 'Mt', 'Ds',
|
|
31
31
|
'Rg', 'Cn', 'Nh', 'Fl', 'Mc', 'Lv', 'Ts', 'Og',
|
|
32
32
|
]
|
|
33
|
-
NUC =
|
|
33
|
+
NUC = {x: i for i,x in enumerate(ELEMENTS)}
|
|
34
34
|
NUC.update((x.upper(),i) for i,x in enumerate(ELEMENTS))
|
|
35
35
|
NUC['GHOST'] = 0
|
|
36
36
|
ELEMENTS_PROTON = NUC
|
|
@@ -1130,7 +1130,7 @@ def _rm_digit(symb):
|
|
|
1130
1130
|
else:
|
|
1131
1131
|
return ''.join([i for i in symb if i.isalpha()])
|
|
1132
1132
|
|
|
1133
|
-
_ELEMENTS_UPPER =
|
|
1133
|
+
_ELEMENTS_UPPER = {x.upper(): x for x in ELEMENTS}
|
|
1134
1134
|
_ELEMENTS_UPPER['GHOST'] = 'Ghost'
|
|
1135
1135
|
|
|
1136
1136
|
def charge(symb_or_chg):
|
pyscf/df/addons.py
CHANGED
|
@@ -79,7 +79,7 @@ def aug_etb_for_dfbasis(mol, dfbasis=DFBASIS, beta=ETB_BETA,
|
|
|
79
79
|
exps = alpha*beta^i for i = 1..N
|
|
80
80
|
'''
|
|
81
81
|
nuc_start = gto.charge(start_at)
|
|
82
|
-
uniq_atoms =
|
|
82
|
+
uniq_atoms = {a[0] for a in mol._atom}
|
|
83
83
|
|
|
84
84
|
newbasis = {}
|
|
85
85
|
for symb in uniq_atoms:
|
|
@@ -143,16 +143,16 @@ def make_auxbasis(mol, mp2fit=False):
|
|
|
143
143
|
'''Depending on the orbital basis, generating even-tempered Gaussians or
|
|
144
144
|
the optimized auxiliary basis defined in DEFAULT_AUXBASIS
|
|
145
145
|
'''
|
|
146
|
-
uniq_atoms =
|
|
146
|
+
uniq_atoms = {a[0] for a in mol._atom}
|
|
147
147
|
if isinstance(mol.basis, str):
|
|
148
|
-
_basis =
|
|
148
|
+
_basis = {a: mol.basis for a in uniq_atoms}
|
|
149
149
|
elif 'default' in mol.basis:
|
|
150
150
|
default_basis = mol.basis['default']
|
|
151
|
-
_basis =
|
|
151
|
+
_basis = {a: default_basis for a in uniq_atoms}
|
|
152
152
|
_basis.update(mol.basis)
|
|
153
153
|
del (_basis['default'])
|
|
154
154
|
else:
|
|
155
|
-
_basis = mol._basis
|
|
155
|
+
_basis = mol._basis or {}
|
|
156
156
|
|
|
157
157
|
auxbasis = {}
|
|
158
158
|
for k in _basis:
|
|
@@ -209,11 +209,11 @@ def make_auxmol(mol, auxbasis=None):
|
|
|
209
209
|
pmol.basis = auxbasis
|
|
210
210
|
|
|
211
211
|
if isinstance(auxbasis, (str, list, tuple)):
|
|
212
|
-
uniq_atoms =
|
|
213
|
-
_basis =
|
|
212
|
+
uniq_atoms = {a[0] for a in mol._atom}
|
|
213
|
+
_basis = {a: auxbasis for a in uniq_atoms}
|
|
214
214
|
elif 'default' in auxbasis:
|
|
215
|
-
uniq_atoms =
|
|
216
|
-
_basis =
|
|
215
|
+
uniq_atoms = {a[0] for a in mol._atom}
|
|
216
|
+
_basis = {a: auxbasis['default'] for a in uniq_atoms}
|
|
217
217
|
_basis.update(auxbasis)
|
|
218
218
|
del (_basis['default'])
|
|
219
219
|
else:
|
pyscf/df/df.py
CHANGED
|
@@ -79,7 +79,7 @@ class DF(lib.StreamObject):
|
|
|
79
79
|
_compatible_format = getattr(__config__, 'df_df_DF_compatible_format', False)
|
|
80
80
|
_dataname = 'j3c'
|
|
81
81
|
|
|
82
|
-
_keys =
|
|
82
|
+
_keys = {'mol', 'auxmol'}
|
|
83
83
|
|
|
84
84
|
def __init__(self, mol, auxbasis=None):
|
|
85
85
|
self.mol = mol
|
|
@@ -284,7 +284,7 @@ class DF(lib.StreamObject):
|
|
|
284
284
|
else:
|
|
285
285
|
rsh_df = self._rsh_df[key] = self.copy().reset()
|
|
286
286
|
if hasattr(self, '_dataname'):
|
|
287
|
-
rsh_df._dataname = f'{self._dataname}
|
|
287
|
+
rsh_df._dataname = f'{self._dataname}-lr/{key}'
|
|
288
288
|
logger.info(self, 'Create RSH-DF object %s for omega=%s', rsh_df, omega)
|
|
289
289
|
|
|
290
290
|
mol = self.mol
|
|
@@ -308,6 +308,8 @@ class DF(lib.StreamObject):
|
|
|
308
308
|
if auxmol_omega is not None:
|
|
309
309
|
auxmol.omega = auxmol_omega
|
|
310
310
|
|
|
311
|
+
to_gpu = lib.to_gpu
|
|
312
|
+
|
|
311
313
|
GDF = DF
|
|
312
314
|
|
|
313
315
|
|
|
@@ -353,7 +355,12 @@ class DF4C(DF):
|
|
|
353
355
|
with self.range_coulomb(omega) as rsh_df:
|
|
354
356
|
return df_jk.r_get_jk(rsh_df, dm, hermi, with_j, with_k)
|
|
355
357
|
|
|
358
|
+
def get_eri(self):
|
|
359
|
+
raise NotImplementedError
|
|
360
|
+
get_ao_eri = get_eri
|
|
361
|
+
|
|
356
362
|
def ao2mo(self, mo_coeffs):
|
|
357
363
|
raise NotImplementedError
|
|
364
|
+
get_mo_eri = ao2mo
|
|
358
365
|
|
|
359
366
|
GDF4C = DF4C
|
pyscf/df/df_jk.py
CHANGED
|
@@ -108,7 +108,7 @@ class _DFHF:
|
|
|
108
108
|
|
|
109
109
|
__name_mixin__ = 'DF'
|
|
110
110
|
|
|
111
|
-
_keys =
|
|
111
|
+
_keys = {'with_df', 'only_dfj'}
|
|
112
112
|
|
|
113
113
|
def __init__(self, mf, df=None, only_dfj=None):
|
|
114
114
|
self.__dict__.update(mf.__dict__)
|
|
@@ -123,8 +123,7 @@ class _DFHF:
|
|
|
123
123
|
def undo_df(self):
|
|
124
124
|
'''Remove the DFHF Mixin'''
|
|
125
125
|
obj = lib.view(self, lib.drop_class(self.__class__, _DFHF))
|
|
126
|
-
del obj.with_df
|
|
127
|
-
del obj.only_dfj
|
|
126
|
+
del obj.with_df, obj.only_dfj
|
|
128
127
|
return obj
|
|
129
128
|
|
|
130
129
|
def reset(self, mol=None):
|
|
@@ -227,6 +226,10 @@ class _DFHF:
|
|
|
227
226
|
from pyscf import mcscf
|
|
228
227
|
return mcscf.DFCASSCF(self, ncas, nelecas, auxbasis, ncore, frozen)
|
|
229
228
|
|
|
229
|
+
def to_gpu(self):
|
|
230
|
+
obj = self.undo_df().to_gpu().density_fit()
|
|
231
|
+
return lib.to_gpu(self, obj)
|
|
232
|
+
|
|
230
233
|
|
|
231
234
|
def get_jk(dfobj, dm, hermi=1, with_j=True, with_k=True, direct_scf_tol=1e-13):
|
|
232
235
|
assert (with_j or with_k)
|
|
@@ -257,8 +260,9 @@ def get_jk(dfobj, dm, hermi=1, with_j=True, with_k=True, direct_scf_tol=1e-13):
|
|
|
257
260
|
|
|
258
261
|
if not with_k:
|
|
259
262
|
for eri1 in dfobj.loop():
|
|
260
|
-
|
|
261
|
-
vj +=
|
|
263
|
+
# uses numpy.matmul
|
|
264
|
+
vj += (dmtril @ eri1.T) @ eri1
|
|
265
|
+
|
|
262
266
|
|
|
263
267
|
elif getattr(dm, 'mo_coeff', None) is not None:
|
|
264
268
|
#TODO: test whether dm.mo_coeff matching dm
|
|
@@ -287,9 +291,8 @@ def get_jk(dfobj, dm, hermi=1, with_j=True, with_k=True, direct_scf_tol=1e-13):
|
|
|
287
291
|
naux, nao_pair = eri1.shape
|
|
288
292
|
assert (nao_pair == nao*(nao+1)//2)
|
|
289
293
|
if with_j:
|
|
290
|
-
|
|
291
|
-
vj +=
|
|
292
|
-
|
|
294
|
+
# uses numpy.matmul
|
|
295
|
+
vj += (dmtril @ eri1.T) @ eri1
|
|
293
296
|
for k in range(nset):
|
|
294
297
|
nocc = orbo[k].shape[1]
|
|
295
298
|
if nocc > 0:
|
|
@@ -315,8 +318,9 @@ def get_jk(dfobj, dm, hermi=1, with_j=True, with_k=True, direct_scf_tol=1e-13):
|
|
|
315
318
|
for eri1 in dfobj.loop(blksize):
|
|
316
319
|
naux, nao_pair = eri1.shape
|
|
317
320
|
if with_j:
|
|
318
|
-
|
|
319
|
-
vj +=
|
|
321
|
+
# uses numpy.matmul
|
|
322
|
+
vj += (dmtril @ eri1.T) @ eri1
|
|
323
|
+
|
|
320
324
|
|
|
321
325
|
for k in range(nset):
|
|
322
326
|
buf1 = buf[0,:naux]
|
pyscf/df/grad/casdm2_util.py
CHANGED
|
@@ -476,7 +476,7 @@ def grad_elec_dferi (mc_grad, mo_cas=None, ci=None, dfcasdm2=None, casdm2=None,
|
|
|
476
476
|
|
|
477
477
|
aoslices = mol.aoslice_by_atom ()
|
|
478
478
|
dE = np.array ([dE[:,p0:p1].sum (axis=1) for p0, p1 in aoslices[:,2:]]).transpose (1,0,2)
|
|
479
|
-
return np.ascontiguousarray (dE)
|
|
479
|
+
return np.ascontiguousarray (dE)[:,atmlst,:]
|
|
480
480
|
|
|
481
481
|
if __name__ == '__main__':
|
|
482
482
|
from pyscf.tools import molden
|
pyscf/df/grad/casscf.py
CHANGED
pyscf/df/grad/rhf.py
CHANGED
|
@@ -38,8 +38,9 @@ from functools import reduce
|
|
|
38
38
|
from itertools import product
|
|
39
39
|
from pyscf.ao2mo import _ao2mo
|
|
40
40
|
from pyscf.df import df_jk
|
|
41
|
+
from pyscf.df.incore import LINEAR_DEP_THR
|
|
41
42
|
|
|
42
|
-
LINEAR_DEP_THRESHOLD =
|
|
43
|
+
LINEAR_DEP_THRESHOLD = LINEAR_DEP_THR
|
|
43
44
|
|
|
44
45
|
def get_jk(mf_grad, mol=None, dm=None, hermi=0, with_j=True, with_k=True,
|
|
45
46
|
decompose_j2c='CD', lindep=LINEAR_DEP_THRESHOLD):
|
|
@@ -342,6 +343,9 @@ def _decompose_rdm1 (mf_grad, mol, dm):
|
|
|
342
343
|
if hasattr (dm, 'mo_coeff') and hasattr (dm, 'mo_occ'):
|
|
343
344
|
mo_coeff = dm.mo_coeff
|
|
344
345
|
mo_occ = dm.mo_occ
|
|
346
|
+
if getattr(mo_occ, 'ndim', None) == 1: # RHF orbitals
|
|
347
|
+
mo_coeff = [mo_coeff]
|
|
348
|
+
mo_occ = [mo_occ]
|
|
345
349
|
else:
|
|
346
350
|
s0 = mol.intor ('int1e_ovlp')
|
|
347
351
|
mo_occ = []
|
|
@@ -352,10 +356,7 @@ def _decompose_rdm1 (mf_grad, mol, dm):
|
|
|
352
356
|
mo_occ.append (n)
|
|
353
357
|
mo_coeff.append (c)
|
|
354
358
|
mo_occ = numpy.stack (mo_occ, axis=0)
|
|
355
|
-
nmo = mo_occ.shape[-1]
|
|
356
359
|
|
|
357
|
-
mo_coeff = numpy.asarray(mo_coeff).reshape(-1,nao,nmo)
|
|
358
|
-
mo_occ = numpy.asarray(mo_occ).reshape(-1,nmo)
|
|
359
360
|
orbor = []
|
|
360
361
|
orbol = []
|
|
361
362
|
for i in range(nset):
|
|
@@ -482,12 +483,15 @@ class Gradients(rhf_grad.Gradients):
|
|
|
482
483
|
_keys = {'with_df', 'auxbasis_response'}
|
|
483
484
|
|
|
484
485
|
def __init__(self, mf):
|
|
485
|
-
assert isinstance(mf, df.df_jk._DFHF)
|
|
486
|
-
# Whether to include the response of DF auxiliary basis when computing
|
|
487
|
-
# nuclear gradients of J/K matrices
|
|
488
|
-
self.auxbasis_response = True
|
|
489
486
|
rhf_grad.Gradients.__init__(self, mf)
|
|
490
487
|
|
|
488
|
+
# Whether to include the response of DF auxiliary basis when computing
|
|
489
|
+
# nuclear gradients of J/K matrices
|
|
490
|
+
auxbasis_response = True
|
|
491
|
+
|
|
492
|
+
def check_sanity(self):
|
|
493
|
+
assert isinstance(self.base, df.df_jk._DFHF)
|
|
494
|
+
|
|
491
495
|
def get_jk(self, mol=None, dm=None, hermi=0, with_j=True, with_k=True,
|
|
492
496
|
omega=None):
|
|
493
497
|
if omega is None:
|