pyscf 2.6.0__py3-none-macosx_11_0_arm64.whl → 2.6.1__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 +0 -2
- pyscf/ao2mo/nrr_outcore.py +3 -3
- pyscf/ao2mo/outcore.py +3 -3
- pyscf/ao2mo/r_outcore.py +3 -3
- pyscf/ao2mo/semi_incore.py +2 -2
- pyscf/df/df_jk.py +2 -0
- pyscf/df/incore.py +3 -1
- pyscf/df/outcore.py +3 -4
- pyscf/dft/__init__.py +0 -10
- pyscf/geomopt/__init__.py +1 -1
- pyscf/grad/rhf.py +1 -0
- pyscf/grad/rks.py +1 -0
- pyscf/gto/__init__.py +0 -1
- pyscf/gto/basis/__init__.py +0 -1
- pyscf/gto/eval_gto.py +11 -2
- pyscf/gto/mole.py +2 -2
- pyscf/hessian/dispersion.py +5 -5
- pyscf/hessian/rhf.py +1 -0
- pyscf/hessian/rks.py +1 -0
- pyscf/lib/chkfile.py +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 +1 -1
- pyscf/lib/misc.py +92 -15
- pyscf/lib/parameters.py +1 -0
- pyscf/mcscf/chkfile.py +3 -2
- pyscf/mp/ump2.py +1 -1
- pyscf/mrpt/nevpt2.py +1 -1
- pyscf/pbc/adc/__init__.py +0 -1
- pyscf/pbc/cc/kccsd_t_rhf.py +1 -1
- pyscf/pbc/df/outcore.py +4 -4
- pyscf/pbc/df/rsdf.py +7 -4
- pyscf/pbc/df/rsdf_builder.py +3 -4
- pyscf/pbc/df/rsdf_helper.py +2 -2
- pyscf/pbc/dft/__init__.py +0 -12
- pyscf/pbc/dft/kgks.py +3 -0
- pyscf/pbc/dft/numint.py +1 -1
- pyscf/pbc/dft/numint2c.py +1 -0
- pyscf/pbc/lib/kpts.py +1 -1
- pyscf/pbc/scf/__init__.py +0 -10
- pyscf/pbc/scf/ghf.py +1 -0
- pyscf/pbc/scf/hf.py +1 -1
- pyscf/pbc/scf/kghf.py +2 -0
- pyscf/pbc/scf/khf.py +1 -1
- pyscf/pbc/scf/khf_ksymm.py +1 -1
- pyscf/scf/__init__.py +0 -7
- pyscf/scf/chkfile.py +2 -1
- pyscf/scf/hf.py +6 -0
- pyscf/scf/ucphf.py +1 -1
- pyscf/solvent/__init__.py +1 -1
- {pyscf-2.6.0.dist-info → pyscf-2.6.1.dist-info}/METADATA +3 -3
- {pyscf-2.6.0.dist-info → pyscf-2.6.1.dist-info}/RECORD +68 -68
- {pyscf-2.6.0.dist-info → pyscf-2.6.1.dist-info}/LICENSE +0 -0
- {pyscf-2.6.0.dist-info → pyscf-2.6.1.dist-info}/NOTICE +0 -0
- {pyscf-2.6.0.dist-info → pyscf-2.6.1.dist-info}/WHEEL +0 -0
- {pyscf-2.6.0.dist-info → pyscf-2.6.1.dist-info}/top_level.txt +0 -0
pyscf/__init__.py
CHANGED
pyscf/adc/__init__.py
CHANGED
|
@@ -70,8 +70,6 @@ def UADC(mf, frozen=None, mo_coeff=None, mo_occ=None):
|
|
|
70
70
|
UADC.__doc__ = uadc.UADC.__doc__
|
|
71
71
|
|
|
72
72
|
def RADC(mf, frozen=None, mo_coeff=None, mo_occ=None):
|
|
73
|
-
__doc__ = radc.RADC.__doc__
|
|
74
|
-
|
|
75
73
|
if not (frozen is None or frozen == 0):
|
|
76
74
|
raise NotImplementedError
|
|
77
75
|
|
pyscf/ao2mo/nrr_outcore.py
CHANGED
|
@@ -95,11 +95,11 @@ def general(mol, mo_coeffs, erifile, dataname='eri_mo',
|
|
|
95
95
|
|
|
96
96
|
if isinstance(erifile, str):
|
|
97
97
|
if h5py.is_hdf5(erifile):
|
|
98
|
-
feri =
|
|
98
|
+
feri = lib.H5FileWrap(erifile, 'a')
|
|
99
99
|
if dataname in feri:
|
|
100
100
|
del(feri[dataname])
|
|
101
101
|
else:
|
|
102
|
-
feri =
|
|
102
|
+
feri = lib.H5FileWrap(erifile, 'w')
|
|
103
103
|
else:
|
|
104
104
|
assert(isinstance(erifile, h5py.Group))
|
|
105
105
|
feri = erifile
|
|
@@ -250,7 +250,7 @@ def half_e1(mol, mo_coeffs, swapfile,
|
|
|
250
250
|
log.debug('step1: (ij,kl) = (%d,%d), mem cache %.8g MB, iobuf %.8g MB',
|
|
251
251
|
nij_pair, nao_pair, mem_words*16/1e6, iobuf_words*16/1e6)
|
|
252
252
|
|
|
253
|
-
fswap =
|
|
253
|
+
fswap = lib.H5FileWrap(swapfile, 'w')
|
|
254
254
|
for icomp in range(comp):
|
|
255
255
|
fswap.create_group(str(icomp)) # for h5py old version
|
|
256
256
|
|
pyscf/ao2mo/outcore.py
CHANGED
|
@@ -238,11 +238,11 @@ def general(mol, mo_coeffs, erifile, dataname='eri_mo',
|
|
|
238
238
|
|
|
239
239
|
if isinstance(erifile, str):
|
|
240
240
|
if h5py.is_hdf5(erifile):
|
|
241
|
-
feri =
|
|
241
|
+
feri = lib.H5FileWrap(erifile, 'a')
|
|
242
242
|
if dataname in feri:
|
|
243
243
|
del (feri[dataname])
|
|
244
244
|
else:
|
|
245
|
-
feri =
|
|
245
|
+
feri = lib.H5FileWrap(erifile, 'w')
|
|
246
246
|
else:
|
|
247
247
|
assert (isinstance(erifile, h5py.Group))
|
|
248
248
|
feri = erifile
|
|
@@ -431,7 +431,7 @@ def half_e1(mol, mo_coeffs, swapfile,
|
|
|
431
431
|
if isinstance(swapfile, h5py.Group):
|
|
432
432
|
fswap = swapfile
|
|
433
433
|
else:
|
|
434
|
-
fswap = lib.
|
|
434
|
+
fswap = lib.H5FileWrap(swapfile, 'a')
|
|
435
435
|
for icomp in range(comp):
|
|
436
436
|
fswap.create_group(str(icomp)) # for h5py old version
|
|
437
437
|
|
pyscf/ao2mo/r_outcore.py
CHANGED
|
@@ -74,11 +74,11 @@ def general(mol, mo_coeffs, erifile, dataname='eri_mo',
|
|
|
74
74
|
|
|
75
75
|
if isinstance(erifile, str):
|
|
76
76
|
if h5py.is_hdf5(erifile):
|
|
77
|
-
feri =
|
|
77
|
+
feri = lib.H5FileWrap(erifile, 'a')
|
|
78
78
|
if dataname in feri:
|
|
79
79
|
del (feri[dataname])
|
|
80
80
|
else:
|
|
81
|
-
feri =
|
|
81
|
+
feri = lib.H5FileWrap(erifile, 'w')
|
|
82
82
|
else:
|
|
83
83
|
assert (isinstance(erifile, h5py.Group))
|
|
84
84
|
feri = erifile
|
|
@@ -214,7 +214,7 @@ def half_e1(mol, mo_coeffs, swapfile,
|
|
|
214
214
|
log.debug('step1: (ij,kl) = (%d,%d), mem cache %.8g MB, iobuf %.8g MB',
|
|
215
215
|
nij_pair, nao_pair, mem_words*16/1e6, iobuf_words*16/1e6)
|
|
216
216
|
|
|
217
|
-
fswap =
|
|
217
|
+
fswap = lib.H5FileWrap(swapfile, 'w')
|
|
218
218
|
for icomp in range(comp):
|
|
219
219
|
fswap.create_group(str(icomp)) # for h5py old version
|
|
220
220
|
|
pyscf/ao2mo/semi_incore.py
CHANGED
|
@@ -140,11 +140,11 @@ def general(eri, mo_coeffs, erifile, dataname='eri_mo',
|
|
|
140
140
|
|
|
141
141
|
if isinstance(erifile, str):
|
|
142
142
|
if h5py.is_hdf5(erifile):
|
|
143
|
-
feri =
|
|
143
|
+
feri = lib.H5FileWrap(erifile, 'a')
|
|
144
144
|
if dataname in feri:
|
|
145
145
|
del (feri[dataname])
|
|
146
146
|
else:
|
|
147
|
-
feri =
|
|
147
|
+
feri = lib.H5FileWrap(erifile,'w', libver='latest')
|
|
148
148
|
else:
|
|
149
149
|
assert (isinstance(erifile, h5py.Group))
|
|
150
150
|
feri = erifile
|
pyscf/df/df_jk.py
CHANGED
|
@@ -200,6 +200,8 @@ class _DFHF:
|
|
|
200
200
|
return uks.Hessian(self)
|
|
201
201
|
else:
|
|
202
202
|
return uhf.Hessian(self)
|
|
203
|
+
elif isinstance(self, scf.rohf.ROHF):
|
|
204
|
+
raise NotImplementedError
|
|
203
205
|
elif isinstance(self, scf.rhf.RHF):
|
|
204
206
|
if isinstance(self, scf.hf.KohnShamDFT):
|
|
205
207
|
return rks.Hessian(self)
|
pyscf/df/incore.py
CHANGED
|
@@ -28,7 +28,9 @@ from pyscf import __config__
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
MAX_MEMORY = getattr(__config__, 'df_outcore_max_memory', 2000) # 2GB
|
|
31
|
-
LINEAR_DEP_THR
|
|
31
|
+
# LINEAR_DEP_THR cannot be below 1e-7,
|
|
32
|
+
# see qchem default setting in https://manual.q-chem.com/5.4/sec_Basis_Customization.html
|
|
33
|
+
LINEAR_DEP_THR = getattr(__config__, 'df_df_DF_lindep', 1e-7)
|
|
32
34
|
|
|
33
35
|
|
|
34
36
|
# This function is aliased for backward compatibility.
|
pyscf/df/outcore.py
CHANGED
|
@@ -27,12 +27,11 @@ from pyscf.lib import logger
|
|
|
27
27
|
from pyscf import ao2mo
|
|
28
28
|
from pyscf.ao2mo import _ao2mo
|
|
29
29
|
from pyscf.ao2mo.outcore import _load_from_h5g
|
|
30
|
-
from pyscf.df.incore import _eig_decompose
|
|
30
|
+
from pyscf.df.incore import _eig_decompose, LINEAR_DEP_THR
|
|
31
31
|
from pyscf.df.addons import make_auxmol
|
|
32
32
|
from pyscf import __config__
|
|
33
33
|
|
|
34
34
|
MAX_MEMORY = getattr(__config__, 'df_outcore_max_memory', 2000) # 2GB
|
|
35
|
-
LINEAR_DEP_THR = getattr(__config__, 'df_df_DF_lindep', 1e-12)
|
|
36
35
|
|
|
37
36
|
#
|
|
38
37
|
# for auxe1 (P|ij)
|
|
@@ -303,11 +302,11 @@ def _create_h5file(erifile, dataname):
|
|
|
303
302
|
erifile = erifile.name
|
|
304
303
|
|
|
305
304
|
if h5py.is_hdf5(erifile):
|
|
306
|
-
feri =
|
|
305
|
+
feri = lib.H5FileWrap(erifile, 'a')
|
|
307
306
|
if dataname in feri:
|
|
308
307
|
del (feri[dataname])
|
|
309
308
|
else:
|
|
310
|
-
feri =
|
|
309
|
+
feri = lib.H5FileWrap(erifile, 'w')
|
|
311
310
|
return feri
|
|
312
311
|
|
|
313
312
|
del (MAX_MEMORY)
|
pyscf/dft/__init__.py
CHANGED
|
@@ -66,7 +66,6 @@ def KS(mol, xc='LDA,VWN'):
|
|
|
66
66
|
KS.__doc__ = '''
|
|
67
67
|
A wrap function to create DFT object (RKS or UKS).\n
|
|
68
68
|
''' + rks.RKS.__doc__
|
|
69
|
-
gto.Mole.KS = gto.Mole.DFT = property(KS)
|
|
70
69
|
DFT = KS
|
|
71
70
|
|
|
72
71
|
def RKS(mol, xc='LDA,VWN'):
|
|
@@ -78,7 +77,6 @@ def RKS(mol, xc='LDA,VWN'):
|
|
|
78
77
|
else:
|
|
79
78
|
return ROKS(mol, xc)
|
|
80
79
|
RKS.__doc__ = rks.RKS.__doc__
|
|
81
|
-
gto.Mole.RKS = property(RKS)
|
|
82
80
|
|
|
83
81
|
def ROKS(mol, xc='LDA,VWN'):
|
|
84
82
|
if not mol.symmetry or mol.groupname == 'C1':
|
|
@@ -86,7 +84,6 @@ def ROKS(mol, xc='LDA,VWN'):
|
|
|
86
84
|
else:
|
|
87
85
|
return rks_symm.ROKS(mol, xc)
|
|
88
86
|
ROKS.__doc__ = roks.ROKS.__doc__
|
|
89
|
-
gto.Mole.ROKS = property(ROKS)
|
|
90
87
|
|
|
91
88
|
def UKS(mol, xc='LDA,VWN'):
|
|
92
89
|
if not mol.symmetry or mol.groupname == 'C1':
|
|
@@ -94,7 +91,6 @@ def UKS(mol, xc='LDA,VWN'):
|
|
|
94
91
|
else:
|
|
95
92
|
return uks_symm.UKS(mol, xc)
|
|
96
93
|
UKS.__doc__ = uks.UKS.__doc__
|
|
97
|
-
gto.Mole.UKS = property(UKS)
|
|
98
94
|
|
|
99
95
|
def GKS(mol, xc='LDA,VWN'):
|
|
100
96
|
if not mol.symmetry or mol.groupname == 'C1':
|
|
@@ -102,7 +98,6 @@ def GKS(mol, xc='LDA,VWN'):
|
|
|
102
98
|
else:
|
|
103
99
|
return gks_symm.GKS(mol, xc)
|
|
104
100
|
GKS.__doc__ = gks.GKS.__doc__
|
|
105
|
-
gto.Mole.GKS = property(GKS)
|
|
106
101
|
|
|
107
102
|
def DKS(mol, xc='LDA,VWN'):
|
|
108
103
|
from pyscf.scf import dhf
|
|
@@ -110,12 +105,8 @@ def DKS(mol, xc='LDA,VWN'):
|
|
|
110
105
|
return dks.RDKS(mol, xc=xc)
|
|
111
106
|
else:
|
|
112
107
|
return dks.UDKS(mol, xc=xc)
|
|
113
|
-
|
|
114
108
|
UDKS = dks.UDKS
|
|
115
109
|
RDKS = dks.RDKS
|
|
116
|
-
gto.Mole.DKS = property(DKS)
|
|
117
|
-
gto.Mole.UDKS = property(UDKS)
|
|
118
|
-
gto.Mole.RDKS = property(RDKS)
|
|
119
110
|
|
|
120
111
|
def X2C(mol, *args):
|
|
121
112
|
'''X2C Kohn-Sham'''
|
|
@@ -126,4 +117,3 @@ def X2C(mol, *args):
|
|
|
126
117
|
else:
|
|
127
118
|
return dft.UKS(mol, *args)
|
|
128
119
|
X2C_KS = X2C
|
|
129
|
-
gto.Mole.X2C_KS = property(X2C)
|
pyscf/geomopt/__init__.py
CHANGED
pyscf/grad/rhf.py
CHANGED
pyscf/grad/rks.py
CHANGED
pyscf/gto/__init__.py
CHANGED
pyscf/gto/basis/__init__.py
CHANGED
|
@@ -531,7 +531,6 @@ def _convert_contraction(contr_string):
|
|
|
531
531
|
def _truncate(basis, contr_scheme, symb, split_name):
|
|
532
532
|
# keep only first n_keep contractions for each l
|
|
533
533
|
contr_b = []
|
|
534
|
-
b_index = 0
|
|
535
534
|
for l, n_keep in enumerate(contr_scheme):
|
|
536
535
|
n_saved = 0
|
|
537
536
|
if n_keep > 0:
|
pyscf/gto/eval_gto.py
CHANGED
|
@@ -82,8 +82,14 @@ def eval_gto(mol, eval_name, coords, comp=None, shls_slice=None, non0tab=None,
|
|
|
82
82
|
If provided, results are written into this array.
|
|
83
83
|
|
|
84
84
|
Returns:
|
|
85
|
-
2D
|
|
86
|
-
|
|
85
|
+
An 2D to 4D array for AO values on grids.
|
|
86
|
+
If eval_name is scalar functions, such as GTOval and GTOval_ip_cart,
|
|
87
|
+
the shape of the return is (N,nao) for GTOval, and (*,N,nao) for other
|
|
88
|
+
functions.
|
|
89
|
+
If eval_name is spinor functions, such as GTOval_spinor and GTOval_sp_spinor,
|
|
90
|
+
the shape of the return is (2,N,nao) for GTOval_spinor, and (2,*,N,nao)
|
|
91
|
+
for other functions. The leading dimension 2 represents the spin-up and
|
|
92
|
+
spin-down components of the spinor basis.
|
|
87
93
|
|
|
88
94
|
Examples:
|
|
89
95
|
|
|
@@ -95,6 +101,9 @@ def eval_gto(mol, eval_name, coords, comp=None, shls_slice=None, non0tab=None,
|
|
|
95
101
|
>>> ao_value = mol.eval_gto("GTOval_ig_sph", coords)
|
|
96
102
|
>>> print(ao_value.shape)
|
|
97
103
|
(3, 100, 24)
|
|
104
|
+
>>> ao_a, ao_b = mol.eval_gto("GTOval_spinor", coords)
|
|
105
|
+
>>> print(ao_a.shape)
|
|
106
|
+
(100, 24)
|
|
98
107
|
'''
|
|
99
108
|
eval_name, comp = _get_intor_and_comp(mol, eval_name, comp)
|
|
100
109
|
|
pyscf/gto/mole.py
CHANGED
|
@@ -3189,7 +3189,7 @@ class MoleBase(lib.StreamObject):
|
|
|
3189
3189
|
return self._env[ptr:ptr+3].copy()
|
|
3190
3190
|
|
|
3191
3191
|
def atom_coords(self, unit='Bohr'):
|
|
3192
|
-
'''np.asarray([mol.
|
|
3192
|
+
'''np.asarray([mol.atom_coord(i) for i in range(mol.natm)])'''
|
|
3193
3193
|
ptr = self._atm[:,PTR_COORD]
|
|
3194
3194
|
c = self._env[numpy.vstack((ptr,ptr+1,ptr+2)).T].copy()
|
|
3195
3195
|
if not is_au(unit):
|
|
@@ -3840,7 +3840,7 @@ def _parse_nuc_mod(str_or_int_or_fn):
|
|
|
3840
3840
|
def _update_from_cmdargs_(mol):
|
|
3841
3841
|
try:
|
|
3842
3842
|
# Detect whether in Ipython shell
|
|
3843
|
-
__IPYTHON__ # noqa:
|
|
3843
|
+
__IPYTHON__ # noqa: F821
|
|
3844
3844
|
return
|
|
3845
3845
|
except Exception:
|
|
3846
3846
|
pass
|
pyscf/hessian/dispersion.py
CHANGED
|
@@ -46,7 +46,7 @@ def get_dispersion(hessobj, disp=None, with_3body=None):
|
|
|
46
46
|
if with_3body is not None:
|
|
47
47
|
with_3body = disp_with_3body
|
|
48
48
|
|
|
49
|
-
if
|
|
49
|
+
if disp_version[:2].upper() == 'D3':
|
|
50
50
|
logger.info(mf, "Calc dispersion correction with DFTD3.")
|
|
51
51
|
logger.info(mf, f"Parameters: xc={method}, version={disp_version}, atm={with_3body}")
|
|
52
52
|
logger.warn(mf, "DFTD3 does not support analytical Hessian, using finite difference")
|
|
@@ -57,21 +57,21 @@ def get_dispersion(hessobj, disp=None, with_3body=None):
|
|
|
57
57
|
for j in range(3):
|
|
58
58
|
coords[i,j] += eps
|
|
59
59
|
mol.set_geom_(coords, unit='Bohr')
|
|
60
|
-
d3_model = dftd3.DFTD3Dispersion(mol, xc=method, version=
|
|
60
|
+
d3_model = dftd3.DFTD3Dispersion(mol, xc=method, version=disp_version, atm=with_3body)
|
|
61
61
|
res = d3_model.get_dispersion(grad=True)
|
|
62
62
|
g1 = res.get('gradient')
|
|
63
63
|
|
|
64
64
|
coords[i,j] -= 2.0*eps
|
|
65
65
|
mol.set_geom_(coords, unit='Bohr')
|
|
66
|
-
d3_model = dftd3.DFTD3Dispersion(mol, xc=method, version=
|
|
66
|
+
d3_model = dftd3.DFTD3Dispersion(mol, xc=method, version=disp_version, atm=with_3body)
|
|
67
67
|
res = d3_model.get_dispersion(grad=True)
|
|
68
68
|
g2 = res.get('gradient')
|
|
69
69
|
|
|
70
70
|
coords[i,j] += eps
|
|
71
71
|
h_disp[i,:,j,:] = (g1 - g2)/(2.0*eps)
|
|
72
|
-
|
|
72
|
+
return h_disp
|
|
73
73
|
|
|
74
|
-
elif
|
|
74
|
+
elif disp_version[:2].upper() == 'D4':
|
|
75
75
|
logger.info(mf, "Calc dispersion correction with DFTD4.")
|
|
76
76
|
logger.info(mf, f"Parameters: xc={method}, atm={with_3body}")
|
|
77
77
|
logger.warn(mf, "DFTD4 does not support analytical Hessian, using finite difference.")
|
pyscf/hessian/rhf.py
CHANGED
pyscf/hessian/rks.py
CHANGED
pyscf/lib/chkfile.py
CHANGED
|
@@ -105,6 +105,7 @@ def dump(chkfile, key, value):
|
|
|
105
105
|
>>> f['symm/Ci/op']
|
|
106
106
|
<HDF5 dataset "op": shape (2,), type "|S1">
|
|
107
107
|
'''
|
|
108
|
+
from pyscf.lib import H5FileWrap
|
|
108
109
|
def save_as_group(key, value, root):
|
|
109
110
|
if isinstance(value, dict):
|
|
110
111
|
root1 = root.create_group(key)
|
|
@@ -126,14 +127,14 @@ def dump(chkfile, key, value):
|
|
|
126
127
|
save_as_group('%06d'%k, v, root1)
|
|
127
128
|
|
|
128
129
|
if h5py.is_hdf5(chkfile):
|
|
129
|
-
with
|
|
130
|
+
with H5FileWrap(chkfile, 'r+') as fh5:
|
|
130
131
|
if key in fh5:
|
|
131
132
|
del (fh5[key])
|
|
132
133
|
elif key + '__from_list__' in fh5:
|
|
133
134
|
del (fh5[key+'__from_list__'])
|
|
134
135
|
save_as_group(key, value, fh5)
|
|
135
136
|
else:
|
|
136
|
-
with
|
|
137
|
+
with H5FileWrap(chkfile, 'w') as fh5:
|
|
137
138
|
save_as_group(key, value, fh5)
|
|
138
139
|
dump_chkfile_key = save = dump
|
|
139
140
|
|
pyscf/lib/libagf2.dylib
CHANGED
|
Binary file
|
pyscf/lib/libao2mo.dylib
CHANGED
|
Binary file
|
pyscf/lib/libcc.dylib
CHANGED
|
Binary file
|
pyscf/lib/libcgto.dylib
CHANGED
|
Binary file
|
pyscf/lib/libcvhf.dylib
CHANGED
|
Binary file
|
pyscf/lib/libdft.dylib
CHANGED
|
Binary file
|
pyscf/lib/libfci.dylib
CHANGED
|
Binary file
|
pyscf/lib/libmcscf.dylib
CHANGED
|
Binary file
|
pyscf/lib/libnp_helper.dylib
CHANGED
|
Binary file
|
pyscf/lib/libpbc.dylib
CHANGED
|
Binary file
|
pyscf/lib/libri.dylib
CHANGED
|
Binary file
|
pyscf/lib/libxc_itrf.dylib
CHANGED
|
Binary file
|
pyscf/lib/libxcfun_itrf.dylib
CHANGED
|
Binary file
|
pyscf/lib/linalg_helper.py
CHANGED
|
@@ -33,7 +33,7 @@ from pyscf import __config__
|
|
|
33
33
|
|
|
34
34
|
SAFE_EIGH_LINDEP = getattr(__config__, 'lib_linalg_helper_safe_eigh_lindep', 1e-15)
|
|
35
35
|
DAVIDSON_LINDEP = getattr(__config__, 'lib_linalg_helper_davidson_lindep', 1e-14)
|
|
36
|
-
DSOLVE_LINDEP = getattr(__config__, 'lib_linalg_helper_dsolve_lindep', 1e-
|
|
36
|
+
DSOLVE_LINDEP = getattr(__config__, 'lib_linalg_helper_dsolve_lindep', 1e-13)
|
|
37
37
|
MAX_MEMORY = getattr(__config__, 'lib_linalg_helper_davidson_max_memory', 2000) # 2GB
|
|
38
38
|
|
|
39
39
|
# sort by similarity has problem which flips the ordering of eigenvalues when
|
pyscf/lib/misc.py
CHANGED
|
@@ -23,6 +23,7 @@ Some helper functions
|
|
|
23
23
|
import os
|
|
24
24
|
import sys
|
|
25
25
|
import time
|
|
26
|
+
import random
|
|
26
27
|
import platform
|
|
27
28
|
import warnings
|
|
28
29
|
import tempfile
|
|
@@ -1111,8 +1112,52 @@ class call_in_background:
|
|
|
1111
1112
|
if self.executor is not None:
|
|
1112
1113
|
self.executor.shutdown(wait=True)
|
|
1113
1114
|
|
|
1115
|
+
class H5FileWrap(h5py.File):
|
|
1116
|
+
'''
|
|
1117
|
+
A wrapper for h5py.File that allows global options to be set by
|
|
1118
|
+
the user via lib.param.H5F_WRITE_KWARGS, which is imported
|
|
1119
|
+
upon startup from the user's configuration file.
|
|
1120
|
+
|
|
1121
|
+
These options are, as the name suggests, not used when the
|
|
1122
|
+
HDF5 file is opened in read-only mode.
|
|
1123
|
+
|
|
1124
|
+
Example:
|
|
1125
|
+
|
|
1126
|
+
>>> with temporary_env(lib.param, H5F_WRITE_KWARGS={'driver': 'core'}):
|
|
1127
|
+
... with lib.H5TmpFile() as f:
|
|
1128
|
+
... print(f.driver)
|
|
1129
|
+
core
|
|
1130
|
+
'''
|
|
1131
|
+
def __init__(self, filename, mode, *args, **kwargs):
|
|
1132
|
+
if mode != 'r':
|
|
1133
|
+
options = param.H5F_WRITE_KWARGS.copy()
|
|
1134
|
+
options.update(kwargs)
|
|
1135
|
+
else:
|
|
1136
|
+
options = kwargs
|
|
1137
|
+
super().__init__(filename, mode, *args, **options)
|
|
1138
|
+
|
|
1139
|
+
def _finished(self):
|
|
1140
|
+
'''
|
|
1141
|
+
Close the file and flush it if it is open.
|
|
1142
|
+
Flushing explicitly should not be necessary:
|
|
1143
|
+
this is intended to avoid a bug that unpredictably
|
|
1144
|
+
causes outcore DF to hang on an NFS filesystem.
|
|
1145
|
+
'''
|
|
1146
|
+
try:
|
|
1147
|
+
if super().id:
|
|
1148
|
+
super().flush()
|
|
1149
|
+
super().close()
|
|
1150
|
+
except AttributeError: # close not defined in old h5py
|
|
1151
|
+
pass
|
|
1152
|
+
except ValueError: # if close() is called twice
|
|
1153
|
+
pass
|
|
1154
|
+
except ImportError: # exit program before de-referring the object
|
|
1155
|
+
pass
|
|
1156
|
+
|
|
1157
|
+
def __del__(self):
|
|
1158
|
+
self._finished()
|
|
1114
1159
|
|
|
1115
|
-
class H5TmpFile(
|
|
1160
|
+
class H5TmpFile(H5FileWrap):
|
|
1116
1161
|
'''Create and return an HDF5 temporary file.
|
|
1117
1162
|
|
|
1118
1163
|
Kwargs:
|
|
@@ -1130,22 +1175,40 @@ class H5TmpFile(h5py.File):
|
|
|
1130
1175
|
>>> from pyscf import lib
|
|
1131
1176
|
>>> ftmp = lib.H5TmpFile()
|
|
1132
1177
|
'''
|
|
1133
|
-
def __init__(self, filename=None, mode='a',
|
|
1178
|
+
def __init__(self, filename=None, mode='a', prefix='', suffix='',
|
|
1179
|
+
dir=param.TMPDIR, *args, **kwargs):
|
|
1180
|
+
self.delete_on_close = False
|
|
1134
1181
|
if filename is None:
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1182
|
+
filename = H5TmpFile._gen_unique_name(dir, pre=prefix, suf=suffix)
|
|
1183
|
+
self.delete_on_close = True
|
|
1184
|
+
super().__init__(filename, mode, *args, **kwargs)
|
|
1185
|
+
|
|
1186
|
+
# Python 3 stdlib does not have a way to just generate
|
|
1187
|
+
# temporary file names.
|
|
1188
|
+
@staticmethod
|
|
1189
|
+
def _gen_unique_name(directory, pre='', suf=''):
|
|
1190
|
+
absdir = os.path.abspath(directory)
|
|
1191
|
+
random.seed()
|
|
1192
|
+
for seq in range(10000):
|
|
1193
|
+
name = ''.join(random.choices('abcdefghijklmnopqrstuvwxyz0123456789', k=8))
|
|
1194
|
+
filename = os.path.join(absdir, pre + name + suf)
|
|
1195
|
+
try:
|
|
1196
|
+
f = open(filename, 'x')
|
|
1197
|
+
except FileExistsError:
|
|
1198
|
+
continue # try again
|
|
1199
|
+
f.close()
|
|
1200
|
+
return filename
|
|
1201
|
+
raise FileExistsError("No usable temporary file name found")
|
|
1202
|
+
|
|
1203
|
+
def close(self):
|
|
1204
|
+
filename = self.filename
|
|
1205
|
+
self._finished()
|
|
1206
|
+
if self.delete_on_close:
|
|
1207
|
+
if os.path.exists(filename):
|
|
1208
|
+
os.remove(filename)
|
|
1209
|
+
def __exit__(self, type, value, traceback):
|
|
1210
|
+
self.close()
|
|
1139
1211
|
|
|
1140
|
-
def __del__(self):
|
|
1141
|
-
try:
|
|
1142
|
-
self.close()
|
|
1143
|
-
except AttributeError: # close not defined in old h5py
|
|
1144
|
-
pass
|
|
1145
|
-
except ValueError: # if close() is called twice
|
|
1146
|
-
pass
|
|
1147
|
-
except ImportError: # exit program before de-referring the object
|
|
1148
|
-
pass
|
|
1149
1212
|
|
|
1150
1213
|
def fingerprint(a):
|
|
1151
1214
|
'''Fingerprint of numpy array'''
|
|
@@ -1249,6 +1312,20 @@ class light_speed(temporary_env):
|
|
|
1249
1312
|
temporary_env.__enter__(self)
|
|
1250
1313
|
return self.c
|
|
1251
1314
|
|
|
1315
|
+
class h5filewrite_options(temporary_env):
|
|
1316
|
+
'''Within the context of this macro, extra keyword arguments are
|
|
1317
|
+
passed to h5py.File() whenever an HDF5 file is opened for writing.
|
|
1318
|
+
|
|
1319
|
+
Examples:
|
|
1320
|
+
|
|
1321
|
+
>>> with h5filewrite_options(alignment_interval=4096, alignment_threshold=4096):
|
|
1322
|
+
... f = lib.H5FileWrap('mydata.h5', 'w')
|
|
1323
|
+
>>> print(h5py.h5p.PropFAID.get_alignment(f.id.get_access_plist()))
|
|
1324
|
+
(4096, 4096)
|
|
1325
|
+
'''
|
|
1326
|
+
def __init__(self, **kwargs):
|
|
1327
|
+
super().__init__(param, H5F_WRITE_KWARGS=kwargs)
|
|
1328
|
+
|
|
1252
1329
|
def repo_info(repo_path):
|
|
1253
1330
|
'''
|
|
1254
1331
|
Repo location, version, git branch and commit ID
|
pyscf/lib/parameters.py
CHANGED
|
@@ -53,6 +53,7 @@ OUTPUT_DIGITS = getattr(__config__, 'OUTPUT_DIGITS', 5)
|
|
|
53
53
|
OUTPUT_COLS = getattr(__config__, 'OUTPUT_COLS', 5)
|
|
54
54
|
LOOSE_ZERO_TOL = getattr(__config__, 'LOOSE_ZERO_TOL', 1e-9)
|
|
55
55
|
LARGE_DENOM = getattr(__config__, 'LARGE_DENOM', 1e14)
|
|
56
|
+
H5F_WRITE_KWARGS = getattr(__config__, 'H5F_WRITE_KWARGS', {})
|
|
56
57
|
|
|
57
58
|
L_MAX = 8
|
|
58
59
|
ANGULAR = 'spdfghik'
|
pyscf/mcscf/chkfile.py
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
#
|
|
21
21
|
|
|
22
22
|
import h5py
|
|
23
|
+
from pyscf.lib import H5FileWrap
|
|
23
24
|
from pyscf.lib.chkfile import load
|
|
24
25
|
from pyscf.lib.chkfile import dump, save
|
|
25
26
|
from pyscf.lib.chkfile import load_mol, save_mol
|
|
@@ -45,11 +46,11 @@ def dump_mcscf(mc, chkfile=None, key='mcscf',
|
|
|
45
46
|
#if ci_vector is None: ci_vector = mc.ci
|
|
46
47
|
|
|
47
48
|
if h5py.is_hdf5(chkfile):
|
|
48
|
-
fh5 =
|
|
49
|
+
fh5 = H5FileWrap(chkfile, 'a')
|
|
49
50
|
if key in fh5:
|
|
50
51
|
del (fh5[key])
|
|
51
52
|
else:
|
|
52
|
-
fh5 =
|
|
53
|
+
fh5 = H5FileWrap(chkfile, 'w')
|
|
53
54
|
|
|
54
55
|
if 'mol' not in fh5:
|
|
55
56
|
fh5['mol'] = mc.mol.dumps()
|
pyscf/mp/ump2.py
CHANGED
|
@@ -303,7 +303,7 @@ def make_fno(mp, thresh=1e-6, pct_occ=None, nvir_act=None, t2=None, eris=None):
|
|
|
303
303
|
masks = _mo_splitter(mp)
|
|
304
304
|
|
|
305
305
|
if nvir_act is not None:
|
|
306
|
-
if isinstance(nvir_act, (int,numpy.
|
|
306
|
+
if isinstance(nvir_act, (int, numpy.integer)):
|
|
307
307
|
nvir_act = [nvir_act]*2
|
|
308
308
|
|
|
309
309
|
no_frozen = []
|
pyscf/mrpt/nevpt2.py
CHANGED
|
@@ -990,7 +990,7 @@ def trans_e1_outcore(mc, mo, max_memory=None, ioblk_size=256, tmpdir=None,
|
|
|
990
990
|
time1 = [logger.process_clock(), logger.perf_counter()]
|
|
991
991
|
ao_loc = numpy.array(mol.ao_loc_nr(), dtype=numpy.int32)
|
|
992
992
|
cvcvfile = tempfile.NamedTemporaryFile(dir=tmpdir)
|
|
993
|
-
with
|
|
993
|
+
with lib.H5TmpFile(cvcvfile.name, 'w') as f5:
|
|
994
994
|
cvcv = f5.create_dataset('eri_mo', (ncore*nvir,ncore*nvir), 'f8')
|
|
995
995
|
ppaa, papa, pacv = _trans(mo, ncore, ncas, load_buf, cvcv, ao_loc)[:3]
|
|
996
996
|
time0 = logger.timer(mol, 'trans_cvcv', *time0)
|
pyscf/pbc/adc/__init__.py
CHANGED
|
@@ -19,7 +19,6 @@ from pyscf.pbc.adc import kadc_rhf_ip
|
|
|
19
19
|
from pyscf.pbc.adc import kadc_rhf_ea
|
|
20
20
|
|
|
21
21
|
def KRADC(mf, frozen=None, mo_coeff=None, mo_occ=None):
|
|
22
|
-
from pyscf.pbc.adc import kadc_rhf
|
|
23
22
|
if not isinstance(mf, scf.khf.KRHF):
|
|
24
23
|
mf = mf.to_rhf()
|
|
25
24
|
return kadc_rhf.RADC(mf, frozen, mo_coeff, mo_occ)
|
pyscf/pbc/cc/kccsd_t_rhf.py
CHANGED
|
@@ -357,7 +357,7 @@ def check_read_success(filename, **kwargs):
|
|
|
357
357
|
mode = kwargs.get('mode', 'r')
|
|
358
358
|
if not os.path.isfile(filename):
|
|
359
359
|
return False
|
|
360
|
-
f =
|
|
360
|
+
f = lib.H5FileWrap(filename, mode=mode, **kwargs)
|
|
361
361
|
return f.attrs.get('completed', False)
|
|
362
362
|
write_complete = check_write_complete(filename, **kwargs)
|
|
363
363
|
return False and write_complete
|
pyscf/pbc/df/outcore.py
CHANGED
|
@@ -48,9 +48,9 @@ def aux_e1(cell, auxcell_or_auxbasis, erifile, intor='int3c2e', aosym='s2ij', co
|
|
|
48
48
|
if isinstance(erifile, h5py.Group):
|
|
49
49
|
feri = erifile
|
|
50
50
|
elif h5py.is_hdf5(erifile):
|
|
51
|
-
feri =
|
|
51
|
+
feri = lib.H5FileWrap(erifile, 'a')
|
|
52
52
|
else:
|
|
53
|
-
feri =
|
|
53
|
+
feri = lib.H5FileWrap(erifile, 'w')
|
|
54
54
|
if dataname in feri:
|
|
55
55
|
del (feri[dataname])
|
|
56
56
|
if dataname+'-kptij' in feri:
|
|
@@ -169,9 +169,9 @@ def _aux_e2(cell, auxcell_or_auxbasis, erifile, intor='int3c2e', aosym='s2ij', c
|
|
|
169
169
|
if isinstance(erifile, h5py.Group):
|
|
170
170
|
feri = erifile
|
|
171
171
|
elif h5py.is_hdf5(erifile):
|
|
172
|
-
feri =
|
|
172
|
+
feri = lib.H5FileWrap(erifile, 'a')
|
|
173
173
|
else:
|
|
174
|
-
feri =
|
|
174
|
+
feri = lib.H5FileWrap(erifile, 'w')
|
|
175
175
|
if dataname in feri:
|
|
176
176
|
del (feri[dataname])
|
|
177
177
|
if dataname+'-kptij' in feri:
|