Example #1
0
def getbasis(atoms,basis_data=None,**opts):
    """\
    bfs = getbasis(atoms,basis_data=None)
    
    Given a Molecule object and a basis library, form a basis set
    constructed as a list of CGBF basis functions objects.
    """
    from PyQuante.Basis.basis import BasisSet
    return BasisSet(atoms, basis_data, **opts)
    # Option to omit f basis functions from imported basis sets
    omit_f = opts.get('omit_f',False)
    if not basis_data:
        from PyQuante.Basis.p631ss import basis_data
    elif type(basis_data) == type(''):
        # Assume this is a name of a basis set, e.g. '6-31g**'
        #  and import dynamically
        basis_data = get_basis_data(basis_data)
    bfs = []
    for atom in atoms:
        bs = basis_data[atom.atno]
        for sym,prims in bs:
            if omit_f and sym == "F": continue
            for power in sym2powerlist[sym]:
                bf = CGBF(atom.pos(),power,atom.atid)
                for expnt,coef in prims:
                    bf.add_primitive(expnt,coef)
                bf.normalize()
                bfs.append(bf)
    return bfs
Example #2
0
 def gaussian(self):
     a,b,c,d = self.nlm2powers[(self.N,self.L,self.M)]
     cgbf = CGBF(self.origin,(a,b,c))
     expos,coefs = gexps[(self.N,self.L)],gcoefs[(self.N,self.L)]
     zet2 = self.zeta*self.zeta
     for i in range(6):
         cgbf.add_primitive(zet2*expos[i],coefs[i])
     cgbf.normalize()
     return cgbf        
Example #3
0
def getbasis(atoms, basis_data=None, **opts):
    """\
    bfs = getbasis(atoms,basis_data=None)
    
    Given a Molecule object and a basis library, form a basis set
    constructed as a list of CGBF basis functions objects.
    """
    from PyQuante.Basis.basis import BasisSet
    return BasisSet(atoms, basis_data, **opts)
    # Option to omit f basis functions from imported basis sets
    omit_f = opts.get('omit_f', False)
    if not basis_data:
        from PyQuante.Basis.p631ss import basis_data
    elif type(basis_data) == type(''):
        # Assume this is a name of a basis set, e.g. '6-31g**'
        #  and import dynamically
        basis_data = get_basis_data(basis_data)
    bfs = []
    for atom in atoms:
        bs = basis_data[atom.atno]
        for sym, prims in bs:
            if omit_f and sym == "F": continue
            for power in sym2powerlist[sym]:
                bf = CGBF(atom.pos(), power, atom.atid)
                for expnt, coef in prims:
                    bf.add_primitive(expnt, coef)
                bf.normalize()
                bfs.append(bf)
    return bfs
Example #4
0
 def gaussian(self):
     a,b,c,d = self.nlm2powers[(self.N,self.L,self.M)]
     cgbf = CGBF(self.origin,(a,b,c))
     expos,coefs = gexps[(self.N,self.L)],gcoefs[(self.N,self.L)]
     zet2 = self.zeta*self.zeta
     for i in xrange(6):
         cgbf.add_primitive(zet2*expos[i],coefs[i])
     cgbf.normalize()
     return cgbf        
Example #5
0
def initialize(atoms):
    "Assign parameters for the rest of the calculation"
    from Slater import gauss_powers,gexps,gcoefs,s_or_p
    from MINDO3_Parameters import Uss,Upp,IPs,IPp,CoreQ,f03,nbfat,\
         zetas,zetap,Eat,Hfat,gss,gsp,gpp,gppp,hsp,hppp,NQN
    from CGBF import CGBF
    from Bunch import Bunch # Generic object to hold basis functions
    ibf = 0 # Counter to overall basis function count
    for atom in atoms:
        xyz = atom.pos()
        atom.Z = CoreQ[atom.atno]
        atom.basis = []
        atom.rho = e2/f03[atom.atno]
        atom.nbf = nbfat[atom.atno]
        atom.Eref = Eat[atom.atno]
        atom.Hf = Hfat[atom.atno]
        atom.gss = gss[atom.atno]
        atom.gsp = gsp[atom.atno]
        atom.gpp = gpp[atom.atno]
        atom.gppp = gppp[atom.atno]
        atom.hsp = hsp[atom.atno]
        atom.hppp = hppp[atom.atno]
        for i in xrange(atom.nbf):
            bfunc = Bunch()
            atom.basis.append(bfunc)
            bfunc.index = ibf # pointer to overall basis function index
            ibf += 1
            bfunc.type = i # s,x,y,z
            bfunc.atom = atom # pointer to parent atom
            bfunc.cgbf = CGBF(xyz,gauss_powers[i])
            zi = gexps[(NQN[atom.atno],s_or_p[i])]
            ci = gcoefs[(NQN[atom.atno],s_or_p[i])]
            if i:
                zeta = zetap[atom.atno]
                bfunc.u = Upp[atom.atno]
                bfunc.ip = IPp[atom.atno]
            else:
                zeta = zetas[atom.atno]
                bfunc.u = Uss[atom.atno]
                bfunc.ip = IPs[atom.atno]
            for j in xrange(len(zi)):
                bfunc.cgbf.add_primitive(zi[j]*zeta*zeta,ci[j])
            bfunc.cgbf.normalize()
    return atoms
Example #6
0
def get_overlap(atnoi,i,xyzi,atnoj,j,xyzj):
    bohr2ang = 0.52918
    xyzi = (xyzi[0]/bohr2ang,xyzi[1]/bohr2ang,xyzi[2]/bohr2ang)
    gi = CGBF(xyzi,gauss_powers[i])
    
    zi = gexps[(NQN[atnoi],s_or_p[i])]
    ci = gcoefs[(NQN[atnoi],s_or_p[i])]
    if i:
        zetai = zetap[atnoi]
    else:
        zetai = zetas[atnoi]
    
    xyzj = (xyzj[0]/bohr2ang,xyzj[1]/bohr2ang,xyzj[2]/bohr2ang)
    gj = CGBF(xyzj,gauss_powers[j])
    zj = gexps[(NQN[atnoj],s_or_p[j])]
    cj = gcoefs[(NQN[atnoj],s_or_p[j])]
    if j:
        zetaj = zetap[atnoj]
    else:
        zetaj = zetas[atnoj]

    # Multiply the functions by \zeta^2
    for a in range(6):
        gi.add_primitive(zi[a]*zetai*zetai,ci[a])
        gj.add_primitive(zj[a]*zetaj*zetaj,cj[a])
    gi.normalize()
    gj.normalize()
    return gi.overlap(gj)
Example #7
0
def get_overlap(atnoi,i,xyzi,atnoj,j,xyzj):
    bohr2ang = 0.52918
    xyzi = (xyzi[0]/bohr2ang,xyzi[1]/bohr2ang,xyzi[2]/bohr2ang)
    gi = CGBF(xyzi,gauss_powers[i])
    
    zi = gexps[(NQN[atnoi],s_or_p[i])]
    ci = gcoefs[(NQN[atnoi],s_or_p[i])]
    if i:
        zetai = zetap[atnoi]
    else:
        zetai = zetas[atnoi]
    
    xyzj = (xyzj[0]/bohr2ang,xyzj[1]/bohr2ang,xyzj[2]/bohr2ang)
    gj = CGBF(xyzj,gauss_powers[j])
    zj = gexps[(NQN[atnoj],s_or_p[j])]
    cj = gcoefs[(NQN[atnoj],s_or_p[j])]
    if j:
        zetaj = zetap[atnoj]
    else:
        zetaj = zetas[atnoj]

    # Multiply the functions by \zeta^2
    for a in xrange(6):
        gi.add_primitive(zi[a]*zetai*zetai,ci[a])
        gj.add_primitive(zj[a]*zetaj*zetaj,cj[a])
    gi.normalize()
    gj.normalize()
    return gi.overlap(gj)