#from pyscf import df #auxbasis = df.addons.aug_etb_for_dfbasis(cell, beta=1.5, start_at=0) #from pyscf.pbc.df import mdf #mf.with_df = mdf.MDF(cell) #mf.auxbasis = auxbasis mf = density_fit(mf, auxbasis) mf.with_df.gs = (5, ) * 3 vj = mf.with_df.get_jk(dm, exxdiv=mf.exxdiv, with_k=False)[0] print(numpy.einsum('ij,ji->', vj, dm), 'ref=46.698942480902062') vj, vk = mf.with_df.get_jk(dm, exxdiv=mf.exxdiv) print(numpy.einsum('ij,ji->', vj, dm), 'ref=46.698942480902062') print(numpy.einsum('ij,ji->', vk, dm), 'ref=37.348163681114187') print(numpy.einsum('ij,ji->', mf.get_hcore(cell), dm), 'ref=-75.5758086593503') kpts = cell.make_kpts([2] * 3)[:4] from pyscf.pbc.df import DF with_df = DF(cell, kpts) with_df.auxbasis = 'weigend' with_df.gs = [5] * 3 dms = numpy.array([dm] * len(kpts)) vj, vk = with_df.get_jk(dms, exxdiv=mf.exxdiv, kpts=kpts) print(numpy.einsum('ij,ji->', vj[0], dms[0]) - 46.69784067248350) print(numpy.einsum('ij,ji->', vj[1], dms[1]) - 46.69814992718212) print(numpy.einsum('ij,ji->', vj[2], dms[2]) - 46.69526120279135) print(numpy.einsum('ij,ji->', vj[3], dms[3]) - 46.69570739526301) print(numpy.einsum('ij,ji->', vk[0], dms[0]) - 37.26974254415191) print(numpy.einsum('ij,ji->', vk[1], dms[1]) - 37.27001407288309) print(numpy.einsum('ij,ji->', vk[2], dms[2]) - 37.27000643285160) print(numpy.einsum('ij,ji->', vk[3], dms[3]) - 37.27010299675364)
auxbasis = "weigend" # from pyscf import df # auxbasis = df.addons.aug_etb_for_dfbasis(cell, beta=1.5, start_at=0) # from pyscf.pbc.df import mdf # mf.with_df = mdf.MDF(cell) # mf.auxbasis = auxbasis mf = density_fit(mf, auxbasis) mf.with_df.gs = (5,) * 3 vj = mf.with_df.get_jk(dm, exxdiv=mf.exxdiv, with_k=False)[0] print(numpy.einsum("ij,ji->", vj, dm), "ref=46.698942480902062") vj, vk = mf.with_df.get_jk(dm, exxdiv=mf.exxdiv) print(numpy.einsum("ij,ji->", vj, dm), "ref=46.698942480902062") print(numpy.einsum("ij,ji->", vk, dm), "ref=37.348163681114187") kpts = cell.make_kpts([2] * 3)[:4] from pyscf.pbc.df import DF with_df = DF(cell, kpts) with_df.auxbasis = "weigend" with_df.gs = [5] * 3 dms = numpy.array([dm] * len(kpts)) vj, vk = with_df.get_jk(dms, exxdiv=mf.exxdiv, kpts=kpts) print(numpy.einsum("ij,ji->", vj[0], dms[0]) - 46.69784067248350) print(numpy.einsum("ij,ji->", vj[1], dms[1]) - 46.69814992718212) print(numpy.einsum("ij,ji->", vj[2], dms[2]) - 46.69526120279135) print(numpy.einsum("ij,ji->", vj[3], dms[3]) - 46.69570739526301) print(numpy.einsum("ij,ji->", vk[0], dms[0]) - 37.27020025046015) print(numpy.einsum("ij,ji->", vk[1], dms[1]) - 37.27047172558580) print(numpy.einsum("ij,ji->", vk[2], dms[2]) - 37.27046412080765) print(numpy.einsum("ij,ji->", vk[3], dms[3]) - 37.27056060718295)
auxbasis = 'weigend' #from pyscf import df #auxbasis = df.addons.aug_etb_for_dfbasis(cell, beta=1.5, start_at=0) #from pyscf.pbc.df import mdf #mf.with_df = mdf.MDF(cell) #mf.auxbasis = auxbasis mf = density_fit(mf, auxbasis) mf.with_df.mesh = (n,) * 3 vj = mf.with_df.get_jk(dm, exxdiv=mf.exxdiv, with_k=False)[0] print(numpy.einsum('ij,ji->', vj, dm), 'ref=46.698942480902062') vj, vk = mf.with_df.get_jk(dm, exxdiv=mf.exxdiv) print(numpy.einsum('ij,ji->', vj, dm), 'ref=46.698942480902062') print(numpy.einsum('ij,ji->', vk, dm), 'ref=37.348163681114187') print(numpy.einsum('ij,ji->', mf.get_hcore(cell), dm), 'ref=-75.5758086593503') kpts = cell.make_kpts([2]*3)[:4] from pyscf.pbc.df import DF with_df = DF(cell, kpts) with_df.auxbasis = 'weigend' with_df.mesh = [n] * 3 dms = numpy.array([dm]*len(kpts)) vj, vk = with_df.get_jk(dms, exxdiv=mf.exxdiv, kpts=kpts) print(numpy.einsum('ij,ji->', vj[0], dms[0]) - 46.69784067248350) print(numpy.einsum('ij,ji->', vj[1], dms[1]) - 46.69814992718212) print(numpy.einsum('ij,ji->', vj[2], dms[2]) - 46.69526120279135) print(numpy.einsum('ij,ji->', vj[3], dms[3]) - 46.69570739526301) print(numpy.einsum('ij,ji->', vk[0], dms[0]) - 37.26974254415191) print(numpy.einsum('ij,ji->', vk[1], dms[1]) - 37.27001407288309) print(numpy.einsum('ij,ji->', vk[2], dms[2]) - 37.27000643285160) print(numpy.einsum('ij,ji->', vk[3], dms[3]) - 37.27010299675364)
n = 11 cell = pgto.Cell() cell.a = numpy.diag([L,L,L]) cell.mesh = numpy.array([n,n,n]) cell.atom = '''He 3. 2. 3. He 1. 1. 1.''' #cell.basis = {'He': [[0, (1.0, 1.0)]]} #cell.basis = '631g' #cell.basis = {'He': [[0, (2.4, 1)], [1, (1.1, 1)]]} cell.basis = 'ccpvdz' cell.verbose = 0 cell.build(0,0) nao = cell.nao_nr() numpy.random.seed(1) kpts = numpy.random.random((4,3)) kpts[3] = -numpy.einsum('ij->j', kpts[:3]) with_df = DF(cell, kpts) with_df.auxbasis = 'weigend' with_df.mesh = [n] * 3 mo =(numpy.random.random((nao,nao)) + numpy.random.random((nao,nao))*1j) eri = with_df.get_eri(kpts).reshape((nao,)*4) eri0 = numpy.einsum('pjkl,pi->ijkl', eri , mo.conj()) eri0 = numpy.einsum('ipkl,pj->ijkl', eri0, mo ) eri0 = numpy.einsum('ijpl,pk->ijkl', eri0, mo.conj()) eri0 = numpy.einsum('ijkp,pl->ijkl', eri0, mo ) eri1 = with_df.ao2mo(mo, kpts) print(abs(eri1-eri0).sum())