Example #1
0
def getbfs(coords, gbasis):
    """Convenience function for both wavefunction and density based on PyQuante Ints.py."""
    if not _HAS_PYQUANTE:
        raise Exception("You need to have PyQuante installed")
    mymol = cclib2pyquante.makepyquante(coords, [0 for _ in coords])

    sym2powerlist = {
        'S' : [(0, 0, 0)],
        'P' : [(1, 0, 0), (0, 1, 0), (0, 0, 1)],
        'D' : [(2, 0, 0), (0, 2, 0), (0, 0, 2), (1, 1, 0), (0, 1, 1), (1, 0, 1)],
        'F' : [(3, 0, 0), (2, 1, 0), (2, 0, 1), (1, 2, 0), (1, 1, 1), (1, 0, 2),
               (0, 3, 0), (0, 2, 1), (0, 1, 2), (0, 0, 3)]
        }

    bfs = []
    for i, atom in enumerate(mymol):
        bs = gbasis[i]
        for sym, prims in bs:
            for power in sym2powerlist[sym]:
                bf = CGBF(atom.pos(), power)
                for expnt, coef in prims:
                    bf.add_primitive(expnt, coef)
                bf.normalize()
                bfs.append(bf)

    return bfs
Example #2
0
def getbfs(coords, gbasis):
    """Convenience function for both wavefunction and density based on PyQuante Ints.py."""
    if not _HAS_PYQUANTE:
        raise Exception("You need to have PyQuante installed")
    mymol = cclib2pyquante.makepyquante(coords, [0 for _ in coords])

    sym2powerlist = {
        'S': [(0, 0, 0)],
        'P': [(1, 0, 0), (0, 1, 0), (0, 0, 1)],
        'D': [(2, 0, 0), (0, 2, 0), (0, 0, 2), (1, 1, 0), (0, 1, 1),
              (1, 0, 1)],
        'F': [(3, 0, 0), (2, 1, 0), (2, 0, 1), (1, 2, 0), (1, 1, 1), (1, 0, 2),
              (0, 3, 0), (0, 2, 1), (0, 1, 2), (0, 0, 3)]
    }

    bfs = []
    for i, atom in enumerate(mymol):
        bs = gbasis[i]
        for sym, prims in bs:
            for power in sym2powerlist[sym]:
                bf = CGBF(atom.pos(), power)
                for expnt, coef in prims:
                    bf.add_primitive(expnt, coef)
                bf.normalize()
                bfs.append(bf)

    return bfs
Example #3
0
def make_pyquante_basis(atoms,input_bfs):
    from PyQuante.Ints import sym2powerlist
    from PyQuante.CGBF import CGBF
    bfs = []
    for atom_index,info in input_bfs:
        x,y,z = atoms[atom_index-1].pos()
        for type,primlist in info:
            for power in sym2powerlist[type]:
                bf = CGBF((x,y,z),power)
                for expnt,coef in primlist:
                    bf.add_primitive(expnt,coef)
                bf.normalize()
                bfs.append(bf)
    return bfs
Example #4
0
def pyquante_basis(molfbasis,atoms):
    from PyQuante.Ints import sym2powerlist
    from PyQuante.CGBF import CGBF
    
    bfs = []
    for type,atomnum,primlist in molfbasis:
        for power in sym2powerlist[type]:
            symi,atnoi,xi,yi,zi = atoms[atomnum-1]
            x,y,z = toBohr3(xi,yi,zi)
            bf = CGBF((x,y,z),power)
            for expnt,coef in primlist:
                bf.add_primitive(expnt,coef)
            bf.normalize()
            bfs.append(bf)
    return bfs
Example #5
0
    def getbfs(ccdata):
        from cclib.bridge import cclib2pyquante
        pymol = cclib2pyquante.makepyquante(ccdata)

        bfs = []
        for i, atom in enumerate(pymol):
            bs = ccdata.gbasis[i]
            for sym, prims in bs:
                for power in sym2powerlist[sym]:
                    bf = CGBF(atom.pos(), power)
                    for expnt, coef in prims:
                        bf.add_primitive(expnt, coef)
                    bf.normalize()
                    bfs.append(bf)
        
        del cclib2pyquante
        
        return bfs
Example #6
0
    def make_basis(self):
        try:
            from PyQuante.CGBF import CGBF
            from PyQuante.Ints import sym2powerlist
        except:
            print "PyQuante not available, using slower routines"
            print "Consider installing PyQuante to speed basis function evals"
            from Gaussian import CGBF, sym2powerlist

        self.pyq_basis = []
        for iat,atbasis in self.basis:
            origin = tuple(self.geo.atoms[iat-1].get_position())
            for type,prims in atbasis:
                for power in sym2powerlist[type]:
                    bf = CGBF(origin,power)
                    for expnt,coef in prims:
                        bf.add_primitive(expnt,coef)
                    bf.normalize()
                    self.pyq_basis.append(bf)
        return
Example #7
0
    def __init__(self, atoms, basis_data=None, **kwargs):
        """
        
        """
        # Option to omit f basis functions from imported basis sets
        omit_f = kwargs.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)

        # Creating the function lists, by shell and by arbitrary order
        bfs = []  # Basis list
        shells = []  # Shell list
        for atom in atoms:
            bs = basis_data[atom.atno]
            for sym, prims in bs:  # Shell Symbol S,P,D,F
                if omit_f and sym == "F": continue
                shell = Shell(sym)
                for power in sym2powerlist[sym]:
                    cgbf = CGBF(atom.pos(), power, atom.atid)

                    #exps,coefs = zip(*prims)
                    #primlist = [PrimitiveGTO(alpha,atom.pos(),power) for alpha in exps]

                    #bf = ContractedGTO(primlist,coefs)
                    #bf.normalize()
                    [cgbf.add_primitive(alpha, coef) for alpha, coef in prims]
                    cgbf.normalize()
                    bfs.append(cgbf)  # Normal ordering

                    # Shell ordering
                    bfs_index = len(bfs) - 1  # last added
                    shell.append(cgbf, bfs_index)
                shells.append(shell)

        self.bfs = bfs
        self.shells = shells
Example #8
0
 def __init__(self, atoms, basis_data = None, **kwargs):
     """
     
     """
     # Option to omit f basis functions from imported basis sets
     omit_f = kwargs.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)
     
     # Creating the function lists, by shell and by arbitrary order
     bfs = []   # Basis list
     shells = []# Shell list
     for atom in atoms:
         bs = basis_data[atom.atno]
         for sym,prims in bs: # Shell Symbol S,P,D,F
             if omit_f and sym == "F": continue
             shell = Shell(sym)
             for power in sym2powerlist[sym]:
                 cgbf = CGBF(atom.pos(), power, atom.atid)
                 
                 #exps,coefs = zip(*prims)
                 #primlist = [PrimitiveGTO(alpha,atom.pos(),power) for alpha in exps]
                 
                 #bf = ContractedGTO(primlist,coefs)
                 #bf.normalize()
                 [cgbf.add_primitive(alpha,coef) for alpha,coef in prims]
                 cgbf.normalize()
                 bfs.append(cgbf) # Normal ordering
                 
                 # Shell ordering
                 bfs_index = len(bfs)-1 # last added
                 shell.append(cgbf, bfs_index) 
             shells.append(shell)
     
     self.bfs = bfs
     self.shells = shells