def test_gw_exact(self): mol = gto.Mole() mol.verbose = 7 mol.output = '/dev/null' mol.atom = [['O', (0., 0., 0.)], ['H', (0., -0.757, 0.587)], ['H', (0., 0.757, 0.587)]] mol.basis = 'cc-pvdz' mol.build() mf = dft.RKS(mol) mf.xc = 'hf' mf.kernel() nocc = mol.nelectron // 2 nvir = mf.mo_energy.size - nocc td = tdscf.dRPA(mf) td.nstates = min(100, nocc * nvir) td.kernel() gw_obj = gw.GW(mf, freq_int='exact', frozen=0) gw_obj.kernel() gw_obj.linearized = True gw_obj.kernel(orbs=[nocc - 1, nocc]) self.assertAlmostEqual(gw_obj.mo_energy[nocc - 1], -0.44684106, 7) self.assertAlmostEqual(gw_obj.mo_energy[nocc], 0.17292032, 7)
def test_gwcd(self): nocc = mol.nelectron // 2 gw_obj = gw.GW(mf, freq_int='cd', frozen=0) gw_obj.linearized = False gw_obj.kernel(orbs=range(0, nocc + 3)) self.assertAlmostEqual(gw_obj.mo_energy[nocc - 1], -0.41284735, 5) self.assertAlmostEqual(gw_obj.mo_energy[nocc], 0.16574524, 5) self.assertAlmostEqual(gw_obj.mo_energy[0], -19.53387986, 5)
def test_gwac_pade(self): nocc = mol.nelectron // 2 gw_obj = gw.GW(mf, freq_int='ac', frozen=0) gw_obj.linearized = False gw_obj.ac = 'pade' gw_obj.kernel(orbs=range(nocc - 3, nocc + 3)) self.assertAlmostEqual(gw_obj.mo_energy[nocc - 1], -0.412849230989, 5) self.assertAlmostEqual(gw_obj.mo_energy[nocc], 0.165745160102, 5)
#!/usr/bin/env python ''' GW calculation with contour deformation ''' from pyscf import gto, dft, gw mol = gto.M(atom='H 0 0 0; F 0 0 1.1', basis='ccpvdz') mf = dft.RKS(mol) mf.xc = 'pbe' mf.kernel() nocc = mol.nelectron // 2 gw = gw.GW(mf, freq_int='cd') gw.kernel(orbs=range(nocc - 3, nocc + 3)) print(gw.mo_energy)
#!/usr/bin/env python ''' GW calculation with exact frequency integration ''' from pyscf import gto, dft, gw mol = gto.M( atom = 'H 0 0 0; F 0 0 1.1', basis = 'ccpvdz') mf = dft.RKS(mol) mf.xc = 'pbe' mf.kernel() nocc = mol.nelectron//2 gw = gw.GW(mf, freq_int='exact') gw.kernel() print(gw.mo_energy)
#!/usr/bin/env python ''' GW calculation with exact frequency integration and TDDFT screening instead of dRPA ''' from pyscf import gto, dft, gw mol = gto.M(atom='H 0 0 0; F 0 0 1.1', basis='ccpvdz') mf = dft.RKS(mol) mf.xc = 'pbe' mf.kernel() from pyscf import tdscf nocc = mol.nelectron // 2 nmo = mf.mo_energy.size nvir = nmo - nocc td = tdscf.TDDFT(mf) td.nstates = nocc * nvir td.verbose = 0 td.kernel() gw = gw.GW(mf, freq_int='exact', tdmf=td) gw.kernel() print(gw.mo_energy)
#!/usr/bin/env python ''' A simple example to run a GW calculation ''' from pyscf import gto, dft, gw mol = gto.M(atom='H 0 0 0; F 0 0 1.1', basis='ccpvdz') mf = dft.RKS(mol) mf.xc = 'pbe' mf.kernel() nocc = mol.nelectron // 2 # By default, GW is done with analytic continuation gw = gw.GW(mf) # same as gw = gw.GW(mf, freq_int='ac') gw.kernel(orbs=range(nocc - 3, nocc + 3)) print(gw.mo_energy)