예제 #1
0
def libint_iterator(bfs):
    first_bfs = [i for i, b in enumerate(bfs) if b.is_first]
    for i,j in pairs(first_bfs):
        ij = i*(i+1)/2+j
        for k,l in pairs(first_bfs):
            kl = k*(k+1)/2+l
            if ij <= kl:
                yield i,j,k,l
    return
예제 #2
0
def iiterator(nbf):
    """
    Iterator over n**4 integral indices
    >>> list(iiterator(2))
    [(0, 0, 0, 0), (0, 0, 0, 1), (0, 0, 1, 1), (0, 1, 0, 1), (0, 1, 1, 1), (1, 1, 1, 1)]
    """
    for i,j in pairs(range(nbf)):
        ij = i*(i+1)/2+j
        for k,l in pairs(range(nbf)):
            kl = k*(k+1)/2+l
            if ij <= kl:
                yield i,j,k,l
    return
예제 #3
0
def iiterator(nbf):
    """
    Iterator over n**4 integral indices
    >>> list(iiterator(2))
    [(0, 0, 0, 0), (0, 0, 0, 1), (0, 0, 1, 1), (0, 1, 0, 1), (0, 1, 1, 1), (1, 1, 1, 1)]
    """
    for i,j in pairs(range(nbf)):
        ij = i*(i+1)/2+j
        for k,l in pairs(range(nbf)):
            kl = k*(k+1)/2+l
            if ij <= kl:
                yield i,j,k,l
    return
예제 #4
0
 def make_operator(self,D,fetcher):
     nbf = self.nbf
     D1 = np.reshape(D,(nbf*nbf,))
     G = np.empty((nbf,nbf),'d')
     for i,j in pairs(range(nbf)):
         temp = fetcher(i,j) # replace temp with fetcher()
         G[i,j] = G[j,i] = np.dot(D1,temp)
     return G
예제 #5
0
 def make_operator(self,D,fetcher):
     nbf = self.nbf
     D1 = np.reshape(D,(nbf*nbf,))
     G = np.empty((nbf,nbf),'d')
     for i,j in pairs(range(nbf)):
         temp = fetcher(i,j) # replace temp with fetcher()
         G[i,j] = G[j,i] = np.dot(D1,temp)
     return G
예제 #6
0
 def __init__(self,bfs,geo):
     nbf = self.nbf = len(bfs)
     self.S = np.empty((nbf,nbf),'d')
     self.T = np.empty((nbf,nbf),'d')
     self.V = np.empty((nbf,nbf),'d')
     for i,j in pairs(range(nbf)):
         ibf,jbf = bfs[i],bfs[j]
         self.S[i,j] = self.S[j,i] = S(ibf,jbf)
         self.T[i,j] = self.T[j,i] = T(ibf,jbf)
         self.V[i,j] = self.V[j,i] = sum(at.atno*V(ibf,jbf,at.r) for at in geo)
     return
예제 #7
0
 def __init__(self,bfs,geo):
     nbf = self.nbf = len(bfs)
     self.S = np.empty((nbf,nbf),'d')
     self.T = np.empty((nbf,nbf),'d')
     self.V = np.empty((nbf,nbf),'d')
     for i,j in pairs(range(nbf)):
         ibf,jbf = bfs[i],bfs[j]
         self.S[i,j] = self.S[j,i] = S(ibf,jbf)
         self.T[i,j] = self.T[j,i] = T(ibf,jbf)
         self.V[i,j] = self.V[j,i] = sum(at.Z*V(ibf,jbf,at.r) for at in geo)
     return