diff --git a/pyscf/grad/test/test_tdrhf_grad.py b/pyscf/grad/test/test_tdrhf_grad.py index 8f2e259684..e936fbfe45 100644 --- a/pyscf/grad/test/test_tdrhf_grad.py +++ b/pyscf/grad/test/test_tdrhf_grad.py @@ -183,7 +183,7 @@ def test_tdhf_singlet(self): td_solver = td.as_scanner() e1 = td_solver(pmol.set_geom_('H 0 0 1.805; F 0 0 0', unit='B')) e2 = td_solver(pmol.set_geom_('H 0 0 1.803; F 0 0 0', unit='B')) - self.assertAlmostEqual((e1[2]-e2[2])/.002, g1[0,2], 6) + self.assertAlmostEqual((e1[2]-e2[2])/.002, g1[0,2], 5) def test_tdhf_triplet(self): td = tdscf.TDDFT(mf).run(singlet=False, nstates=nstates) diff --git a/pyscf/grad/test/test_tdrks_grad.py b/pyscf/grad/test/test_tdrks_grad.py index 972d6eceae..b7e11cbb5b 100644 --- a/pyscf/grad/test/test_tdrks_grad.py +++ b/pyscf/grad/test/test_tdrks_grad.py @@ -103,7 +103,7 @@ def test_tda_triplet_b3lyp(self): td = tdscf.TDA(mf).run(singlet=False, nstates=nstates) tdg = td.nuc_grad_method() g1 = tdg.kernel(state=3) - self.assertAlmostEqual(g1[0,2], -0.3633375, 6) + self.assertAlmostEqual(g1[0,2], -0.3633375, 5) td_solver = td.as_scanner() pmol = mol.copy() diff --git a/pyscf/pbc/dft/numint.py b/pyscf/pbc/dft/numint.py index e1aabfb4a8..d660851343 100644 --- a/pyscf/pbc/dft/numint.py +++ b/pyscf/pbc/dft/numint.py @@ -322,7 +322,6 @@ def nr_rks(ni, cell, grids, xc_code, dms, spin=0, relativity=0, hermi=1, excsum is the XC functional value. vmat is the XC potential matrix in 2D array of shape (nao,nao) where nao is the number of AO functions. ''' - assert hermi == 1 if kpts is None: kpts = numpy.zeros((1,3)) elif isinstance(kpts, KPoints): @@ -356,7 +355,7 @@ def nr_rks(ni, cell, grids, xc_code, dms, spin=0, relativity=0, hermi=1, in ni.block_loop(cell, grids, nao, ao_deriv, kpts, kpts_band, max_memory): for i in range(nset): - rho = make_rho(i, ao_k2, mask, xctype) + rho = make_rho(i, ao_k2, mask, xctype).real exc, vxc = ni.eval_xc_eff(xc_code, rho, deriv, xctype=xctype)[:2] if xctype == 'LDA': den = rho*weight @@ -423,7 +422,6 @@ def nr_uks(ni, cell, grids, xc_code, dms, spin=1, relativity=0, hermi=1, excsum is the XC functional value. vmat is the XC potential matrix in 2D array of shape (nao,nao) where nao is the number of AO functions. ''' - assert hermi == 1 if kpts is None: kpts = numpy.zeros((1,3)) elif isinstance(kpts, KPoints): @@ -461,8 +459,8 @@ def nr_uks(ni, cell, grids, xc_code, dms, spin=1, relativity=0, hermi=1, in ni.block_loop(cell, grids, nao, ao_deriv, kpts, kpts_band, max_memory): for i in range(nset): - rho_a = make_rhoa(i, ao_k2, mask, xctype) - rho_b = make_rhob(i, ao_k2, mask, xctype) + rho_a = make_rhoa(i, ao_k2, mask, xctype).real + rho_b = make_rhob(i, ao_k2, mask, xctype).real rho = (rho_a, rho_b) exc, vxc = ni.eval_xc_eff(xc_code, rho, deriv, xctype=xctype)[:2] if xctype == 'LDA': diff --git a/pyscf/pbc/dft/test/test_numint.py b/pyscf/pbc/dft/test/test_numint.py index 1364d6d4db..57145ee876 100644 --- a/pyscf/pbc/dft/test/test_numint.py +++ b/pyscf/pbc/dft/test/test_numint.py @@ -205,7 +205,7 @@ def test_nr_rks(self): self.assertAlmostEqual(exc, -3.8870579114663886, 8) self.assertAlmostEqual(lib.fp(vmat), 0.42538491159934377+0.14139753327162483j, 8) - ne, exc, vmat = ni.nr_rks(cell, grids, 'blyp', dms[0], 0, kpts[0]) + ne, exc, vmat = ni.nr_rks(cell, grids, 'blyp', dms[0], hermi=0, kpt=kpts[0]) self.assertAlmostEqual(lib.fp(vmat), 0.42538491159934377+0.14139753327162483j, 8) ni = numint.KNumInt() @@ -244,8 +244,8 @@ def test_nr_rks(self): dm = np.random.random((nao,nao)) dm = dm + dm.T ni = numint.NumInt() - ne, exc, vmat1 = ni.nr_rks(cell, grids, 'blyp', dm, 1, kpts[0]) - ne, exc, vmat2 = ni.nr_rks(cell, grids, 'blyp', dm, 0, kpts[0]) + ne, exc, vmat1 = ni.nr_rks(cell, grids, 'blyp', dm, hermi=1, kpt=kpts[0]) + ne, exc, vmat2 = ni.nr_rks(cell, grids, 'blyp', dm, hermi=0, kpt=kpts[0]) self.assertAlmostEqual(lib.fp(vmat1), (6.238900947350686+0.6026114431281391j), 8) self.assertAlmostEqual(abs(vmat1 - vmat2).max(), 0, 9) diff --git a/pyscf/pbc/tdscf/test/test_uhf.py b/pyscf/pbc/tdscf/test/test_uhf.py index 39d4d8042a..cd2202b0e2 100644 --- a/pyscf/pbc/tdscf/test/test_uhf.py +++ b/pyscf/pbc/tdscf/test/test_uhf.py @@ -45,7 +45,7 @@ def setUpClass(cls): cls.cell = cell cls.mf = mf - cls.nstates = 5 # make sure first `nstates_test` states are converged + cls.nstates = 8 # make sure first `nstates_test` states are converged cls.nstates_test = 2 @classmethod def tearDownClass(cls): diff --git a/pyscf/tdscf/test/test_tdrks.py b/pyscf/tdscf/test/test_tdrks.py index febc276e9f..0df6b2f8c1 100644 --- a/pyscf/tdscf/test/test_tdrks.py +++ b/pyscf/tdscf/test/test_tdrks.py @@ -160,7 +160,7 @@ def test_tda_lda_triplet(self): td = rks.TDA(mf_lda) td.singlet = False es = td.kernel(nstates=5)[0] * 27.2114 - self.assertAlmostEqual(lib.fp(es), -39.74044291202006, 5) + self.assertAlmostEqual(lib.fp(es), -39.988118769202416, 5) ref = [9.0139312, 9.0139312, 12.42444659] self.assertAlmostEqual(abs(es[:3] - ref).max(), 0, 4)