Skip to content

Commit c573058

Browse files
committed
Fix BPC 0d HF tests
1 parent 64afa71 commit c573058

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

pyscf/pbc/scf/test/test_hf.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,11 @@ def test_rhf_0d(self):
268268
basis = { 'He': [[0, (0.8, 1.0)],
269269
[0, (1.0, 1.0)],
270270
[0, (1.2, 1.0)]]})
271-
eref = cell.to_mol().RHF().density_fit().kernel()
271+
eref = cell.to_mol().RHF().kernel()
272272

273273
mf = cell.RHF()
274274
mf.with_df = pdf.AFTDF(cell)
275275
e1 = mf.kernel()
276-
self.assertAlmostEqual(eref, -4.165713858819728, 8)
277276
self.assertAlmostEqual(e1, eref, 4)
278277

279278
eref = cell.to_mol().RHF().density_fit().kernel()

pyscf/pbc/x2c/sfx2c1e.py

+5
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ def __init__(self, cell, kpts=None):
120120
self.cell = cell
121121
x2c.X2C.__init__(self, cell)
122122

123+
def reset(self, cell=None):
124+
if cell is not None:
125+
self.cell = cell
126+
return self
127+
123128
class SpinFreeX2CHelper(PBCX2CHelper):
124129
'''1-component X2c Foldy-Wouthuysen (FW Hamiltonian (spin-free part only)
125130
'''

pyscf/x2c/x2c.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,10 @@ def _get_rmat(self, x=None):
264264
s1 = s + reduce(numpy.dot, (x.conj().T, t, x)) * (.5/c**2)
265265
return _get_r(s, s1)
266266

267-
def reset(self, mol):
267+
def reset(self, mol=None):
268268
'''Reset mol and clean up relevant attributes for scanner mode'''
269-
self.mol = mol
269+
if mol is not None:
270+
self.mol = mol
270271
return self
271272

272273
class SpinorX2CHelper(X2CHelperBase):
@@ -725,7 +726,7 @@ def dump_flags(self, verbose=None):
725726
self.with_x2c.dump_flags(verbose)
726727
return self
727728

728-
def reset(self, mol):
729+
def reset(self, mol=None):
729730
self.with_x2c.reset(mol)
730731
return super().reset(mol)
731732

0 commit comments

Comments
 (0)