Skip to content

Commit 81e088c

Browse files
committed
Fix tests
1 parent 2e025c8 commit 81e088c

File tree

8 files changed

+21
-18
lines changed

8 files changed

+21
-18
lines changed

pyscf/cc/dfccsd.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ def __init__(self, mf, frozen=None, mo_coeff=None, mo_occ=None):
3535
if getattr(mf, 'with_df', None):
3636
self.with_df = mf.with_df
3737
else:
38-
self.with_df = df.DF(mf.mol)
39-
self.with_df.auxbasis = predefined_auxbasis(mf.mol, basis, mp2fit=True)
38+
mol = mf.mol
39+
self.with_df = df.DF(mol)
40+
self.with_df.auxbasis = predefined_auxbasis(mol, mol.basis, mp2fit=True)
4041

4142
def reset(self, mol=None):
4243
self.with_df.reset(mol)

pyscf/cc/dfuccsd.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ def __init__(self, mf, frozen=None, mo_coeff=None, mo_occ=None):
3434
if getattr(mf, 'with_df', None):
3535
self.with_df = mf.with_df
3636
else:
37-
self.with_df = df.DF(mf.mol)
38-
self.with_df.auxbasis = predefined_auxbasis(mf.mol, basis, mp2fit=True)
37+
mol = mf.mol
38+
self.with_df = df.DF(mol)
39+
self.with_df.auxbasis = predefined_auxbasis(mol, mol.basis, mp2fit=True)
3940

4041
def reset(self, mol=None):
4142
self.with_df.reset(mol)

pyscf/cc/test/test_h2o.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from pyscf.cc import uccsd
2626
from pyscf.cc import gccsd
2727
from pyscf.cc import rccsd
28-
from pyscf.cc import dfccsd
28+
from pyscf.cc import dfccsd, dfuccsd
2929

3030
def setUpModule():
3131
global mol, mf
@@ -198,8 +198,8 @@ def test_init(self):
198198
self.assertTrue(not isinstance(cc.CCSD(umf.newton().density_fit()), dfuccsd.UCCSD))
199199
self.assertTrue(isinstance(cc.CCSD(dfumf.newton().density_fit()), dfuccsd.UCCSD))
200200

201-
self.assertTrue(isinstance(dfmf.CCSD, dfccsd.CCSD))
202-
self.assertTrue(isinstance(dfumf.CCSD, dfuccsd.UCCSD))
201+
self.assertTrue(isinstance(dfmf.CCSD(), dfccsd.RCCSD))
202+
self.assertTrue(isinstance(dfumf.CCSD(), dfuccsd.UCCSD))
203203

204204
self.assertTrue(isinstance(cc.CCSD(mf, mo_coeff=mf.mo_coeff*1j), rccsd.RCCSD))
205205

pyscf/gto/mole.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3859,8 +3859,8 @@ def to_cell(self, box=None, dimension=0, margin=None):
38593859
# ~psi^2 is approximately ~1e-8
38603860
shell_radius = rcut_by_shells(self, precision=1e-4)
38613861
bas_coords = atom_coords[self._bas[:,ATOM_OF]]
3862-
upper_bound = (bas_coords + shell_radius).max(axis=0)
3863-
lower_bound = (bas_coords - shell_radius).min(axis=0)
3862+
upper_bound = (bas_coords + shell_radius[:,None]).max(axis=0)
3863+
lower_bound = (bas_coords - shell_radius[:,None]).min(axis=0)
38643864
box_size = upper_bound - lower_bound
38653865
box = numpy.diag(box_size)
38663866
else:

pyscf/mcscf/df.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def density_fit(casscf, auxbasis=None, with_df=None):
6363
else:
6464
mol = casscf.mol
6565
if auxbasis is None and isinstance(mol.basis, str):
66-
auxbasis = predefined_auxbasis(mol, mol.basis, xc)
66+
auxbasis = predefined_auxbasis(mol, mol.basis, xc='HF')
6767
with_df = df.DF(mol, auxbasis)
6868
with_df.max_memory = casscf.max_memory
6969
with_df.stdout = casscf.stdout

pyscf/mp/dfmp2.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,9 @@ def __init__(self, mf, frozen=None, mo_coeff=None, mo_occ=None, mo_energy=None):
133133
if getattr(mf, 'with_df', None):
134134
self.with_df = mf.with_df
135135
else:
136-
self.with_df = df.DF(mf.mol)
137-
self.with_df.auxbasis = predefined_auxbasis(mf.mol, basis, mp2fit=True)
136+
mol = mf.mol
137+
self.with_df = df.DF(mol)
138+
self.with_df.auxbasis = predefined_auxbasis(mol, mol.basis, mp2fit=True)
138139

139140
# DEBUG:
140141
self.force_outcore = False

pyscf/mp/dfump2.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,7 @@ def init_amps(self, mo_energy=None, mo_coeff=None, eris=None, with_t2=WITH_T2):
216216
MP2 = UMP2 = DFUMP2
217217

218218
from pyscf import scf
219-
scf.uhf.UHF.DFMP2 = DFUMP2
220-
219+
scf.uhf.UHF.DFMP2 = lib.class_as_method(DFUMP2)
221220
del (WITH_T2)
222221

223222

pyscf/mp/test/test_mp2.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ def test_rdm_complex(self):
283283

284284
def test_init_mp2(self):
285285
mf0 = mf
286-
mf1 = scf.RHF(gto.M(atom='H', spin=1))
286+
mf1 = scf.RHF(gto.M(atom='H', spin=1)).run()
287287
dfmf0 = mf0.density_fit()
288288
dfmf1 = mf1.density_fit()
289289
self.assertTrue(isinstance(mp.MP2(mf0), mp.mp2.RMP2))
@@ -293,10 +293,11 @@ def test_init_mp2(self):
293293
self.assertTrue(isinstance(mp.MP2(mf0.newton()), mp.mp2.RMP2))
294294
self.assertTrue(isinstance(mp.MP2(mf1.newton()), mp.ump2.UMP2))
295295

296+
dfumf = dfmf0.to_uhf()
297+
dfgmf = dfmf0.to_ghf()
296298
self.assertTrue(isinstance(dfmf0.MP2(), mp.dfmp2.DFMP2))
297-
self.assertTrue(isinstance(dfmf1.MP2(), mp.dfump2.DFUMP2))
298-
dfmf2 = dfmf0.to_ghf()
299-
self.assertTrue(isinstance(dfmf2.MP2(), mp.dfgmp2.DFGMP2))
299+
self.assertTrue(isinstance(dfumf.MP2(), mp.dfump2.DFUMP2))
300+
self.assertTrue(isinstance(dfgmf.MP2(), mp.dfgmp2.DFGMP2))
300301

301302
def test_mp2_scanner(self):
302303
pt_scanner = mp.MP2(mf).as_scanner()

0 commit comments

Comments
 (0)