def test_cplx(self): """Tests whether complex conjugation is handled correctly.""" # Perform mf calculation model_rhf = RHF(self.cell) model_rhf.kernel() # Add random phases import numpy numpy.random.seed(0) p = numpy.exp(2.j * numpy.pi * numpy.random.rand(model_rhf.mo_coeff.shape[1])) model_rhf.mo_coeff = model_rhf.mo_coeff * p[numpy.newaxis, :] m_ref = PhysERI(model_rhf).tdhf_full_form() td_model_rhf = TDRHF(model_rhf) assert not td_model_rhf.fast td_model_rhf.kernel() with self.assertRaises(ValueError): td_model_rhf.fast = True td_model_rhf.kernel() self.assertIsInstance(td_model_rhf.eri, PhysERI4) m = td_model_rhf.eri.tdhf_full_form() testing.assert_allclose(m, m_ref, atol=1e-14)
cell = gto.M(a=axes, atom=atoms, verbose=3, gs=gs, pseudo={'C': 'bfd'}, basis=basis) mf = RHF(cell) mf.chkfile = chkfile_fname mf.conv_tol = 1e-6 # run or load RHF if os.path.isfile(chkfile_fname): from pyscf import lib mf.__dict__.update(lib.chkfile.load(chkfile_fname, 'scf')) else: mf.kernel() # end if # grid density for molecular orbital mydgs = 16 dgs = np.array([mydgs] * 3) moR_fname = 'gs%d_' % mydgs + moR_fname # run or load moR if os.path.isfile(moR_fname): moR = np.loadtxt(moR_fname) else: from pyscf.pbc.gto.cell import gen_uniform_grids from pyscf.pbc.dft.numint import eval_ao coords = gen_uniform_grids(cell, gs=dgs) aoR = eval_ao(cell, coords) moR = np.dot(aoR, mf.mo_coeff)