Exemple #1
0
 def __init__(self, mol, mints):
     uhf = UHF(mol, mints)
     uhf.compute_energy()
     self.g = transform_tei(
         uhf.g, uhf.C
     )  # antisymmetrized two-electron integrals, spin-orbital (MO) basis
     self.uhf = uhf
Exemple #2
0
    def __init__(self, mol, mints):

        uhf = UHF(mol, mints)
        uhf.compute_energy()

        nbf = uhf.nbf
        self.nocc = uhf.nocc
        self.nvirtual = 2 * nbf - self.nocc
        self.ndet = self.nvirtual * self.nocc

        self.E0 = uhf.E
        self.e = uhf.e
        self.C = uhf.C
        self.g = uhf.g
Exemple #3
0
	def __init__(self,options):

		self.options = options

		self.Ec    = 0.0
		uhf = UHF(options)
		self.E0    = uhf.computeEnergy()
		self.nocc  = uhf.nelec
		self.norb  = uhf.norb
		self.mol   = uhf.mol
		self.e     = uhf.e
		self.C     = uhf.C
		self.uhf   = uhf
		self.df    = int( options['MP2']['df'] )
		self.GMO   = self.transformTEI( uhf.G, uhf.C )	
Exemple #4
0
    def __init__(self, options):

        self.conv = 10**(-int(options['CEPA0']['conv']))
        self.tConv = 10**(-int(options['CEPA0']['t_conv']))
        self.maxiter = int(options['CEPA0']['max_iter'])
        self.options = options

        uhf = UHF(options)
        mp2 = MP2(options)

        self.E0 = uhf.computeEnergy()
        self.uhf = uhf
        self.mp2 = mp2

        self.t = np.zeros((uhf.nelec, uhf.nelec, uhf.nvirt, uhf.nvirt))
        self.Ec = 0.0
Exemple #5
0
    def __init__(self, options):

        self.conv = 10**(-int(options['CCD']['conv']))
        self.tConv = 10**(-int(options['CCD']['t_conv']))
        self.maxiter = int(options['CCD']['max_iter'])
        self.options = options

        uhf = UHF(options)
        mp2 = MP2(options)

        self.E0 = uhf.computeEnergy()
        self.e = uhf.e
        self.Ec = 0.0
        self.nocc = uhf.nelec
        self.nvirt = uhf.norb - uhf.nelec
        self.GMO = mp2.transformTEI(uhf.G, uhf.C)
        self.t = np.zeros((self.nocc, self.nocc, self.nvirt, self.nvirt))
Exemple #6
0
    def __init__(self, mol, mints):
        """
        Create a class to compute ccd energy
        """

        uhf = UHF(mol, mints)
        uhf.compute_energy()

        # import from uhf
        self.e, self.C, self.G = uhf.e, uhf.C, uhf.g
        self.maxiter, self.conv = uhf.maxiter, uhf.conv

        self.nbf, self.nocc = uhf.nbf, uhf.nocc
        self.nvirt = 2 * self.nbf - self.nocc

        self.Ec = 0.0
        self.t = np.zeros((self.nocc, self.nocc, self.nvirt, self.nvirt))
Exemple #7
0
    def __init__(self, options):

        uhf = UHF(options)

        uhf.computeEnergy()

        self.nocc = uhf.nocc
        self.nvirt = uhf.norb - self.nocc
        self.E0 = uhf.E
        self.e = uhf.e

        mp2 = MP2(options)
        self.GMO = mp2.transformTEI(uhf.G, uhf.C)

        print("-----------------------------------")
        print("| Output for CI Singles Procedure |")
        print("-----------------------------------")
        print("\n @UHF Energy:   %f" % uhf.E)
Exemple #8
0
    def __init__(self, options):

        self.options = options

        self.Ec = 0.0
        uhf = UHF(options)
        self.E0 = uhf.computeEnergy()
        self.nocc = uhf.nocc
        self.norb = uhf.norb
        self.mol = uhf.mol
        self.e = uhf.e
        self.C = uhf.C
        self.uhf = uhf
        self.df = int(options['MP2']['df'])

        self.G = uhf.G - uhf.G.transpose((0, 1, 3, 2))
        self.Gmo = self.transformTEI(uhf.G, uhf.C)

        self.dfBasisName = ""
Exemple #9
0
    def __init__(self, options):

        uhf = UHF(options)

        self.E0 = uhf.computeEnergy()
        self.e = uhf.e
        self.C = uhf.C
        self.nocc = uhf.nelec
        self.norb = uhf.norb
        self.uhf = uhf

        df = int(options['MP2']['df'])

        if df:
            dfBasisName = options['DEFAULT']['df_basis']
            dfBasis = psi4.core.BasisSet.build(uhf.mol,
                                               "DF_BASIS_MP2",
                                               dfBasisName,
                                               puream=0)
            self.G = self.densityFit(options, dfBasis)

        else:
            self.G = self.transformTEI(uhf.G, uhf.C)
Exemple #10
0
def spin_block_oei(hao):
    hao = la.block_diag(hao,hao)
    return hao

def int_trans_oei(hao, C):

    return np.einsum('pQ, pP -> PQ',
           np.einsum('pq, qQ -> pQ', hao, C),C)

def int_trans(gao, C):

    return np.einsum('pQRS, pP -> PQRS',
           np.einsum('pqRS, qQ -> pQRS',
           np.einsum('pqrS, rR -> pqRS',
           np.einsum('pqrs, sS -> pqrS', gao, C),C),C),C)


if __name__ == '__main__':
    uhf = UHF('Options1.ini')
    uhf.get_energy()
    omp2 = OMP2(uhf)
    omp2.get_energy()
    psi4.set_options({'basis':'sto-3g',
                        'scf_type': 'pk',
                        'MP2_type' : 'conv',
                        'puream' : False,
                        'reference': 'uhf',
                        'guess' : 'core',
                        'e_convergence' : 1e-10})
    #psi4.energy('omp2')
Exemple #11
0

def int_trans_1(gao, C):
    return np.einsum('pqrs, pP, qQ, rR, sS -> PQRS', gao, C, C, C, C)


def int_trans_2(gao, C1, C2, C3, C4):

    return np.einsum(
        'pQRS, pP -> PQRS',
        np.einsum(
            'pqRS, qQ -> pQRS',
            np.einsum('pqrS, rR -> pqRS', np.einsum('pqrs, sS -> pqrS', gao,
                                                    C1), C2), C3), C4)


def int_trans_df(b_pqP, C):
    a = np.einsum('pqP,pi -> iqP', b_pqP, C)
    return np.einsum('iqP,qa -> iaP', a, C)


if __name__ == '__main__':
    uhf = UHF('Options.ini')
    uhf.get_energy()
    cepa0 = CEPA0(uhf)
    if cepa0.den_fit == 1:
        cepa0.get_energy()
        cepa0.get_energy_df()
    else:
        cepa0.get_energy()
Exemple #12
0
                                                                        b - 1]
                    if b >= 2:
                        I[a, b] += (b - 1) / (2 * alpha) * I[a, b - 2]

            xyz.append(I)

        return xyz


if __name__ == '__main__':
    config = configparser.ConfigParser()
    config.read('Options.ini')

    mol = psi4.geometry(config['DEFAULT']['molecule'])
    basis = psi4.core.BasisSet.build(mol,
                                     'BASIS',
                                     config['DEFAULT']['basis'],
                                     puream=0)
    mints = psi4.core.MintsHelper(basis)

    scf = config['SCF']
    maxit = scf['max_iter']
    conv = scf['conv']

    uhf = UHF(mol, mints, maxit, conv)
    integrals = Integrals(basis, mol, uhf)

    #print( integrals.computeOverlap() - uhf.S)
    #print( integrals.computeKinetic() - uhf.T )
    print("Dipole moment= ", integrals.computeDipole())
Exemple #13
0
import psi4
import numpy as np
import sys
import scipy.linalg as la
sys.path.insert(0, '../../5/bz3wp')
from uhf import UHF

class CCD:
        
    def __init__(self, uhf):                             # getting class variables from UHF
        self.e = uhf.e                                   # UHF orbital energies
        self.E0 = uhf.E_SCF                              # UHF energy
        self.nocc = uhf.nocc                             # number of occupied orbitals
        self.nto = uhf.nto                               # total number of spin orbitals
        self.vir = self.nto - self.nocc                  # number of virtual orbitals
        self.ndet = self.nocc*self.vir
        self.C = uhf.C                                   # MO coefficients
    
    
# testing
if __name__=='__main__':

    uhf = UHF('../../5/bz3wp/Options.ini')
    uhf.get_energy()
Exemple #14
0
        g = self.gmo
        o = slice(None, self.nocc)
        v = slice(self.nocc, None)
        w0 = g[o, o, v, v]
        w1 = 1 / 2 * np.einsum('abcd,ijcd->ijab', g[v, v, v, v], t)
        w2 = 1 / 2 * np.einsum('klij,klab->ijab', g[o, o, o, o], t)
        w3 = np.einsum('akic,jkbc->ijab', g[v, o, o, v], t)
        w3 += -w3.transpose(
            (0, 1, 3, 2)) - w3.transpose(1, 0, 2, 3) - w3.transpose(
                (1, 0, 3, 2))
        w4 = np.einsum('klcd,ijac,klbd->ijab', g[o, o, v, v], t, t)
        w4 += -w4.transpose((0, 1, 3, 2))
        w5 = 1 / 2 * np.einsum('klcd,ikab,jlcd->ijab', g[o, o, v, v], t, t)
        w5 += w5.transpose((1, 0, 2, 3))
        w6 = 1 / 4 * np.einsum('klcd,ijcd,klab->ijab', g[o, o, v, v], t, t)
        w7 = 1 / 4 * np.einsum('klcd,ikac,jlbd->ijab', g[o, o, v, v], t, t)
        w7 += w7.transpose((1, 0, 2, 3))

        return w0 + w1 + w2 + w3 + w4 + w5 + w6 + w7


if __name__ == "__main__":
    import sys
    sys.path.insert(0, '../../5/jevandezande')
    from uhf import UHF
    uhf = UHF('../../3/jevandezande/Options.ini')
    uhf.energy()
    ccd = CCD(uhf)
    ccd.energy()
    ccd.plot_convergence()
Exemple #15
0
def int_trans_1(gao, C):
    return np.einsum('pqrs, pP, qQ, rR, sS -> PQRS', gao, C, C, C, C)


def int_trans_2(gao, C):

    return np.einsum(
        'pQRS, pP -> PQRS',
        np.einsum(
            'pqRS, qQ -> pQRS',
            np.einsum('pqrS, rR -> pqRS', np.einsum('pqrs, sS -> pqrS', gao,
                                                    C), C), C), C)


if __name__ == '__main__':
    uhf = UHF('Optionsoooh.ini')
    uhf.get_energy()
    mp2 = MP2(uhf)
    mp2.get_energy()
    psi4.set_options({
        'basis': 'sto-3g',
        'scf_type': 'pk',
        'MP2_type': 'conv',
        'puream': False,
        'reference': 'uhf',
        'guess': 'core',
        'e_convergence': 1e-10
    })
    psi4.energy('mp2')