Exemple #1
0
    def __init__(self, myci, mo_coeff=None):
        if mo_coeff is None:
            mo_coeff = myci._scf.mo_coeff
        mol = myci.mol
        nocc = myci.nocc
        nmo = myci.nmo
        nvir = nmo - nocc
        moidx = uccsd.get_umoidx(myci)
        self.fock, mo_coeff, orbspin = uccsd.uspatial2spin(
            myci, moidx, mo_coeff)
        self.mo_coeff = mo_coeff
        myci.orbspin = self.orbspin = orbspin

        eri = ao2mo.kernel(myci._scf._eri, mo_coeff, compact=False)
        eri = eri.reshape([nmo] * 4)
        for i in range(nmo):
            for j in range(i):
                if orbspin[i] != orbspin[j]:
                    eri[i, j, :, :] = eri[j, i, :, :] = 0.
                    eri[:, :, i, j] = eri[:, :, j, i] = 0.
        eri = eri - eri.transpose(0, 3, 2, 1)
        eri = eri.transpose(0, 2, 1, 3)

        self.oooo = eri[:nocc, :nocc, :nocc, :nocc]
        self.ovvo = eri[:nocc, nocc:, nocc:, :nocc]
        self.ovov = eri[:nocc, nocc:, :nocc, nocc:]
        self.ooov = eri[:nocc, :nocc, :nocc, nocc:]
        self.ovoo = eri[:nocc, nocc:, :nocc, :nocc]
        self.oovv = eri[:nocc, :nocc, nocc:, nocc:]
        self.ovvv = eri[:nocc, nocc:, nocc:, nocc:]
        self.vvvv = eri[nocc:, nocc:, nocc:, nocc:]
Exemple #2
0
    def __init__(self, cc, mo_coeff=None, 
                 ao2mofn=pyscf.ao2mo.outcore.general_iofree):
        cput0 = (time.clock(), time.time())
        moidx = uccsd.get_umoidx(cc)
        if mo_coeff is None:
            self.mo_coeff = mo_coeff = [cc.mo_coeff[0][:,moidx[0]], 
                                        cc.mo_coeff[1][:,moidx[1]]]
        else:
            self.mo_coeff = mo_coeff = [mo_coeff[0][:,moidx[0]], 
                                        mo_coeff[1][:,moidx[1]]]

        nocc = cc.nocc
        nmo = cc.nmo
        nvir = nmo - nocc

        self.fock, so_coeff, spin = uccsd.uspatial2spin(cc, moidx, mo_coeff)

        log = logger.Logger(cc.stdout, cc.verbose)

        orbo = so_coeff[:,:nocc]
        orbv = so_coeff[:,nocc:]
        eri = ao2mofn(cc._scf.mol, (orbo,orbv,orbo,orbv), compact=0)
        if mo_coeff[0].dtype == np.float: eri = eri.real
        eri = eri.reshape((nocc,nvir,nocc,nvir))
        for i in range(nocc):
            for a in range(nvir):
                if spin[i] != spin[nocc+a]:
                    eri[i,a,:,:] = eri[:,:,i,a] = 0.
        eri1 = eri - eri.transpose(0,3,2,1) 
        eri1 = eri1.transpose(0,2,1,3) 

        self.dtype = eri1.dtype
        self.oovv = eri1

        log.timer('MP2 integral transformation', *cput0)
Exemple #3
0
    def __init__(self,
                 cc,
                 mo_coeff=None,
                 ao2mofn=pyscf.ao2mo.outcore.general_iofree):
        cput0 = (time.clock(), time.time())
        moidx = uccsd.get_umoidx(cc)
        if mo_coeff is None:
            self.mo_coeff = mo_coeff = [
                cc.mo_coeff[0][:, moidx[0]], cc.mo_coeff[1][:, moidx[1]]
            ]
        else:
            self.mo_coeff = mo_coeff = [
                mo_coeff[0][:, moidx[0]], mo_coeff[1][:, moidx[1]]
            ]

        nocc = cc.nocc
        nmo = cc.nmo
        nvir = nmo - nocc

        self.fock, so_coeff, spin = uccsd.uspatial2spin(cc, moidx, mo_coeff)

        log = logger.Logger(cc.stdout, cc.verbose)

        orbo = so_coeff[:, :nocc]
        orbv = so_coeff[:, nocc:]
        eri = ao2mofn(cc._scf.mol, (orbo, orbv, orbo, orbv), compact=0)
        if mo_coeff[0].dtype == np.float: eri = eri.real
        eri = eri.reshape((nocc, nvir, nocc, nvir))
        for i in range(nocc):
            for a in range(nvir):
                if spin[i] != spin[nocc + a]:
                    eri[i, a, :, :] = eri[:, :, i, a] = 0.
        eri1 = eri - eri.transpose(0, 3, 2, 1)
        eri1 = eri1.transpose(0, 2, 1, 3)

        self.dtype = eri1.dtype
        self.oovv = eri1

        log.timer('MP2 integral transformation', *cput0)