示例#1
0
def main():
    atoms = Molecule('h2',[(1,(1.,0,0)),(1,(-1.,0,0))])
    bfs = getbasis(atoms)
    nel = atoms.get_nel()
    nbf = len(bfs)
    nocc = nel/2
    S,h,Ints = getints(bfs,atoms)
    en,orbe,orbs = rhf(atoms,integrals=(S,h,Ints),)

    emp2 = MP2(Ints,orbs,orbe,nocc,nbf-nocc)  
    return en+emp2
示例#2
0
def main():
    atoms = Molecule('He',
                     [(2,( .0000000000, .0000000000, .0000000000))],
                     units='Angstroms')
    bfs = getbasis(atoms)
    nel = atoms.get_nel()
    nbf = len(bfs)
    nocc = nel/2
    S,h,Ints = getints(bfs,atoms)
    en,orbe,orbs = rhf(atoms,integrals=(S,h,Ints))

    emp2 = MP2(Ints,orbs,orbe,nocc,nbf-nocc)
    return en+emp2
示例#3
0
def main():
    atoms = Molecule('h2', [(1, (1., 0, 0)), (1, (-1., 0, 0))])
    bfs = getbasis(atoms)
    nel = atoms.get_nel()
    nbf = len(bfs)
    nocc = nel / 2
    S, h, Ints = getints(bfs, atoms)
    en, orbe, orbs = rhf(
        atoms,
        integrals=(S, h, Ints),
    )

    emp2 = MP2(Ints, orbs, orbe, nocc, nbf - nocc)
    return en + emp2
示例#4
0
def main():
    atoms = Molecule('ch4', [(6, (.0000000000, .0000000000, .0000000000)),
                             (1, (.0000000000, .0000000000, 1.0836058890)),
                             (1, (1.0216334297, .0000000000, -.3612019630)),
                             (1, (-.5108167148, .8847605034, -.3612019630)),
                             (1, (-.5108167148, -.8847605034, -.3612019630))],
                     units='Angstroms')
    bfs = getbasis(atoms)
    nel = atoms.get_nel()
    nbf = len(bfs)
    nocc = nel / 2
    S, h, Ints = getints(bfs, atoms)
    en, orbe, orbs = rhf(atoms, integrals=(S, h, Ints))
    print "SCF completed, E = ", en

    emp2 = MP2(Ints, orbs, orbe, nocc, nbf - nocc)
    print "MP2 correction = ", emp2
    print "Final energy = ", en + emp2
    return en + emp2
示例#5
0
def main():
    atoms = Molecule('ch4',
                     [(6,( .0000000000, .0000000000, .0000000000)),
                      (1,( .0000000000, .0000000000,1.0836058890)),
                      (1,(1.0216334297, .0000000000,-.3612019630)),
                      (1,(-.5108167148, .8847605034,-.3612019630)),
                      (1,(-.5108167148,-.8847605034,-.3612019630))],
                     units='Angstroms')
    bfs = getbasis(atoms)
    nel = atoms.get_nel()
    nbf = len(bfs)
    nocc = nel/2
    S,h,Ints = getints(bfs,atoms)
    en,orbe,orbs = rhf(atoms,integrals=(S,h,Ints))
    print "SCF completed, E = ",en 

    emp2 = MP2(Ints,orbs,orbe,nocc,nbf-nocc)
    print "MP2 correction = ",emp2 
    print "Final energy = ",en+emp2 
    return en+emp2
示例#6
0
# E.g. basis.bfs[0].powers (basis[0].powers)
# One can also access the contraction coefficients and the exponents of the 
# PGBF making up the CGBF by doing
# basis[CGBF_n].pcoefs[PGBF_i]
# basis[CGBF_n].pexps[PGBF_i]


# Use "6-31g**" for "best" results
# Use "STO-3G" for debbuging
bas = getbasis(molec,basis_data="6-31g**")


# Grab length of basis and number of electrons and print - some of this 
# obviously will not make sense if there's more than one type of atom
lenBasis        = 2*len(bas)
nEle            = molec.get_nel()
nucNum          = nEle # Nuclear number - one of the reasons this only works 
                       # for atoms. 
                       # If we want molecules, we must be able to change this 
                       # according to the molecule
lenNPartBasis   = math.factorial(lenBasis)/(math.factorial(nEle) * \
                  math.factorial(lenBasis-nEle) )
print "\n"
print "Using a single particle spatial basis consisting of", lenBasis/2, \
      "contracted gaussians."
print "Using a single particle basis length of", lenBasis, "."
print "The N particle basis has a length", lenNPartBasis, "."

# Let us now construct the spin-orbital basis. It will be a list consisting of 
# tuples. Each element of the list is a spin-orbital and each tuple contains two 
# values. A spin number (+1 or -1) and a CGBF object: