C S 4.3362376436 0.1490797872 1.2881838513 -0.0292640031 0.4037767149 -0.688204051 0.1187877657 -0.3964426906 C P 4.3362376436 -0.0878123619 1.2881838513 -0.27755603 0.4037767149 -0.4712295093 0.1187877657 -0.4058039291 ''') cell.verbose = 6 cells.append(cell) for cell in cells: kpts = cell.make_kpts([3, 1, 1]) mf = cell.KRHF(kpts=kpts) #.run() #dm = mf.make_rdm1() np.random.seed(1) dm = (np.random.rand(len(kpts), cell.nao, cell.nao) + np.random.rand(len(kpts), cell.nao, cell.nao) * 1j) dm = dm + dm.transpose(0, 2, 1).conj() kmesh = k2gamma.kpts_to_kmesh(cell, kpts) phase = k2gamma.get_phase(cell, kpts, kmesh)[1] dm = lib.einsum('Rk,kuv,Sk->RSuv', phase.conj().T, dm, phase.T) dm = lib.einsum('Rk,RSuv,Sk->kuv', phase, dm.real, phase.conj()) jref, kref = mf.get_jk(cell, dm, kpts=kpts) ej = np.einsum('kij,kji->', jref, dm) ek = np.einsum('kij,kji->', kref, dm) * .5
from pyscf.pbc.gto import Cell from pyscf.pbc.scf import KRHF from pyscf.pbc.tdscf.krhf_slow import TDRHF from pyscf.pbc.gw import KRGW cell = Cell() cell.atom = ''' C 0.000000000000 0.000000000000 0.000000000000 C 1.67 1.68 1.69 ''' cell.basis = {'C': [[0, (0.8, 1.0)], [1, (1.0, 1.0)]]} cell.pseudo = 'gth-pade' cell.a = ''' 0.000000000, 3.370137329, 3.370137329 3.370137329, 0.000000000, 3.370137329 3.370137329, 3.370137329, 0.000000000''' cell.unit = 'B' cell.verbose = 7 cell.build() model = KRHF(cell, cell.make_kpts([2, 1, 1])) model.kernel() model_td = TDRHF(model) model_td.kernel() model_gw = KRGW(model_td) model_gw.kernel() print(model_gw.mo_energy)