pyscf 2.6.2__py3-none-macosx_11_0_arm64.whl → 2.7.0__py3-none-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/outcore.py +6 -4
- pyscf/cc/__init__.py +21 -3
- pyscf/cc/bccd.py +0 -46
- pyscf/cc/ccsd.py +16 -8
- pyscf/cc/uccsd.py +1 -1
- pyscf/data/elements.py +1 -1
- pyscf/df/__init__.py +2 -1
- pyscf/df/addons.py +79 -51
- pyscf/df/autoaux.py +191 -0
- pyscf/df/df.py +5 -1
- pyscf/df/grad/casscf.py +0 -41
- 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 +17 -5
- pyscf/dft/dks.py +1 -1
- pyscf/dft/libxc.py +65 -639
- pyscf/dft/numint.py +7 -3
- pyscf/dft/radi.py +39 -5
- pyscf/dft/rks.py +1 -1
- 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 -9
- 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/lagrange.py +11 -3
- pyscf/grad/mp2.py +1 -1
- pyscf/grad/sacasscf.py +1 -1
- pyscf/grad/tdrks.py +1 -1
- pyscf/gto/basis/__init__.py +7 -0
- pyscf/gto/basis/bse.py +68 -15
- pyscf/gto/basis/parse_cp2k_pp.py +1 -1
- pyscf/gto/basis/parse_nwchem.py +1 -1
- 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/mole.py +99 -44
- pyscf/gw/gw_ac.py +2 -2
- pyscf/gw/gw_cd.py +2 -2
- pyscf/gw/rpa.py +2 -2
- pyscf/gw/ugw_ac.py +2 -2
- pyscf/gw/urpa.py +1 -1
- 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/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/deps/include/XCFun/XCFunExport.h +1 -0
- pyscf/lib/dft/grid_common.c +1 -1
- pyscf/lib/dft/libxc_itrf.c +4 -1
- pyscf/lib/dft/xcfun_itrf.c +1 -1
- pyscf/lib/diis.py +1 -1
- pyscf/lib/exceptions.py +3 -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/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 +112 -192
- pyscf/lib/mcscf/fci_contract.c +2 -2
- pyscf/lib/misc.py +47 -14
- pyscf/lib/numpy_helper.py +1 -1
- pyscf/lib/pbc/nr_ecp.c +10 -3
- pyscf/lib/pbc/pbc.h +1 -1
- pyscf/lib/vhf/nr_sgx_direct.c +8 -6
- pyscf/lib/vhf/optimizer.c +2 -2
- 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 +8 -6
- pyscf/mcscf/chkfile.py +70 -41
- pyscf/mcscf/dmet_cas.py +2 -2
- pyscf/mcscf/mc1step.py +62 -38
- pyscf/mcscf/newton_casscf.py +5 -5
- pyscf/mcscf/ucasci.py +1 -1
- pyscf/mcscf/umc1step.py +44 -25
- pyscf/md/integrators.py +3 -3
- pyscf/mp/mp2.py +6 -5
- pyscf/mp/ump2.py +7 -6
- 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 +2 -2
- pyscf/pbc/df/aft_ao2mo.py +1 -1
- pyscf/pbc/df/df.py +84 -11
- pyscf/pbc/df/df_jk.py +2 -1
- pyscf/pbc/df/fft.py +6 -2
- pyscf/pbc/df/fft_ao2mo.py +4 -0
- pyscf/pbc/df/fft_jk.py +11 -3
- pyscf/pbc/df/ft_ao.py +4 -3
- pyscf/pbc/df/gdf_builder.py +5 -4
- pyscf/pbc/df/incore.py +1 -1
- pyscf/pbc/df/mdf.py +6 -3
- pyscf/pbc/df/rsdf.py +2 -2
- pyscf/pbc/df/rsdf_builder.py +11 -6
- pyscf/pbc/df/rsdf_helper.py +1 -1
- pyscf/pbc/dft/cdft.py +5 -5
- pyscf/pbc/dft/multigrid/multigrid.py +19 -26
- pyscf/pbc/dft/multigrid/multigrid_pair.py +1 -1
- pyscf/pbc/dft/multigrid/pp.py +1 -1
- pyscf/pbc/dft/numint.py +30 -21
- pyscf/pbc/eph/eph_fd.py +1 -1
- pyscf/pbc/geomopt/geometric_solver.py +1 -1
- pyscf/pbc/gto/cell.py +37 -19
- pyscf/pbc/gto/ecp.py +12 -12
- pyscf/pbc/gto/eval_gto.py +2 -2
- 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/addons.py +15 -11
- pyscf/pbc/scf/cphf.py +1 -1
- pyscf/pbc/scf/ghf.py +1 -1
- pyscf/pbc/scf/hf.py +21 -24
- pyscf/pbc/scf/kghf.py +33 -29
- pyscf/pbc/scf/khf.py +71 -26
- pyscf/pbc/scf/krohf.py +5 -7
- pyscf/pbc/scf/kuhf.py +53 -22
- pyscf/pbc/scf/rsjk.py +13 -9
- pyscf/pbc/scf/scfint.py +1 -1
- pyscf/pbc/scf/stability.py +1 -1
- pyscf/pbc/scf/uhf.py +3 -1
- pyscf/pbc/symm/symmetry.py +2 -2
- pyscf/pbc/tdscf/kproxy.py +1 -1
- pyscf/pbc/tdscf/kproxy_supercell.py +2 -2
- pyscf/pbc/tdscf/krhf.py +215 -133
- pyscf/pbc/tdscf/krhf_slow_supercell.py +1 -1
- pyscf/pbc/tdscf/krks.py +1 -45
- pyscf/pbc/tdscf/kuhf.py +58 -105
- pyscf/pbc/tdscf/kuks.py +0 -56
- pyscf/pbc/tdscf/proxy.py +1 -1
- pyscf/pbc/tdscf/rhf.py +111 -3
- pyscf/pbc/tdscf/rks.py +2 -1
- pyscf/pbc/tdscf/uhf.py +203 -1
- pyscf/pbc/tdscf/uks.py +2 -1
- pyscf/pbc/tools/k2gamma.py +7 -4
- pyscf/pbc/tools/pbc.py +63 -56
- 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 +2 -2
- pyscf/scf/_vhf.py +14 -10
- pyscf/scf/addons.py +29 -15
- pyscf/scf/cphf.py +14 -52
- pyscf/scf/dhf.py +39 -10
- pyscf/scf/dispersion.py +9 -8
- pyscf/scf/ghf.py +25 -13
- pyscf/scf/ghf_symm.py +2 -2
- pyscf/scf/hf.py +245 -29
- pyscf/scf/rohf.py +37 -5
- pyscf/scf/stability.py +142 -112
- pyscf/scf/ucphf.py +21 -16
- pyscf/scf/uhf.py +95 -58
- pyscf/sgx/sgx.py +1 -1
- pyscf/sgx/sgx_jk.py +4 -4
- pyscf/solvent/_ddcosmo_tdscf_grad.py +1 -1
- pyscf/solvent/ddcosmo.py +1 -1
- pyscf/solvent/pol_embed.py +1 -1
- pyscf/soscf/ciah.py +1 -1
- pyscf/soscf/newton_ah.py +1 -1
- pyscf/symm/__init__.py +1 -1
- pyscf/symm/addons.py +5 -5
- pyscf/tdscf/_lr_eig.py +505 -0
- pyscf/tdscf/common_slow.py +1 -1
- pyscf/tdscf/dhf.py +41 -37
- pyscf/tdscf/dks.py +0 -4
- pyscf/tdscf/ghf.py +91 -71
- pyscf/tdscf/gks.py +16 -16
- pyscf/tdscf/proxy.py +2 -2
- pyscf/tdscf/rhf.py +143 -96
- pyscf/tdscf/rks.py +15 -14
- pyscf/tdscf/uhf.py +117 -70
- pyscf/tdscf/uks.py +17 -18
- pyscf/tools/fcidump.py +3 -0
- pyscf/x2c/sfx2c1e.py +1 -1
- pyscf/x2c/tdscf.py +4 -4
- pyscf/x2c/x2c.py +15 -11
- {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/METADATA +24 -24
- {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/NOTICE +3 -1
- {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/RECORD +242 -240
- {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/WHEEL +1 -1
- pyscf/dft/gen_libxc_param.py +0 -35
- pyscf/dft/gen_xcfun_param.py +0 -209
- {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/LICENSE +0 -0
- {pyscf-2.6.2.dist-info → pyscf-2.7.0.dist-info}/top_level.txt +0 -0
pyscf/adc/uadc_ea.py
CHANGED
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
|
-
# Author:
|
|
15
|
+
# Author: Abdelrahman Ahmed <>
|
|
16
|
+
# Samragni Banerjee <samragnibanerjee4@gmail.com>
|
|
17
|
+
# James Serna <jamcar456@gmail.com>
|
|
18
|
+
# Terrence Stahl <>
|
|
16
19
|
# Alexander Sokolov <alexander.y.sokolov@gmail.com>
|
|
17
20
|
#
|
|
18
21
|
|
|
@@ -287,22 +290,13 @@ def get_imds(adc, eris=None):
|
|
|
287
290
|
M_ab_a += lib.einsum('mlfd,mled,aebf->ab',t2_1_ab, t2_1_ab, eris_vvvv, optimize=True)
|
|
288
291
|
del eris_vvvv
|
|
289
292
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
temp[:,:,ab_ind_a[1],ab_ind_a[0]] = -adc.imds.t2_1_vvvv[0]
|
|
293
|
-
|
|
294
|
-
M_ab_a -= 2 * 0.5 * 0.25*lib.einsum('mlaf,mlbf->ab',t2_1_a, temp, optimize=True)
|
|
295
|
-
del temp
|
|
296
|
-
|
|
293
|
+
M_ab_a -= 2 * 0.5 * 0.25*lib.einsum('mlaf,mlbf->ab',
|
|
294
|
+
t2_1_a, adc.imds.t2_1_vvvv[0], optimize=True)
|
|
297
295
|
else:
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
M_ab_a -= 2*0.5*0.25*lib.einsum('mlad,mlbd->ab', temp_t2a_vvvv, t2_1_a, optimize=True)
|
|
304
|
-
M_ab_a -= 2*0.5*0.25*lib.einsum('mlaf,mlbf->ab', t2_1_a, temp_t2a_vvvv, optimize=True)
|
|
305
|
-
del temp_t2a_vvvv
|
|
296
|
+
M_ab_a -= 2*0.5*0.25*lib.einsum('mlad,mlbd->ab',
|
|
297
|
+
adc.imds.t2_1_vvvv[0], t2_1_a, optimize=True)
|
|
298
|
+
M_ab_a -= 2*0.5*0.25*lib.einsum('mlaf,mlbf->ab', t2_1_a,
|
|
299
|
+
adc.imds.t2_1_vvvv[0], optimize=True)
|
|
306
300
|
|
|
307
301
|
if isinstance(eris.vvvv_p, list):
|
|
308
302
|
|
|
@@ -387,18 +381,20 @@ def get_imds(adc, eris=None):
|
|
|
387
381
|
M_ab_b += lib.einsum('mlfd,mled,eafb->ab',t2_1_ab, t2_1_ab, eris_vVvV, optimize=True)
|
|
388
382
|
|
|
389
383
|
eris_vVvV = eris_vVvV.reshape(nvir_a*nvir_b,nvir_a*nvir_b)
|
|
390
|
-
|
|
391
|
-
M_ab_a -= 0.5*lib.einsum('mlaf,mlbf->ab',t2_1_ab,
|
|
392
|
-
M_ab_b -= 0.5*lib.einsum('mlfa,mlfb->ab',t2_1_ab,
|
|
393
|
-
|
|
384
|
+
|
|
385
|
+
M_ab_a -= 0.5*lib.einsum('mlaf,mlbf->ab',t2_1_ab, adc.imds.t2_1_vvvv[1], optimize=True)
|
|
386
|
+
M_ab_b -= 0.5*lib.einsum('mlfa,mlfb->ab',t2_1_ab, adc.imds.t2_1_vvvv[1], optimize=True)
|
|
387
|
+
|
|
394
388
|
else:
|
|
395
|
-
|
|
389
|
+
M_ab_a -= 0.5 * lib.einsum('mlad,mlbd->ab',
|
|
390
|
+
adc.imds.t2_1_vvvv[1], t2_1_ab, optimize=True)
|
|
391
|
+
M_ab_b -= 0.5 * lib.einsum('mlda,mldb->ab',
|
|
392
|
+
adc.imds.t2_1_vvvv[1], t2_1_ab, optimize=True)
|
|
393
|
+
M_ab_a -= 0.5 * lib.einsum('mlaf,mlbf->ab', t2_1_ab,
|
|
394
|
+
adc.imds.t2_1_vvvv[1], optimize=True)
|
|
395
|
+
M_ab_b -= 0.5 * lib.einsum('mlfa,mlfb->ab', t2_1_ab,
|
|
396
|
+
adc.imds.t2_1_vvvv[1], optimize=True)
|
|
396
397
|
|
|
397
|
-
M_ab_a -= 0.5 * lib.einsum('mlad,mlbd->ab', t2_vVvV, t2_1_ab, optimize=True)
|
|
398
|
-
M_ab_b -= 0.5 * lib.einsum('mlda,mldb->ab', t2_vVvV, t2_1_ab, optimize=True)
|
|
399
|
-
M_ab_a -= 0.5 * lib.einsum('mlaf,mlbf->ab',t2_1_ab, t2_vVvV, optimize=True)
|
|
400
|
-
M_ab_b -= 0.5 * lib.einsum('mlfa,mlfb->ab',t2_1_ab, t2_vVvV, optimize=True)
|
|
401
|
-
del t2_vVvV
|
|
402
398
|
del t2_1_a
|
|
403
399
|
|
|
404
400
|
if isinstance(eris.VVVV_p,np.ndarray):
|
|
@@ -409,22 +405,13 @@ def get_imds(adc, eris=None):
|
|
|
409
405
|
M_ab_b += lib.einsum('mldf,mlde,aebf->ab',t2_1_ab, t2_1_ab, eris_VVVV, optimize=True)
|
|
410
406
|
del eris_VVVV
|
|
411
407
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
temp[:,:,ab_ind_b[1],ab_ind_b[0]] = -adc.imds.t2_1_vvvv[2]
|
|
415
|
-
M_ab_b -= 2 * 0.5 * 0.25*lib.einsum('mlaf,mlbf->ab',t2_1_b, temp, optimize=True)
|
|
416
|
-
del temp
|
|
408
|
+
M_ab_b -= 2 * 0.5 * 0.25*lib.einsum('mlaf,mlbf->ab',
|
|
409
|
+
t2_1_b, adc.imds.t2_1_vvvv[2], optimize=True)
|
|
417
410
|
else:
|
|
418
|
-
|
|
419
|
-
temp_t2b_VVVV = np.zeros((nocc_b,nocc_b,nvir_b,nvir_b))
|
|
420
|
-
temp_t2b_VVVV[:,:,ab_ind_b[0],ab_ind_b[1]] = adc.imds.t2_1_vvvv[2][:]
|
|
421
|
-
temp_t2b_VVVV[:,:,ab_ind_b[1],ab_ind_b[0]] = -adc.imds.t2_1_vvvv[2][:]
|
|
422
|
-
|
|
423
411
|
M_ab_b -= 2 * 0.5 * 0.25*lib.einsum('mlad,mlbd->ab',
|
|
424
|
-
|
|
412
|
+
adc.imds.t2_1_vvvv[2], t2_1_b, optimize=True)
|
|
425
413
|
M_ab_b -= 2 * 0.5 * 0.25*lib.einsum('mlaf,mlbf->ab',
|
|
426
|
-
t2_1_b,
|
|
427
|
-
del temp_t2b_VVVV
|
|
414
|
+
t2_1_b, adc.imds.t2_1_vvvv[2], optimize=True)
|
|
428
415
|
|
|
429
416
|
if isinstance(eris.vvvv_p, list):
|
|
430
417
|
|
|
@@ -1971,6 +1958,7 @@ class UADCEA(uadc.UADC):
|
|
|
1971
1958
|
}
|
|
1972
1959
|
|
|
1973
1960
|
def __init__(self, adc):
|
|
1961
|
+
self.mol = adc.mol
|
|
1974
1962
|
self.verbose = adc.verbose
|
|
1975
1963
|
self.stdout = adc.stdout
|
|
1976
1964
|
self.max_memory = adc.max_memory
|
|
@@ -1987,6 +1975,7 @@ class UADCEA(uadc.UADC):
|
|
|
1987
1975
|
self._scf = adc._scf
|
|
1988
1976
|
self._nocc = adc._nocc
|
|
1989
1977
|
self._nvir = adc._nvir
|
|
1978
|
+
self._nmo = adc._nmo
|
|
1990
1979
|
self.nocc_a = adc._nocc[0]
|
|
1991
1980
|
self.nocc_b = adc._nocc[1]
|
|
1992
1981
|
self.nvir_a = adc._nvir[0]
|
|
@@ -1996,14 +1985,14 @@ class UADCEA(uadc.UADC):
|
|
|
1996
1985
|
self.mo_energy_b = adc.mo_energy_b
|
|
1997
1986
|
self.nmo_a = adc._nmo[0]
|
|
1998
1987
|
self.nmo_b = adc._nmo[1]
|
|
1999
|
-
self.mol = adc.mol
|
|
2000
1988
|
self.transform_integrals = adc.transform_integrals
|
|
2001
1989
|
self.with_df = adc.with_df
|
|
1990
|
+
self.compute_properties = adc.compute_properties
|
|
1991
|
+
self.approx_trans_moments = adc.approx_trans_moments
|
|
1992
|
+
|
|
2002
1993
|
self.spec_factor_print_tol = adc.spec_factor_print_tol
|
|
2003
1994
|
self.evec_print_tol = adc.evec_print_tol
|
|
2004
1995
|
|
|
2005
|
-
self.compute_properties = adc.compute_properties
|
|
2006
|
-
self.approx_trans_moments = adc.approx_trans_moments
|
|
2007
1996
|
self.E = adc.E
|
|
2008
1997
|
self.U = adc.U
|
|
2009
1998
|
self.P = adc.P
|
|
@@ -2014,11 +2003,12 @@ class UADCEA(uadc.UADC):
|
|
|
2014
2003
|
matvec = matvec
|
|
2015
2004
|
get_diag = get_diag
|
|
2016
2005
|
get_trans_moments = get_trans_moments
|
|
2017
|
-
analyze_spec_factor = analyze_spec_factor
|
|
2018
2006
|
get_properties = get_properties
|
|
2007
|
+
|
|
2019
2008
|
analyze = analyze
|
|
2020
|
-
|
|
2009
|
+
analyze_spec_factor = analyze_spec_factor
|
|
2021
2010
|
analyze_eigenvector = analyze_eigenvector
|
|
2011
|
+
compute_dyson_mo = compute_dyson_mo
|
|
2022
2012
|
|
|
2023
2013
|
def get_init_guess(self, nroots=1, diag=None, ascending=True):
|
|
2024
2014
|
if diag is None :
|
pyscf/adc/uadc_ip.py
CHANGED
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
|
-
# Author:
|
|
15
|
+
# Author: Abdelrahman Ahmed <>
|
|
16
|
+
# Samragni Banerjee <samragnibanerjee4@gmail.com>
|
|
17
|
+
# James Serna <jamcar456@gmail.com>
|
|
18
|
+
# Terrence Stahl <>
|
|
16
19
|
# Alexander Sokolov <alexander.y.sokolov@gmail.com>
|
|
17
20
|
#
|
|
18
21
|
|
|
@@ -1849,6 +1852,7 @@ class UADCIP(uadc.UADC):
|
|
|
1849
1852
|
}
|
|
1850
1853
|
|
|
1851
1854
|
def __init__(self, adc):
|
|
1855
|
+
self.mol = adc.mol
|
|
1852
1856
|
self.verbose = adc.verbose
|
|
1853
1857
|
self.stdout = adc.stdout
|
|
1854
1858
|
self.max_memory = adc.max_memory
|
|
@@ -1865,6 +1869,7 @@ class UADCIP(uadc.UADC):
|
|
|
1865
1869
|
self._scf = adc._scf
|
|
1866
1870
|
self._nocc = adc._nocc
|
|
1867
1871
|
self._nvir = adc._nvir
|
|
1872
|
+
self._nmo = adc._nmo
|
|
1868
1873
|
self.nocc_a = adc._nocc[0]
|
|
1869
1874
|
self.nocc_b = adc._nocc[1]
|
|
1870
1875
|
self.nvir_a = adc._nvir[0]
|
|
@@ -1874,14 +1879,14 @@ class UADCIP(uadc.UADC):
|
|
|
1874
1879
|
self.mo_energy_b = adc.mo_energy_b
|
|
1875
1880
|
self.nmo_a = adc._nmo[0]
|
|
1876
1881
|
self.nmo_b = adc._nmo[1]
|
|
1877
|
-
self.mol = adc.mol
|
|
1878
1882
|
self.transform_integrals = adc.transform_integrals
|
|
1879
1883
|
self.with_df = adc.with_df
|
|
1884
|
+
self.compute_properties = adc.compute_properties
|
|
1885
|
+
self.approx_trans_moments = adc.approx_trans_moments
|
|
1886
|
+
|
|
1880
1887
|
self.spec_factor_print_tol = adc.spec_factor_print_tol
|
|
1881
1888
|
self.evec_print_tol = adc.evec_print_tol
|
|
1882
1889
|
|
|
1883
|
-
self.compute_properties = adc.compute_properties
|
|
1884
|
-
self.approx_trans_moments = adc.approx_trans_moments
|
|
1885
1890
|
self.E = adc.E
|
|
1886
1891
|
self.U = adc.U
|
|
1887
1892
|
self.P = adc.P
|
pyscf/adc/uadc_ip_cvs.py
CHANGED
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
|
-
# Author: Abdelrahman Ahmed
|
|
15
|
+
# Author: Abdelrahman Ahmed <>
|
|
16
|
+
# Samragni Banerjee <samragnibanerjee4@gmail.com>
|
|
17
|
+
# James Serna <jamcar456@gmail.com>
|
|
18
|
+
# Terrence Stahl <>
|
|
16
19
|
# Alexander Sokolov <alexander.y.sokolov@gmail.com>
|
|
17
20
|
#
|
|
18
21
|
|
pyscf/agf2/__init__.py
CHANGED
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
#
|
|
18
18
|
|
|
19
19
|
'''
|
|
20
|
-
Auxiliary second-order Green's function perturbation
|
|
21
|
-
|
|
20
|
+
Auxiliary second-order Green's function perturbation theory
|
|
21
|
+
===========================================================
|
|
22
22
|
|
|
23
23
|
The AGF2 method permits the computation of quasiparticle excitations and
|
|
24
24
|
ground-state properties at the AGF2(None,0) level.
|
pyscf/agf2/aux_space.py
CHANGED
|
@@ -446,7 +446,7 @@ def combine(*auxspcs):
|
|
|
446
446
|
'''
|
|
447
447
|
|
|
448
448
|
nphys = [auxspc.nphys for auxspc in auxspcs]
|
|
449
|
-
if not all(
|
|
449
|
+
if not all(x == nphys[0] for x in nphys):
|
|
450
450
|
raise ValueError('Size of physical space must be the same to '
|
|
451
451
|
'combine AuxiliarySpace objects.')
|
|
452
452
|
nphys = nphys[0]
|
pyscf/agf2/chkfile.py
CHANGED
|
@@ -111,7 +111,7 @@ def load_agf2(chkfile):
|
|
|
111
111
|
def dump_agf2(agf2, chkfile=None, key='agf2',
|
|
112
112
|
gf=None, se=None, frozen=None, nmom=None,
|
|
113
113
|
mo_energy=None, mo_coeff=None, mo_occ=None):
|
|
114
|
-
''' Save the AGF2
|
|
114
|
+
''' Save the AGF2 calculation to a chkfile.
|
|
115
115
|
'''
|
|
116
116
|
|
|
117
117
|
if mpi_helper.rank != 0:
|
pyscf/ao2mo/outcore.py
CHANGED
|
@@ -487,15 +487,17 @@ def _load_from_h5g(h5group, row0, row1, out=None):
|
|
|
487
487
|
col1 = 0
|
|
488
488
|
for key in range(nkeys):
|
|
489
489
|
col0, col1 = col1, col1 + h5group[str(key)].shape[1]
|
|
490
|
-
|
|
491
|
-
|
|
490
|
+
if col1 > col0:
|
|
491
|
+
h5group[str(key)].read_direct(out, dest_sel=numpy.s_[:,col0:col1],
|
|
492
|
+
source_sel=numpy.s_[row0:row1])
|
|
492
493
|
else: # multiple components
|
|
493
494
|
out = numpy.ndarray((dat.shape[0], row1-row0, ncol), dat.dtype, buffer=out)
|
|
494
495
|
col1 = 0
|
|
495
496
|
for key in range(nkeys):
|
|
496
497
|
col0, col1 = col1, col1 + h5group[str(key)].shape[2]
|
|
497
|
-
|
|
498
|
-
|
|
498
|
+
if col1 > col0:
|
|
499
|
+
h5group[str(key)].read_direct(out, dest_sel=numpy.s_[:,:,col0:col1],
|
|
500
|
+
source_sel=numpy.s_[:,row0:row1])
|
|
499
501
|
return out
|
|
500
502
|
|
|
501
503
|
def _transpose_to_h5g(h5group, key, dat, blksize, chunks=None):
|
pyscf/cc/__init__.py
CHANGED
|
@@ -23,7 +23,7 @@ Simple usage::
|
|
|
23
23
|
>>> mf = scf.RHF(mol).run()
|
|
24
24
|
>>> cc.CCSD(mf).run()
|
|
25
25
|
|
|
26
|
-
:func:`cc.CCSD` returns an instance of CCSD class.
|
|
26
|
+
:func:`cc.CCSD` returns an instance of CCSD class. Following are parameters
|
|
27
27
|
to control CCSD calculation.
|
|
28
28
|
|
|
29
29
|
verbose : int
|
|
@@ -54,8 +54,8 @@ to control CCSD calculation.
|
|
|
54
54
|
|
|
55
55
|
Saved results
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
iterinfo : common.IterationInfo
|
|
58
|
+
Information about iteration (see pyscf.common.Iteration in detail)
|
|
59
59
|
e_tot : float
|
|
60
60
|
Total CCSD energy (HF + correlation)
|
|
61
61
|
t1, t2 :
|
|
@@ -216,3 +216,21 @@ def FNOCCSD(mf, thresh=1e-6, pct_occ=None, nvir_act=None, frozen=None):
|
|
|
216
216
|
return self
|
|
217
217
|
mycc._finalize = _finalize.__get__(mycc, mycc.__class__)
|
|
218
218
|
return mycc
|
|
219
|
+
|
|
220
|
+
def BCCD(mf, frozen=None, u=None, conv_tol_normu=1e-5, max_cycle=20, diis=True,
|
|
221
|
+
canonicalization=True):
|
|
222
|
+
from pyscf.cc.bccd import bccd_kernel_
|
|
223
|
+
from pyscf.lib import StreamObject
|
|
224
|
+
mycc = CCSD(mf, frozen=frozen)
|
|
225
|
+
|
|
226
|
+
class BCCD(mycc.__class__):
|
|
227
|
+
def kernel(self):
|
|
228
|
+
obj = self.view(mycc.__class__)
|
|
229
|
+
obj.conv_tol = 1e-3
|
|
230
|
+
obj.kernel()
|
|
231
|
+
bccd_kernel_(obj, u, conv_tol_normu, max_cycle, diis,
|
|
232
|
+
canonicalization, self.verbose)
|
|
233
|
+
self.__dict__.update(obj.__dict__)
|
|
234
|
+
return self.e_tot
|
|
235
|
+
|
|
236
|
+
return mycc.view(BCCD)
|
pyscf/cc/bccd.py
CHANGED
|
@@ -313,49 +313,3 @@ def bccd_kernel_(mycc, u=None, conv_tol_normu=1e-5, max_cycle=20, diis=True,
|
|
|
313
313
|
mycc.t2 = t2
|
|
314
314
|
|
|
315
315
|
return mycc
|
|
316
|
-
|
|
317
|
-
if __name__ == "__main__":
|
|
318
|
-
import pyscf
|
|
319
|
-
from pyscf import cc
|
|
320
|
-
|
|
321
|
-
np.set_printoptions(3, linewidth=1000, suppress=True)
|
|
322
|
-
mol = pyscf.M(
|
|
323
|
-
atom = 'H 0 0 0; F 0 0 1.1',
|
|
324
|
-
basis = 'ccpvdz',
|
|
325
|
-
verbose = 4,
|
|
326
|
-
spin = 0,
|
|
327
|
-
)
|
|
328
|
-
|
|
329
|
-
myhf = mol.HF()
|
|
330
|
-
myhf.kernel()
|
|
331
|
-
E_ref = myhf.e_tot
|
|
332
|
-
rdm1_mf = myhf.make_rdm1()
|
|
333
|
-
|
|
334
|
-
mycc = cc.CCSD(myhf, frozen=None)
|
|
335
|
-
#mycc.frozen = [0]
|
|
336
|
-
mycc.kernel()
|
|
337
|
-
mycc.conv_tol = 1e-3
|
|
338
|
-
|
|
339
|
-
mycc = bccd_kernel_(mycc, diis=True, verbose=4)
|
|
340
|
-
e_r = mycc.e_tot
|
|
341
|
-
e_ccsd_t = mycc.ccsd_t()
|
|
342
|
-
# PSI4 reference
|
|
343
|
-
assert abs(e_ccsd_t - -0.002625521337000) < 1e-5
|
|
344
|
-
|
|
345
|
-
print (la.norm(mycc.t1))
|
|
346
|
-
assert la.norm(mycc.t1) < 1e-5
|
|
347
|
-
|
|
348
|
-
myhf = mol.UHF()
|
|
349
|
-
myhf.kernel()
|
|
350
|
-
myucc = cc.CCSD(myhf, frozen=None)
|
|
351
|
-
myucc.frozen = [0]
|
|
352
|
-
myucc.kernel()
|
|
353
|
-
|
|
354
|
-
mybcc = bccd_kernel_(myucc)
|
|
355
|
-
e_u = mybcc.e_tot
|
|
356
|
-
|
|
357
|
-
mygcc = cc.addons.convert_to_gccsd(mycc)
|
|
358
|
-
mybcc = bccd_kernel_(mygcc)
|
|
359
|
-
e_g = mybcc.e_tot
|
|
360
|
-
print (abs(e_g - e_r))
|
|
361
|
-
assert abs(e_g - e_r) < 1e-6
|
pyscf/cc/ccsd.py
CHANGED
|
@@ -65,7 +65,8 @@ def kernel(mycc, eris=None, t1=None, t2=None, max_cycle=50, tol=1e-8,
|
|
|
65
65
|
else:
|
|
66
66
|
adiis = None
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
converged = False
|
|
69
|
+
mycc.cycles = 0
|
|
69
70
|
for istep in range(max_cycle):
|
|
70
71
|
t1new, t2new = mycc.update_amps(t1, t2, eris)
|
|
71
72
|
if callback is not None:
|
|
@@ -83,14 +84,15 @@ def kernel(mycc, eris=None, t1=None, t2=None, max_cycle=50, tol=1e-8,
|
|
|
83
84
|
t1new = t2new = None
|
|
84
85
|
t1, t2 = mycc.run_diis(t1, t2, istep, normt, eccsd-eold, adiis)
|
|
85
86
|
eold, eccsd = eccsd, mycc.energy(t1, t2, eris)
|
|
87
|
+
mycc.cycles = istep + 1
|
|
86
88
|
log.info('cycle = %d E_corr(%s) = %.15g dE = %.9g norm(t1,t2) = %.6g',
|
|
87
89
|
istep+1, name, eccsd, eccsd - eold, normt)
|
|
88
90
|
cput1 = log.timer(f'{name} iter', *cput1)
|
|
89
91
|
if abs(eccsd-eold) < tol and normt < tolnormt:
|
|
90
|
-
|
|
92
|
+
converged = True
|
|
91
93
|
break
|
|
92
94
|
log.timer(name, *cput0)
|
|
93
|
-
return
|
|
95
|
+
return converged, eccsd, t1, t2
|
|
94
96
|
|
|
95
97
|
|
|
96
98
|
def update_amps(mycc, t1, t2, eris):
|
|
@@ -582,7 +584,7 @@ def _contract_s4vvvv_t2(mycc, mol, vvvv, t2, out=None, verbose=None):
|
|
|
582
584
|
tril2sq = lib.square_mat_in_trilu_indices(nvira)
|
|
583
585
|
loadbuf = numpy.empty((blksize,blksize,nvirb,nvirb))
|
|
584
586
|
|
|
585
|
-
slices =
|
|
587
|
+
slices = list(lib.prange(0, nvira, blksize))
|
|
586
588
|
for istep, wwbuf in enumerate(fmap(load, lib.prange(0, nvira, blksize))):
|
|
587
589
|
i0, i1 = slices[istep]
|
|
588
590
|
off0 = i0*(i0+1)//2
|
|
@@ -870,7 +872,7 @@ class CCSDBase(lib.StreamObject):
|
|
|
870
872
|
incore_complete : bool
|
|
871
873
|
Avoid all I/O (also for DIIS). Default is False.
|
|
872
874
|
level_shift : float
|
|
873
|
-
A shift on virtual orbital energies to
|
|
875
|
+
A shift on virtual orbital energies to stabilize the CCSD iteration
|
|
874
876
|
frozen : int or list
|
|
875
877
|
If integer is given, the inner-most orbitals are frozen from CC
|
|
876
878
|
amplitudes. Given the orbital indices (0-based) in a list, both
|
|
@@ -891,10 +893,10 @@ class CCSDBase(lib.StreamObject):
|
|
|
891
893
|
callback function can access all local variables in the current
|
|
892
894
|
environment.
|
|
893
895
|
|
|
894
|
-
Saved results
|
|
896
|
+
Saved results:
|
|
895
897
|
|
|
896
898
|
converged : bool
|
|
897
|
-
CCSD converged
|
|
899
|
+
Whether the CCSD iteration converged
|
|
898
900
|
e_corr : float
|
|
899
901
|
CCSD correlation correction
|
|
900
902
|
e_tot : float
|
|
@@ -903,6 +905,8 @@ class CCSDBase(lib.StreamObject):
|
|
|
903
905
|
T amplitudes t1[i,a], t2[i,j,a,b] (i,j in occ, a,b in virt)
|
|
904
906
|
l1, l2 :
|
|
905
907
|
Lambda amplitudes l1[i,a], l2[i,j,a,b] (i,j in occ, a,b in virt)
|
|
908
|
+
cycles : int
|
|
909
|
+
The number of iteration cycles performed
|
|
906
910
|
'''
|
|
907
911
|
|
|
908
912
|
max_cycle = getattr(__config__, 'cc_ccsd_CCSD_max_cycle', 50)
|
|
@@ -929,7 +933,7 @@ class CCSDBase(lib.StreamObject):
|
|
|
929
933
|
'diis_start_cycle', 'diis_start_energy_diff', 'direct',
|
|
930
934
|
'async_io', 'incore_complete', 'cc2', 'callback',
|
|
931
935
|
'mol', 'verbose', 'stdout', 'frozen', 'level_shift',
|
|
932
|
-
'mo_coeff', 'mo_occ', '
|
|
936
|
+
'mo_coeff', 'mo_occ', 'cycles', 'converged_lambda', 'emp2', 'e_hf',
|
|
933
937
|
'e_corr', 't1', 't2', 'l1', 'l2', 'chkfile',
|
|
934
938
|
}
|
|
935
939
|
|
|
@@ -959,6 +963,7 @@ class CCSDBase(lib.StreamObject):
|
|
|
959
963
|
self.mo_coeff = mo_coeff
|
|
960
964
|
self.mo_occ = mo_occ
|
|
961
965
|
self.converged = False
|
|
966
|
+
self.cycles = None
|
|
962
967
|
self.converged_lambda = False
|
|
963
968
|
self.emp2 = None
|
|
964
969
|
self.e_hf = None
|
|
@@ -971,6 +976,9 @@ class CCSDBase(lib.StreamObject):
|
|
|
971
976
|
self._nmo = None
|
|
972
977
|
self.chkfile = mf.chkfile
|
|
973
978
|
|
|
979
|
+
__getstate__, __setstate__ = lib.generate_pickle_methods(
|
|
980
|
+
excludes=('chkfile', 'callback'))
|
|
981
|
+
|
|
974
982
|
@property
|
|
975
983
|
def ecc(self):
|
|
976
984
|
return self.e_corr
|
pyscf/cc/uccsd.py
CHANGED
|
@@ -398,7 +398,7 @@ def vector_to_amplitudes(vector, nmo, nocc):
|
|
|
398
398
|
size = nov + nocc*(nocc-1)//2*nvir*(nvir-1)//2
|
|
399
399
|
if vector.size == size:
|
|
400
400
|
#return ccsd.vector_to_amplitudes_s4(vector, nmo, nocc)
|
|
401
|
-
raise RuntimeError('Input vector is GCCSD
|
|
401
|
+
raise RuntimeError('Input vector is GCCSD vector')
|
|
402
402
|
else:
|
|
403
403
|
sizea = nocca * nvira + nocca*(nocca-1)//2*nvira*(nvira-1)//2
|
|
404
404
|
sizeb = noccb * nvirb + noccb*(noccb-1)//2*nvirb*(nvirb-1)//2
|
pyscf/data/elements.py
CHANGED
|
@@ -827,7 +827,7 @@ NRSRHFS_CONFIGURATION = [
|
|
|
827
827
|
[14,36,40,28], #118 Og
|
|
828
828
|
]
|
|
829
829
|
|
|
830
|
-
# This is No. of shells, not the atomic
|
|
830
|
+
# This is No. of shells, not the atomic configurations
|
|
831
831
|
# core core+valence
|
|
832
832
|
# core+valence = lambda nuc, l: \
|
|
833
833
|
# int(numpy.ceil(pyscf.lib.parameters.ELEMENTS[nuc][2][l]/(4*l+2.)))
|
pyscf/df/__init__.py
CHANGED
|
@@ -34,7 +34,8 @@ Simple usage::
|
|
|
34
34
|
from . import incore
|
|
35
35
|
from . import outcore
|
|
36
36
|
from . import addons
|
|
37
|
-
from .addons import load, aug_etb,
|
|
37
|
+
from .addons import (load, aug_etb, autoaux, autoabs,
|
|
38
|
+
DEFAULT_AUXBASIS, make_auxbasis, make_auxmol)
|
|
38
39
|
from .df import DF, GDF, DF4C, GDF4C
|
|
39
40
|
|
|
40
41
|
from . import r_incore
|
pyscf/df/addons.py
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
# Author: Qiming Sun <osirpt.sun@gmail.com>
|
|
17
17
|
#
|
|
18
18
|
|
|
19
|
+
|
|
19
20
|
import sys
|
|
20
21
|
import numpy
|
|
21
22
|
from pyscf.lib import logger
|
|
@@ -23,12 +24,18 @@ from pyscf import gto
|
|
|
23
24
|
from pyscf import ao2mo
|
|
24
25
|
from pyscf.data import elements
|
|
25
26
|
from pyscf.lib.exceptions import BasisNotFoundError
|
|
27
|
+
from pyscf.df.autoaux import autoaux, autoabs
|
|
26
28
|
from pyscf import __config__
|
|
27
29
|
|
|
28
30
|
DFBASIS = getattr(__config__, 'df_addons_aug_etb_beta', 'weigend')
|
|
29
31
|
ETB_BETA = getattr(__config__, 'df_addons_aug_dfbasis', 2.0)
|
|
30
32
|
FIRST_ETB_ELEMENT = getattr(__config__, 'df_addons_aug_start_at', 36) # 'Rb'
|
|
31
33
|
|
|
34
|
+
# TODO: Switch to other default scheme for auxiliary basis generation.
|
|
35
|
+
# The auxiliary basis set generated by version 2.6 (and earlier) lacks compact
|
|
36
|
+
# functions. It may cause higher errors in ERI integrals.
|
|
37
|
+
USE_VERSION_26_AUXBASIS = True
|
|
38
|
+
|
|
32
39
|
# Obtained from http://www.psicode.org/psi4manual/master/basissets_byfamily.html
|
|
33
40
|
DEFAULT_AUXBASIS = {
|
|
34
41
|
# AO basis JK-fit MP2-fit
|
|
@@ -72,6 +79,58 @@ class load(ao2mo.load):
|
|
|
72
79
|
def __init__(self, eri, dataname='j3c'):
|
|
73
80
|
ao2mo.load.__init__(self, eri, dataname)
|
|
74
81
|
|
|
82
|
+
def _aug_etb_element(nuc_charge, basis, beta):
|
|
83
|
+
l_max = max(b[0] for b in basis)
|
|
84
|
+
emin_by_l = [1e99] * (l_max+1)
|
|
85
|
+
emax_by_l = [0] * (l_max+1)
|
|
86
|
+
for b in basis:
|
|
87
|
+
l = b[0]
|
|
88
|
+
if isinstance(b[1], int):
|
|
89
|
+
e_c = numpy.array(b[2:])
|
|
90
|
+
else:
|
|
91
|
+
e_c = numpy.array(b[1:])
|
|
92
|
+
es = e_c[:,0]
|
|
93
|
+
cs = e_c[:,1:]
|
|
94
|
+
es = es[abs(cs).max(axis=1) > 1e-3]
|
|
95
|
+
emax_by_l[l] = max(es.max(), emax_by_l[l])
|
|
96
|
+
emin_by_l[l] = min(es.min(), emin_by_l[l])
|
|
97
|
+
|
|
98
|
+
conf = elements.CONFIGURATION[nuc_charge]
|
|
99
|
+
# 1: H - Be, 2: B - Ca, 3: Sc - La, 4: Ce -
|
|
100
|
+
max_shells = 4 - conf.count(0)
|
|
101
|
+
|
|
102
|
+
if USE_VERSION_26_AUXBASIS:
|
|
103
|
+
# This is the method that version 2.6 (and earlier) generates auxiliary
|
|
104
|
+
# basis. It estimates the exponents ranges by geometric average.
|
|
105
|
+
# This method is not recommended because it tends to generate diffuse
|
|
106
|
+
# functions. Important compact functions might be improperly excluded.
|
|
107
|
+
l_max = min(l_max, max_shells)
|
|
108
|
+
l_max_aux = l_max * 2
|
|
109
|
+
l_max1 = l_max + 1
|
|
110
|
+
emin_by_l = numpy.array(emin_by_l[:l_max1])
|
|
111
|
+
emax_by_l = numpy.array(emax_by_l[:l_max1])
|
|
112
|
+
emax = (emax_by_l[:,None] * emax_by_l) ** .5 * 2
|
|
113
|
+
emin = (emin_by_l[:,None] * emin_by_l) ** .5 * 2
|
|
114
|
+
else:
|
|
115
|
+
# Using normal average, more auxiliary functions, especially compact
|
|
116
|
+
# functions, will be generated.
|
|
117
|
+
l_max_aux = min(l_max, max_shells) * 2
|
|
118
|
+
l_max1 = l_max + 1
|
|
119
|
+
emin_by_l = numpy.array(emin_by_l)
|
|
120
|
+
emax_by_l = numpy.array(emax_by_l)
|
|
121
|
+
emax = emax_by_l[:,None] + emax_by_l
|
|
122
|
+
emin = emin_by_l[:,None] + emin_by_l
|
|
123
|
+
|
|
124
|
+
liljsum = numpy.arange(l_max1)[:,None] + numpy.arange(l_max1)
|
|
125
|
+
emax_by_l = numpy.array([emax[liljsum==ll].max() for ll in range(l_max_aux+1)])
|
|
126
|
+
emin_by_l = numpy.array([emin[liljsum==ll].min() for ll in range(l_max_aux+1)])
|
|
127
|
+
|
|
128
|
+
ns = numpy.log((emax_by_l+emin_by_l)/emin_by_l) / numpy.log(beta)
|
|
129
|
+
etb = []
|
|
130
|
+
for l, n in enumerate(numpy.ceil(ns).astype(int)):
|
|
131
|
+
if n > 0:
|
|
132
|
+
etb.append((l, n, emin_by_l[l], beta))
|
|
133
|
+
return etb
|
|
75
134
|
|
|
76
135
|
def aug_etb_for_dfbasis(mol, dfbasis=DFBASIS, beta=ETB_BETA,
|
|
77
136
|
start_at=FIRST_ETB_ELEMENT):
|
|
@@ -86,50 +145,14 @@ def aug_etb_for_dfbasis(mol, dfbasis=DFBASIS, beta=ETB_BETA,
|
|
|
86
145
|
nuc_charge = gto.charge(symb)
|
|
87
146
|
if nuc_charge < nuc_start:
|
|
88
147
|
newbasis[symb] = dfbasis
|
|
89
|
-
#?elif symb in mol._ecp:
|
|
90
148
|
else:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
emin_by_l = [1e99] * 8
|
|
94
|
-
emax_by_l = [0] * 8
|
|
95
|
-
l_max = 0
|
|
96
|
-
for b in mol._basis[symb]:
|
|
97
|
-
l = b[0]
|
|
98
|
-
l_max = max(l_max, l)
|
|
99
|
-
if l >= max_shells+1:
|
|
100
|
-
continue
|
|
101
|
-
|
|
102
|
-
if isinstance(b[1], int):
|
|
103
|
-
e_c = numpy.array(b[2:])
|
|
104
|
-
else:
|
|
105
|
-
e_c = numpy.array(b[1:])
|
|
106
|
-
es = e_c[:,0]
|
|
107
|
-
cs = e_c[:,1:]
|
|
108
|
-
es = es[abs(cs).max(axis=1) > 1e-3]
|
|
109
|
-
emax_by_l[l] = max(es.max(), emax_by_l[l])
|
|
110
|
-
emin_by_l[l] = min(es.min(), emin_by_l[l])
|
|
111
|
-
|
|
112
|
-
l_max1 = l_max + 1
|
|
113
|
-
emin_by_l = numpy.array(emin_by_l[:l_max1])
|
|
114
|
-
emax_by_l = numpy.array(emax_by_l[:l_max1])
|
|
115
|
-
|
|
116
|
-
# Estimate the exponents ranges by geometric average
|
|
117
|
-
emax = numpy.sqrt(numpy.einsum('i,j->ij', emax_by_l, emax_by_l))
|
|
118
|
-
emin = numpy.sqrt(numpy.einsum('i,j->ij', emin_by_l, emin_by_l))
|
|
119
|
-
liljsum = numpy.arange(l_max1)[:,None] + numpy.arange(l_max1)
|
|
120
|
-
emax_by_l = [emax[liljsum==ll].max() for ll in range(l_max1*2-1)]
|
|
121
|
-
emin_by_l = [emin[liljsum==ll].min() for ll in range(l_max1*2-1)]
|
|
122
|
-
# Tune emin and emax
|
|
123
|
-
emin_by_l = numpy.array(emin_by_l) * 2 # *2 for alpha+alpha on same center
|
|
124
|
-
emax_by_l = numpy.array(emax_by_l) * 2 #/ (numpy.arange(l_max1*2-1)*.5+1)
|
|
125
|
-
|
|
126
|
-
ns = numpy.log((emax_by_l+emin_by_l)/emin_by_l) / numpy.log(beta)
|
|
127
|
-
etb = []
|
|
128
|
-
for l, n in enumerate(numpy.ceil(ns).astype(int)):
|
|
129
|
-
if n > 0:
|
|
130
|
-
etb.append((l, n, emin_by_l[l], beta))
|
|
149
|
+
basis = mol._basis[symb]
|
|
150
|
+
etb = _aug_etb_element(nuc_charge, basis, beta)
|
|
131
151
|
if etb:
|
|
132
152
|
newbasis[symb] = gto.expand_etbs(etb)
|
|
153
|
+
for l, n, emin, beta in etb:
|
|
154
|
+
logger.info(mol, 'l = %d, exps = %s * %g^n for n = 0..%d',
|
|
155
|
+
l, emin, beta, n-1)
|
|
133
156
|
else:
|
|
134
157
|
raise RuntimeError(f'Failed to generate even-tempered auxbasis for {symb}')
|
|
135
158
|
|
|
@@ -182,12 +205,13 @@ def make_auxbasis(mol, mp2fit=False):
|
|
|
182
205
|
auxbasis.update(auxdefault)
|
|
183
206
|
aux_etb = set(auxbasis) - set(auxdefault)
|
|
184
207
|
if aux_etb:
|
|
185
|
-
logger.
|
|
208
|
+
logger.warn(mol, 'Even tempered Gaussians are generated as '
|
|
186
209
|
'DF auxbasis for %s', ' '.join(aux_etb))
|
|
187
210
|
for k in aux_etb:
|
|
188
211
|
logger.debug(mol, ' ETB auxbasis for %s %s', k, auxbasis[k])
|
|
189
212
|
return auxbasis
|
|
190
213
|
|
|
214
|
+
# TODO: add auxbasis keyword etb and auto
|
|
191
215
|
def make_auxmol(mol, auxbasis=None):
|
|
192
216
|
'''Generate a fake Mole object which uses the density fitting auxbasis as
|
|
193
217
|
the basis sets. If auxbasis is not specified, the optimized auxiliary fitting
|
|
@@ -198,26 +222,30 @@ def make_auxmol(mol, auxbasis=None):
|
|
|
198
222
|
even-tempered Gaussian basis set will be generated.
|
|
199
223
|
|
|
200
224
|
See also the paper JCTC, 13, 554 about generating auxiliary fitting basis.
|
|
225
|
+
|
|
226
|
+
Kwargs:
|
|
227
|
+
auxbasis : str, list, tuple
|
|
228
|
+
Similar to the input of orbital basis in Mole object.
|
|
201
229
|
'''
|
|
202
230
|
pmol = mol.copy(deep=False)
|
|
203
231
|
|
|
204
232
|
if auxbasis is None:
|
|
205
233
|
auxbasis = make_auxbasis(mol)
|
|
206
|
-
elif isinstance(auxbasis, str) and '+etb' in auxbasis:
|
|
207
|
-
dfbasis = auxbasis[:-4]
|
|
208
|
-
auxbasis = aug_etb_for_dfbasis(mol, dfbasis)
|
|
209
234
|
pmol.basis = auxbasis
|
|
210
235
|
|
|
211
236
|
if isinstance(auxbasis, (str, list, tuple)):
|
|
212
237
|
uniq_atoms = {a[0] for a in mol._atom}
|
|
213
238
|
_basis = {a: auxbasis for a in uniq_atoms}
|
|
214
|
-
elif 'default' in auxbasis:
|
|
215
|
-
uniq_atoms = {a[0] for a in mol._atom}
|
|
216
|
-
_basis = {a: auxbasis['default'] for a in uniq_atoms}
|
|
217
|
-
_basis.update(auxbasis)
|
|
218
|
-
del (_basis['default'])
|
|
219
239
|
else:
|
|
220
|
-
|
|
240
|
+
assert isinstance(auxbasis, dict)
|
|
241
|
+
if 'default' in auxbasis:
|
|
242
|
+
uniq_atoms = {a[0] for a in mol._atom}
|
|
243
|
+
_basis = {a: auxbasis['default'] for a in uniq_atoms}
|
|
244
|
+
_basis.update(auxbasis)
|
|
245
|
+
del (_basis['default'])
|
|
246
|
+
else:
|
|
247
|
+
_basis = auxbasis
|
|
248
|
+
|
|
221
249
|
pmol._basis = pmol.format_basis(_basis)
|
|
222
250
|
|
|
223
251
|
# Note: To pass parameters like gauge origin, rsh-omega to auxmol,
|