Exemplo n.º 1
0
 def ccsd(self, t1=None, t2=None, eris=None, mbpt2=False):
     if mbpt2:
         pt = mp.RMP2(self._scf, self.frozen, self.mo_coeff, self.mo_occ)
         self.e_corr, self.t2 = pt.kernel(eris=eris)
         nocc, nvir = self.t2.shape[1:3]
         self.t1 = numpy.zeros((nocc, nvir))
         return self.e_corr, self.t1, self.t2
     return rccsd.RCCSD.ccsd(self, t1, t2, eris)
Exemplo n.º 2
0
 def ccsd(self, t1=None, t2=None, eris=None, mbpt2=False):
     from pyscf.pbc.df.df_ao2mo import warn_pbc2d_eri
     warn_pbc2d_eri(self._scf)
     if mbpt2:
         pt = mp.RMP2(self._scf, self.frozen, self.mo_coeff, self.mo_occ)
         self.e_corr, self.t2 = pt.kernel(eris=eris)
         nocc, nvir = self.t2.shape[1:3]
         self.t1 = numpy.zeros((nocc, nvir))
         return self.e_corr, self.t1, self.t2
     return rccsd.RCCSD.ccsd(self, t1, t2, eris)
Exemplo n.º 3
0
mypt = mp.KMP2(kmf)
mypt.kernel()
print("KMP2 energy (per unit cell) =", mypt.e_tot)

#
# The PBC module provides an separated implementation specified for the single
# k-point calculations.  They are more efficient than the general implementation
# with k-point sampling.  For gamma point, integrals and orbitals are all real
# in this implementation.  They can be mixed with other post-HF methods that
# were provided in the molecular program.
#
kpt = cell.get_abs_kpts([0.25, 0.25, 0.25])
mf = scf.RHF(cell, kpt=kpt)
ehf = mf.kernel()

mypt = mp.RMP2(mf).run()
print("RMP2 energy (per unit cell) at k-point =", mypt.e_tot)
dm1 = mypt.make_rdm1()
dm2 = mypt.make_rdm2()
nmo = mf.mo_coeff.shape[1]
eri_mo = mf.with_df.ao2mo(mf.mo_coeff, kpts=kpt).reshape([nmo] * 4)
h1 = reduce(numpy.dot, (mf.mo_coeff.conj().T, mf.get_hcore(), mf.mo_coeff))
e_tot = numpy.einsum(
    'ij,ji', h1,
    dm1) + numpy.einsum('ijkl,jilk', eri_mo, dm2) * .5 + mf.energy_nuc()
print("RMP2 energy based on MP2 density matrices =", e_tot.real)

mf = scf.addons.convert_to_uhf(mf)
mypt = mp.UMP2(mf).run()
print("UMP2 energy (per unit cell) at k-point =", mypt.e_tot)
dm1a, dm1b = mypt.make_rdm1()