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/df/autoaux.py
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# Copyright 2024 The PySCF Developers. All Rights Reserved.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
#
|
|
16
|
+
|
|
17
|
+
'''
|
|
18
|
+
The AutoAux algorithm by ORCA
|
|
19
|
+
|
|
20
|
+
Ref:
|
|
21
|
+
JCTC, 13 (2016), 554
|
|
22
|
+
'''
|
|
23
|
+
|
|
24
|
+
from math import factorial
|
|
25
|
+
import numpy as np
|
|
26
|
+
from pyscf import gto
|
|
27
|
+
|
|
28
|
+
F_LAUX = np.array([20 , 7.0, 4.0, 4.0, 3.5, 2.5, 2.0, 2.0])
|
|
29
|
+
BETA_BIG = np.array([1.8, 2.0, 2.2, 2.2, 2.2, 2.3, 3.0, 3.0])
|
|
30
|
+
BETA_SMALL = 1.8
|
|
31
|
+
|
|
32
|
+
def _primitive_emin_emax(basis):
|
|
33
|
+
l_max = max(b[0] for b in basis)
|
|
34
|
+
emin_by_l = [1e99] * (l_max+1)
|
|
35
|
+
emax_by_l = [0] * (l_max+1)
|
|
36
|
+
e_eff_by_l = [0] * (l_max+1)
|
|
37
|
+
|
|
38
|
+
for b in basis:
|
|
39
|
+
l = b[0]
|
|
40
|
+
if isinstance(b[1], int):
|
|
41
|
+
e_c = np.array(b[2:])
|
|
42
|
+
else:
|
|
43
|
+
e_c = np.array(b[1:])
|
|
44
|
+
es = e_c[:,0]
|
|
45
|
+
emax_by_l[l] = max(es.max(), emax_by_l[l])
|
|
46
|
+
emin_by_l[l] = min(es.min(), emin_by_l[l])
|
|
47
|
+
|
|
48
|
+
cs = e_c[:,1:]
|
|
49
|
+
cs = np.einsum('pi,p->pi', cs, gto.gto_norm(l, es)) # normalize GTOs
|
|
50
|
+
cs = gto.mole._nomalize_contracted_ao(l, es, cs) # prefactors in r_ints
|
|
51
|
+
ee = es[:,None] + es
|
|
52
|
+
r_ints = gto.gaussian_int(l*2+3, ee) # \int \chi^2 r dr
|
|
53
|
+
r_exp = np.einsum('pi,pq,qi->i', cs, r_ints, cs)
|
|
54
|
+
|
|
55
|
+
k = 2**(2*l+1) * factorial(l+1)**2 / factorial(2*l+2)
|
|
56
|
+
# Eq (9) in the paper, e_eff = 2 * k**2 / (np.pi * r_exp) is a typo.
|
|
57
|
+
# See also https://github.com/MolSSI-BSE/basis_set_exchange/issues/317
|
|
58
|
+
# For primitive functions, following expression leads to
|
|
59
|
+
# e_eff = exponent of the basis
|
|
60
|
+
e_eff = 2 * k**2 / (np.pi * r_exp**2)
|
|
61
|
+
# For primitive functions, e_eff may be slightly different to the
|
|
62
|
+
# exponent due to the rounding errors in gaussian_int function.
|
|
63
|
+
# When a particular shell has only one primitive function, one auxiliary
|
|
64
|
+
# function should be generated. This error can introduce an additional
|
|
65
|
+
# auxiliary function.
|
|
66
|
+
# Slightly reduce e_eff to remove the extra auxiliary functions.
|
|
67
|
+
e_eff -= 1e-8
|
|
68
|
+
e_eff_by_l[l] = max(e_eff.max(), e_eff_by_l[l])
|
|
69
|
+
return np.array(emax_by_l), np.array(emin_by_l), np.array(e_eff_by_l)
|
|
70
|
+
|
|
71
|
+
def _auto_aux_element(Z, basis, ecp_core=0):
|
|
72
|
+
a_max_by_l, a_min_by_l, a_eff_by_l = _primitive_emin_emax(basis)
|
|
73
|
+
a_min_prim = a_min_by_l[:,None] + a_min_by_l
|
|
74
|
+
a_max_prim = a_max_by_l[:,None] + a_max_by_l
|
|
75
|
+
a_max_aux = a_eff_by_l[:,None] + a_eff_by_l
|
|
76
|
+
|
|
77
|
+
l_max1 = a_max_by_l.size
|
|
78
|
+
l_max = l_max1 - 1
|
|
79
|
+
# TODO: handle ECP
|
|
80
|
+
if Z <= 2:
|
|
81
|
+
l_val = 0
|
|
82
|
+
elif Z <= 20:
|
|
83
|
+
l_val = 1
|
|
84
|
+
elif Z <= 56:
|
|
85
|
+
l_val = 2
|
|
86
|
+
else:
|
|
87
|
+
l_val = 3
|
|
88
|
+
l_inc = 1
|
|
89
|
+
if Z > 18:
|
|
90
|
+
l_inc = 2
|
|
91
|
+
l_max_aux = min(max(l_val*2, l_max+l_inc), l_max*2)
|
|
92
|
+
|
|
93
|
+
liljsum = np.arange(l_max1)[:,None] + np.arange(l_max1)
|
|
94
|
+
liljsub = abs(np.arange(l_max1)[:,None] - np.arange(l_max1))
|
|
95
|
+
a_min_by_l = [a_min_prim[(liljsub<=ll) & (ll<=liljsum)].min() for ll in range(l_max_aux+1)]
|
|
96
|
+
a_max_by_l = [a_max_prim[(liljsub<=ll) & (ll<=liljsum)].max() for ll in range(l_max_aux+1)]
|
|
97
|
+
a_aux_by_l = [a_max_aux [(liljsub<=ll) & (ll<=liljsum)].max() for ll in range(l_max_aux+1)]
|
|
98
|
+
|
|
99
|
+
a_max_adjust = [min(F_LAUX[l] * a_aux_by_l[l], a_max_by_l[l])
|
|
100
|
+
for l in range(l_val*2+1)]
|
|
101
|
+
a_max_adjust = a_max_adjust + a_aux_by_l[l_val*2+1 : l_max_aux+1]
|
|
102
|
+
|
|
103
|
+
emin = np.array(a_min_by_l)
|
|
104
|
+
emax = np.array(a_max_adjust)
|
|
105
|
+
|
|
106
|
+
ns_small = np.log(a_max_adjust[:l_val*2+1] / emin[:l_val*2+1]) / np.log(BETA_SMALL)
|
|
107
|
+
etb = []
|
|
108
|
+
# ns_small+1 to ensure the largest exponent in etb > emax
|
|
109
|
+
for l, n in enumerate(np.ceil(ns_small).astype(int) + 1):
|
|
110
|
+
if n > 0:
|
|
111
|
+
etb.append((l, n, emin[l], BETA_SMALL))
|
|
112
|
+
|
|
113
|
+
if l_max_aux > l_val*2:
|
|
114
|
+
ns_big = (np.log(emax[l_val*2+1:] / emin[l_val*2+1:])
|
|
115
|
+
/ np.log(BETA_BIG[l_val*2+1:l_max_aux+1]))
|
|
116
|
+
for l, n in enumerate(np.ceil(ns_big).astype(int) + 1):
|
|
117
|
+
if n > 0:
|
|
118
|
+
l = l + l_val*2+1
|
|
119
|
+
beta = BETA_BIG[l]
|
|
120
|
+
etb.append((l, n, emin[l], beta))
|
|
121
|
+
return etb
|
|
122
|
+
|
|
123
|
+
def autoaux(mol):
|
|
124
|
+
'''
|
|
125
|
+
Create an auxiliary basis set for the given orbital basis set using
|
|
126
|
+
the Auto-Aux algorithm.
|
|
127
|
+
|
|
128
|
+
See also: G. L. Stoychev, A. A. Auer, and F. Neese
|
|
129
|
+
Automatic Generation of Auxiliary Basis Sets
|
|
130
|
+
J. Chem. Theory Comput. 13, 554 (2017)
|
|
131
|
+
http://doi.org/10.1021/acs.jctc.6b01041
|
|
132
|
+
'''
|
|
133
|
+
from pyscf.gto.basis import bse
|
|
134
|
+
|
|
135
|
+
def expand(symb):
|
|
136
|
+
Z = gto.charge(symb)
|
|
137
|
+
etb = _auto_aux_element(Z, mol._basis[symb])
|
|
138
|
+
if etb:
|
|
139
|
+
return gto.expand_etbs(etb)
|
|
140
|
+
raise RuntimeError(f'Failed to generate even-tempered auxbasis for {symb}')
|
|
141
|
+
|
|
142
|
+
uniq_atoms = {a[0] for a in mol._atom}
|
|
143
|
+
if bse.basis_set_exchange is None:
|
|
144
|
+
return {symb: expand(symb) for symb in uniq_atoms}
|
|
145
|
+
|
|
146
|
+
if isinstance(mol.basis, str):
|
|
147
|
+
try:
|
|
148
|
+
elements = [gto.charge(symb) for symb in uniq_atoms]
|
|
149
|
+
newbasis = bse.autoaux(mol.basis, elements)
|
|
150
|
+
except KeyError:
|
|
151
|
+
newbasis = {symb: expand(symb) for symb in uniq_atoms}
|
|
152
|
+
else:
|
|
153
|
+
newbasis = {}
|
|
154
|
+
for symb in uniq_atoms:
|
|
155
|
+
if symb in mol.basis and isinstance(mol.basis[symb], str):
|
|
156
|
+
try:
|
|
157
|
+
auxbs = bse.autoaux(mol.basis[symb], gto.charge(symb))
|
|
158
|
+
newbasis[symb] = next(iter(auxbs.values()))
|
|
159
|
+
except KeyError:
|
|
160
|
+
newbasis[symb] = expand(symb)
|
|
161
|
+
else:
|
|
162
|
+
newbasis[symb] = expand(symb)
|
|
163
|
+
return newbasis
|
|
164
|
+
|
|
165
|
+
def autoabs(mol):
|
|
166
|
+
'''
|
|
167
|
+
Create a Coulomb fitting basis set for the given orbital basis set.
|
|
168
|
+
See also:
|
|
169
|
+
R. Yang, A. P. Rendell, and M. J. Frisch
|
|
170
|
+
Automatically generated Coulomb fitting basis sets: Design and accuracy for systems containing H to Kr
|
|
171
|
+
J. Chem. Phys. 127, 074102 (2007)
|
|
172
|
+
http://doi.org/10.1063/1.2752807
|
|
173
|
+
'''
|
|
174
|
+
from pyscf.gto.basis import bse
|
|
175
|
+
if bse is None:
|
|
176
|
+
print('Package basis-set-exchange not available')
|
|
177
|
+
raise ImportError
|
|
178
|
+
|
|
179
|
+
uniq_atoms = {a[0] for a in mol._atom}
|
|
180
|
+
if isinstance(mol.basis, str):
|
|
181
|
+
elements = [gto.charge(symb) for symb in uniq_atoms]
|
|
182
|
+
newbasis = bse.autoabs(mol.basis, elements)
|
|
183
|
+
else:
|
|
184
|
+
newbasis = {}
|
|
185
|
+
for symb in uniq_atoms:
|
|
186
|
+
if symb in mol.basis and isinstance(mol.basis[symb], str):
|
|
187
|
+
auxbs = bse.autoabs(mol.basis[symb], gto.charge(symb))
|
|
188
|
+
newbasis[symb] = next(iter(auxbs.values()))
|
|
189
|
+
else:
|
|
190
|
+
raise NotImplementedError
|
|
191
|
+
return newbasis
|
pyscf/df/df.py
CHANGED
|
@@ -98,6 +98,10 @@ class DF(lib.StreamObject):
|
|
|
98
98
|
self._vjopt = None
|
|
99
99
|
self._rsh_df = {} # Range separated Coulomb DF objects
|
|
100
100
|
|
|
101
|
+
__getstate__, __setstate__ = lib.generate_pickle_methods(
|
|
102
|
+
excludes=('_cderi_to_save', '_cderi', '_vjopt', '_rsh_df'),
|
|
103
|
+
reset_state=True)
|
|
104
|
+
|
|
101
105
|
@property
|
|
102
106
|
def auxbasis(self):
|
|
103
107
|
return self._auxbasis
|
|
@@ -166,7 +170,7 @@ class DF(lib.StreamObject):
|
|
|
166
170
|
max_memory=max_memory, verbose=log)
|
|
167
171
|
else:
|
|
168
172
|
# Store DF tensor in blocks. This is to reduce the
|
|
169
|
-
#
|
|
173
|
+
# initialization overhead
|
|
170
174
|
outcore.cholesky_eri_b(mol, cderi, dataname=self._dataname,
|
|
171
175
|
int3c=int3c, int2c=int2c, auxmol=auxmol,
|
|
172
176
|
max_memory=max_memory, verbose=log)
|
pyscf/df/grad/casscf.py
CHANGED
|
@@ -227,44 +227,3 @@ class Gradients(casci_grad.Gradients):
|
|
|
227
227
|
to_gpu = lib.to_gpu
|
|
228
228
|
|
|
229
229
|
Grad = Gradients
|
|
230
|
-
|
|
231
|
-
#from pyscf import mcscf
|
|
232
|
-
#mcscf.mc1step.CASSCF.Gradients = lib.class_as_method(Gradients)
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
if __name__ == '__main__':
|
|
236
|
-
from pyscf import scf
|
|
237
|
-
from pyscf import mcscf
|
|
238
|
-
from pyscf import df
|
|
239
|
-
#from pyscf.grad import numeric
|
|
240
|
-
|
|
241
|
-
mol = gto.Mole()
|
|
242
|
-
mol.atom = 'N 0 0 0; N 0 0 1.2; H 1 1 0; H 1 1 1.2'
|
|
243
|
-
mol.basis = '631g'
|
|
244
|
-
mol.build()
|
|
245
|
-
aux = df.aug_etb (mol)
|
|
246
|
-
mf = scf.RHF(mol).density_fit (auxbasis=aux).run()
|
|
247
|
-
mc = mcscf.CASSCF(mf, 4, 4).run()
|
|
248
|
-
mc.conv_tol = 1e-10
|
|
249
|
-
de = Gradients (mc).kernel()
|
|
250
|
-
#de_num = numeric.Gradients (mc).kernel ()
|
|
251
|
-
#print(lib.finger(de) - 0.019602220578635747)
|
|
252
|
-
#print(lib.finger(de) - lib.finger (de_num))
|
|
253
|
-
|
|
254
|
-
mol = gto.Mole()
|
|
255
|
-
mol.verbose = 0
|
|
256
|
-
mol.atom = 'N 0 0 0; N 0 0 1.2'
|
|
257
|
-
mol.basis = 'sto3g'
|
|
258
|
-
mol.build()
|
|
259
|
-
mf = scf.RHF(mol).density_fit (auxbasis=aux).run()
|
|
260
|
-
mc = mcscf.CASSCF(mf, 4, 4)
|
|
261
|
-
mc.conv_tol = 1e-10
|
|
262
|
-
mc.kernel ()
|
|
263
|
-
de = Gradients (mc).kernel()
|
|
264
|
-
|
|
265
|
-
mcs = mc.as_scanner()
|
|
266
|
-
mol.set_geom_('N 0 0 0; N 0 0 1.201')
|
|
267
|
-
e1 = mcs(mol)
|
|
268
|
-
mol.set_geom_('N 0 0 0; N 0 0 1.199')
|
|
269
|
-
e2 = mcs(mol)
|
|
270
|
-
print(de[1,2], (e1-e2)/0.002*lib.param.BOHR)
|
pyscf/df/hessian/rhf.py
CHANGED
|
@@ -368,16 +368,8 @@ def make_h1(hessobj, mo_coeff, mo_occ, chkfile=None, atmlst=None, verbose=None):
|
|
|
368
368
|
for ia, h1, vj1, vk1 in _gen_jk(hessobj, mo_coeff, mo_occ, chkfile,
|
|
369
369
|
atmlst, verbose, True):
|
|
370
370
|
h1 += vj1 - vk1 * .5
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
h1ao[ia] = h1
|
|
374
|
-
else:
|
|
375
|
-
key = 'scf_f1ao/%d' % ia
|
|
376
|
-
lib.chkfile.save(chkfile, key, h1)
|
|
377
|
-
if chkfile is None:
|
|
378
|
-
return h1ao
|
|
379
|
-
else:
|
|
380
|
-
return chkfile
|
|
371
|
+
h1ao[ia] = h1
|
|
372
|
+
return h1ao
|
|
381
373
|
|
|
382
374
|
def _gen_jk(hessobj, mo_coeff, mo_occ, chkfile=None, atmlst=None,
|
|
383
375
|
verbose=None, with_k=True):
|
pyscf/df/hessian/rks.py
CHANGED
|
@@ -109,13 +109,7 @@ def make_h1(hessobj, mo_coeff, mo_occ, chkfile=None, atmlst=None, verbose=None):
|
|
|
109
109
|
for ia, h1, vj1, vk1 in df_rhf_hess._gen_jk(
|
|
110
110
|
hessobj, mo_coeff, mo_occ, chkfile, atmlst, verbose):
|
|
111
111
|
h1ao[ia] -= .5 * (alpha - hyb) * vk1
|
|
112
|
-
|
|
113
|
-
if chkfile is None:
|
|
114
|
-
return h1ao
|
|
115
|
-
else:
|
|
116
|
-
for ia in atmlst:
|
|
117
|
-
lib.chkfile.save(chkfile, 'scf_f1ao/%d'%ia, h1ao[ia])
|
|
118
|
-
return chkfile
|
|
112
|
+
return h1ao
|
|
119
113
|
|
|
120
114
|
|
|
121
115
|
class Hessian(rks_hess.Hessian):
|
pyscf/df/hessian/uhf.py
CHANGED
|
@@ -398,19 +398,9 @@ def make_h1(hessobj, mo_coeff, mo_occ, chkfile=None, atmlst=None, verbose=None):
|
|
|
398
398
|
for ia, h1, vj1, vk1 in _gen_jk(hessobj, mo_coeff, mo_occ, chkfile,
|
|
399
399
|
atmlst, verbose, True):
|
|
400
400
|
vk1a, vk1b = vk1
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
if chkfile is None:
|
|
405
|
-
h1aoa[ia] = h1a
|
|
406
|
-
h1aob[ia] = h1b
|
|
407
|
-
else:
|
|
408
|
-
lib.chkfile.save(chkfile, 'scf_f1ao/0/%d' % ia, h1a)
|
|
409
|
-
lib.chkfile.save(chkfile, 'scf_f1ao/1/%d' % ia, h1b)
|
|
410
|
-
if chkfile is None:
|
|
411
|
-
return (h1aoa,h1aob)
|
|
412
|
-
else:
|
|
413
|
-
return chkfile
|
|
401
|
+
h1aoa[ia] = h1 + vj1 - vk1a
|
|
402
|
+
h1aob[ia] = h1 + vj1 - vk1b
|
|
403
|
+
return (h1aoa,h1aob)
|
|
414
404
|
|
|
415
405
|
def _gen_jk(hessobj, mo_coeff, mo_occ, chkfile=None, atmlst=None,
|
|
416
406
|
verbose=None, with_k=True):
|
pyscf/df/hessian/uks.py
CHANGED
|
@@ -121,14 +121,7 @@ def make_h1(hessobj, mo_coeff, mo_occ, chkfile=None, atmlst=None, verbose=None):
|
|
|
121
121
|
vk1a, vk1b = vk1
|
|
122
122
|
h1aoa[ia] -= (alpha - hyb) * vk1a
|
|
123
123
|
h1aob[ia] -= (alpha - hyb) * vk1b
|
|
124
|
-
|
|
125
|
-
if chkfile is None:
|
|
126
|
-
return h1aoa, h1aob
|
|
127
|
-
else:
|
|
128
|
-
for ia in atmlst:
|
|
129
|
-
lib.chkfile.save(chkfile, 'scf_f1ao/0/%d'%ia, h1aoa[ia])
|
|
130
|
-
lib.chkfile.save(chkfile, 'scf_f1ao/1/%d'%ia, h1aob[ia])
|
|
131
|
-
return chkfile
|
|
124
|
+
return h1aoa, h1aob
|
|
132
125
|
|
|
133
126
|
|
|
134
127
|
class Hessian(uks_hess.Hessian):
|
pyscf/df/incore.py
CHANGED
|
@@ -38,22 +38,34 @@ format_aux_basis = addons.make_auxmol
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
def aux_e2(mol, auxmol_or_auxbasis, intor='int3c2e', aosym='s1', comp=None, out=None,
|
|
41
|
-
cintopt=None):
|
|
41
|
+
cintopt=None, shls_slice=None):
|
|
42
42
|
'''3-center AO integrals (ij|L), where L is the auxiliary basis.
|
|
43
43
|
|
|
44
44
|
Kwargs:
|
|
45
|
-
cintopt :
|
|
46
|
-
|
|
47
|
-
reduce the overhead of cintopt initialization repeatedly.
|
|
45
|
+
cintopt :
|
|
46
|
+
Precomputing certain pair-shell data. It can be created by
|
|
48
47
|
|
|
49
48
|
cintopt = gto.moleintor.make_cintopt(mol._atm, mol._bas, mol._env, 'int3c2e')
|
|
49
|
+
|
|
50
|
+
shls_slice : 6-element tuple
|
|
51
|
+
Label the start-stop shells for each index in the integral tensor.
|
|
52
|
+
For the (ij|aux) = intor('int3c2e'), the tuple should be given as
|
|
53
|
+
(ish_start, ish_end, jsh_start, jsh_end, aux_start, aux_end)
|
|
50
54
|
'''
|
|
51
55
|
if isinstance(auxmol_or_auxbasis, gto.MoleBase):
|
|
52
56
|
auxmol = auxmol_or_auxbasis
|
|
53
57
|
else:
|
|
54
58
|
auxbasis = auxmol_or_auxbasis
|
|
55
59
|
auxmol = addons.make_auxmol(mol, auxbasis)
|
|
56
|
-
shls_slice
|
|
60
|
+
if shls_slice is None:
|
|
61
|
+
shls_slice = (0, mol.nbas, 0, mol.nbas,
|
|
62
|
+
mol.nbas, mol.nbas+auxmol.nbas)
|
|
63
|
+
else:
|
|
64
|
+
assert len(shls_slice) == 6
|
|
65
|
+
assert shls_slice[5] < auxmol.nbas
|
|
66
|
+
shls_slice = list(shls_slice)
|
|
67
|
+
shls_slice[4] += mol.nbas
|
|
68
|
+
shls_slice[5] += mol.nbas
|
|
57
69
|
|
|
58
70
|
# Extract the call of the two lines below
|
|
59
71
|
# pmol = gto.mole.conc_mol(mol, auxmol)
|