• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python NumWrap.array函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中NumWrap.array函数的典型用法代码示例。如果您正苦于以下问题:Python array函数的具体用法?Python array怎么用?Python array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了array函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self,atno,x,y,z,atid=0,fx=0.0,fy=0.0,fz=0.0,vx=0.0,vy=0.0,vz=0.0):
     self.atno = atno
     self.r = array([x,y,z],'d')
     #added by Hatem Helal [email protected]
     #atom id defaults to zero so as not to break preexisting code...
     self.atid = atid
     self.f = array([fx,fy,fz],'d')
     self.vel = array([vx,vy,vz],'d')
     return
开发者ID:gabrielelanaro,项目名称:pyquante,代码行数:9,代码来源:Atom.py


示例2: gamma

 def gamma(self):
     "Return the density gradient gamma for each point in the grid"
     if not self.do_grad_dens: return None
     gs = []
     for agr in self.atomgrids:
         gs.extend(agr.gamma())
     return array(gs)
开发者ID:certik,项目名称:pyquante,代码行数:7,代码来源:MolecularGrid.py


示例3: make_bfgrid

 def make_bfgrid(self):
     "Construct a matrix with bfs in columns over the entire grid, "
     " so that R[0] is the first basis function, R[1] is the second..."
     bfs = []
     for point in self.points:
         bfs.extend(point.bfs)
     return array(bfs)
开发者ID:gabrielelanaro,项目名称:pyquante,代码行数:7,代码来源:AtomicGrid.py


示例4: grad_old

 def grad_old(self,pos):
     amp = self.amp(pos[0],pos[1],pos[2])
     alpha = self.exp
     L,M,N = self.powers
     x = pos[0]-self.origin[0]
     y = pos[1]-self.origin[1]
     z = pos[2]-self.origin[2]
     val = array([L/x - 2*x*alpha,M/y - 2*y*alpha,N/z-2*z*alpha])
     return self.norm*self.coef*val*amp
开发者ID:globulion,项目名称:pyq-mod,代码行数:9,代码来源:PGBF.py


示例5: overlap_1

 def overlap_1(self,other):
     "Overlap derivative integral between two gaussians. THO eq. 2.14."
     return self.norm*other.norm*\
      array([overlap_1x(self.exp,self.powers,self.origin,
                        other.exp,other.powers,other.origin),
             overlap_1y(self.exp,self.powers,self.origin,
                        other.exp,other.powers,other.origin),
             overlap_1z(self.exp,self.powers,self.origin,
                        other.exp,other.powers,other.origin)],'d')
开发者ID:globulion,项目名称:pyq-mod,代码行数:9,代码来源:PGBF.py


示例6: kinetic_1

 def kinetic_1(self,other):
     "Kinetic derivative integral between two gaussians. THO eq. 2.14."
     return self.norm*other.norm*\
      array([kinetic_1x(self.exp,self.powers,self.origin,
                        other.exp,other.powers,other.origin),
             kinetic_1y(self.exp,self.powers,self.origin,
                        other.exp,other.powers,other.origin),
             kinetic_1z(self.exp,self.powers,self.origin,
                        other.exp,other.powers,other.origin)],'d')
开发者ID:globulion,项目名称:pyq-mod,代码行数:9,代码来源:PGBF.py


示例7: grad_old

 def grad_old(self,pos):
     amp = self.amp(pos[0],pos[1],pos[2])
     alpha = self._exponent
     L,M,N = self._powers
     x = pos[0]-self._origin[0]
     y = pos[1]-self._origin[1]
     z = pos[2]-self._origin[2]
     val = array([L/x - 2*x*alpha,M/y - 2*y*alpha,N/z-2*z*alpha])
     return self._normalization*self._coefficient*val*amp
开发者ID:certik,项目名称:pyquante,代码行数:9,代码来源:PGBF.py


示例8: der_oneeE

def der_oneeE(a,D,bset,atoms):

    dH_dXa,dH_dYa,dH_dZa = der_Hcore_matrix(a,bset,atoms)
    
    doneE_Xa = trace2(D,dH_dXa)
    doneE_Ya = trace2(D,dH_dYa)
    doneE_Za = trace2(D,dH_dZa)
    
    #print doneE_Xa,doneE_Ya,doneE_Za
    return array([doneE_Xa,doneE_Ya,doneE_Za],'d')
开发者ID:berquist,项目名称:PyQuante,代码行数:10,代码来源:force.py


示例9: der_twoeE

def der_twoeE(a,D,bset):
    d2Ints_dXa,d2Ints_dYa,d2Ints_dZa  = der2Ints(a,bset)

    Gx,Gy,Gz = der2JmK(D,d2Ints_dXa,d2Ints_dYa,d2Ints_dZa)
    
    dtwoeE_Xa = trace2(D,Gx)
    dtwoeE_Ya = trace2(D,Gy)
    dtwoeE_Za = trace2(D,Gz)

    #print dtwoeE_Xa,dtwoeE_Ya,dtwoeE_Za
    return array([dtwoeE_Xa,dtwoeE_Ya,dtwoeE_Za],'d')
开发者ID:berquist,项目名称:PyQuante,代码行数:11,代码来源:force.py


示例10: der2Ints

def der2Ints(a,bset):
    #modified from Ints.py -> get2ints
    """Store integrals in a long array in the form (ij|kl) (chemists
    notation. We only need i>=j, k>=l, and ij <= kl"""
    from array import array
    nbf = len(bset)
    totlen = nbf*(nbf+1)*(nbf*nbf+nbf+2)/8
    d2Ints_dXa = array('d',[0]*totlen)
    d2Ints_dYa = array('d',[0]*totlen)
    d2Ints_dZa = array('d',[0]*totlen)
    for i in xrange(nbf):
        for j in xrange(i+1):
            ij = i*(i+1)/2+j
            for k in xrange(nbf):
                for l in xrange(k+1):
                    kl = k*(k+1)/2+l
                    if ij >= kl:
                        ijkl = ijkl2intindex(i,j,k,l)
                        d2Ints_dXa[ijkl],d2Ints_dYa[ijkl],d2Ints_dZa[ijkl] =\
                                 der_Jints(a,bset[i],bset[j],bset[k],bset[l])
    return d2Ints_dXa,d2Ints_dYa,d2Ints_dZa
开发者ID:berquist,项目名称:PyQuante,代码行数:21,代码来源:force.py


示例11: getTA1B

def getTA1B(bfsA,bfsB):
    """get the derivatives of T_ij between two molecules A and B.
The derivative refers to molecule A basis functions"""
    nbfA = len(bfsA)
    nbfB = len(bfsB)
    T = zeros((nbfA,nbfB,3),'d')
    
    for i in xrange(nbfA):
        bfi = bfsA[i]
        for j in xrange(nbfB):
            bfj = bfsB[j]
            T[i,j,:] = array( bfi.kinetic_1(bfj) , 'd' )
    return T
开发者ID:globulion,项目名称:pyq-mod,代码行数:13,代码来源:Ints.py


示例12: __init__

 def __init__(self,x,y,z,w=1.0,**opts):
     self.do_grad_dens = opts.get('do_grad_dens',False)
     self._x = float(x)
     self._y = float(y)
     self._z = float(z)
     self._w = float(w)
     self.xyz = array((self._x,self._y,self._z),'d')
     self._r = sqrt(self._x*self._x+self._y*self._y+self._z*self._z)
     self._gamma = None
     self._dens = 0
     self._dens0 = None
     self._grad = None
     self.bfs = []
     return
开发者ID:certik,项目名称:pyquante,代码行数:14,代码来源:GridPoint.py


示例13: allbfs

 def allbfs(self):
     "Construct a matrix with bfs in columns over the entire grid, "
     " so that R[0] is the first basis function, R[1] is the second..."
     bfs = []
     for agr in self.atomgrids:
         bfs.extend(agr.allbfs())
     bfs = array(bfs)
     npts = self.npts()
     nbf,nrem = divmod(len(bfs),npts)
     if nrem != 0: raise Exception("Remainder in divmod allbfs")
     nbf2 = self.nbf()
     if nbf != nbf2: raise Exception("Wrong # bfns %d %d" % (nbf,nbf2))
     bfs = reshape(bfs,(npts,nbf))
     return bfs
开发者ID:certik,项目名称:pyquante,代码行数:14,代码来源:MolecularGrid.py


示例14: __init__

 def __init__(self,x,y,z,w=1.0,**kwargs):
     self.do_grad_dens = kwargs.get('do_grad_dens',settings.DFTDensityGradient)
     self._x = float(x)
     self._y = float(y)
     self._z = float(z)
     self._w = float(w)
     self.xyz = array((self._x,self._y,self._z),'d')
     self._r = sqrt(self._x*self._x+self._y*self._y+self._z*self._z)
     self._gamma = None
     self._dens = 0
     self._dens0 = None
     self._grad = None
     self.bfs = []
     return
开发者ID:berquist,项目名称:PyQuante,代码行数:14,代码来源:GridPoint.py


示例15: grad

 def grad(self,x,y,z):
     alpha = self.exp
     I,J,K = self.powers
     C = self.norm*self.coef
     x0,y0,z0 = self.origin
     fx = pow(x-x0,I)*exp(-alpha*pow(x-x0,2))
     fy = pow(y-y0,J)*exp(-alpha*pow(y-y0,2))
     fz = pow(z-z0,K)*exp(-alpha*pow(z-z0,2))
     gx = -2*alpha*(x-x0)*fx
     gy = -2*alpha*(y-y0)*fy
     gz = -2*alpha*(z-z0)*fz
     if I > 0: gx += pow(x-x0,I-1)*exp(-alpha*pow(x-x0,2))
     if J > 0: gy += pow(y-y0,J-1)*exp(-alpha*pow(y-y0,2))
     if K > 0: gz += pow(z-z0,K-1)*exp(-alpha*pow(z-z0,2))
     return array([C*gx*fy*fz,C*fx*gy*fz,C*fx*fy*gz])
开发者ID:globulion,项目名称:pyq-mod,代码行数:15,代码来源:PGBF.py


示例16: grad

 def grad(self,x,y,z):
     alpha = self._exponent
     I,J,K = self._powers
     C = self._normalization*self._coefficient
     x0,y0,z0 = self._origin
     fx = pow(x-x0,I)*exp(-alpha*pow(x-x0,2))
     fy = pow(y-y0,J)*exp(-alpha*pow(y-y0,2))
     fz = pow(z-z0,K)*exp(-alpha*pow(z-z0,2))
     gx = -2*alpha*(x-x0)*fx
     gy = -2*alpha*(y-y0)*fy
     gz = -2*alpha*(z-z0)*fz
     if I > 0: gx += pow(x-x0,I-1)*exp(-alpha*pow(x-x0,2))
     if J > 0: gy += pow(y-y0,J-1)*exp(-alpha*pow(y-y0,2))
     if K > 0: gz += pow(z-z0,K-1)*exp(-alpha*pow(z-z0,2))
     return array([C*gx*fy*fz,C*fx*gy*fz,C*fx*fy*gz])
开发者ID:certik,项目名称:pyquante,代码行数:15,代码来源:PGBF.py


示例17: der_twoeE_uhf

def der_twoeE_uhf(a,Da,Db,bset):
    d2Ints_dXa,d2Ints_dYa,d2Ints_dZa  = der2Ints(a,bset)

    dJax,dJay,dJaz = derJ(Da,d2Ints_dXa,d2Ints_dYa,d2Ints_dZa)
    dJbx,dJby,dJbz = derJ(Db,d2Ints_dXa,d2Ints_dYa,d2Ints_dZa)
    
    dKax,dKay,dKaz = derK(Da,d2Ints_dXa,d2Ints_dYa,d2Ints_dZa)
    dKbx,dKby,dKbz = derK(Db,d2Ints_dXa,d2Ints_dYa,d2Ints_dZa)

    Dab = Da + Db
    
    dtwoeE_Xa = 0.5*trace2(Dab,dJax+dJbx) - 0.5*(trace2(Da,dKax)+trace2(Db,dKbx))
    dtwoeE_Ya = 0.5*trace2(Dab,dJay+dJby) - 0.5*(trace2(Da,dKay)+trace2(Db,dKby))
    dtwoeE_Za = 0.5*trace2(Dab,dJaz+dJbz) - 0.5*(trace2(Da,dKaz)+trace2(Db,dKbz))
    
    return array([dtwoeE_Xa,dtwoeE_Ya,dtwoeE_Za],'d')
开发者ID:berquist,项目名称:PyQuante,代码行数:16,代码来源:force.py


示例18: set_boltzmann_velocities

def set_boltzmann_velocities(atoms,T):
    from random import gauss,randint
    Eavg = Rgas*T/2000 # kT/2 per degree of freedom (kJ/mol)

    vels = []
    for atom in atoms:
        m = atom.mass()
        vavg = sqrt(2*Eavg*fconst/m)
        
        stdev = 0.01 #I'm setting the std dev wrong here
        atom.v = array((pow(-1,randint(0,1))*gauss(vavg,stdev),
                        pow(-1,randint(0,1))*gauss(vavg,stdev),
                        pow(-1,randint(0,1))*gauss(vavg,stdev)))

    subtract_com_velocity(atoms)
    rescale_velocities(atoms,T)
    return
开发者ID:certik,项目名称:pyquante,代码行数:17,代码来源:Dynamics.py


示例19: der_dmat

def der_dmat(a,Qmat,bset):
    """
    Looking at Szabo's equation C.12 you can see that this term results 
    from adding up the terms that involve derivatives of the density matrix
    elements P_mu,nu.  Following Szabo we compute this term as
      sum_mu,nu Q_mu,nu dS_mu,nu / dRa
    where the Q matrix is essentially a density matrix that is weighted by 
    the orbital eigenvalues.  Computing the derivative of the overlap integrals
    is done in the der_overlap_matrix function later in this module.
    """
    dS_dXa,dS_dYa,dS_dZa = der_overlap_matrix(a,bset)
    
    dDmat_Xa = trace2(Qmat,dS_dXa)
    dDmat_Ya = trace2(Qmat,dS_dYa)
    dDmat_Za = trace2(Qmat,dS_dZa)
    
    #print dDmat_Xa,dDmat_Ya,dDmat_Za
    return array([dDmat_Xa,dDmat_Ya,dDmat_Za],'d')
开发者ID:berquist,项目名称:PyQuante,代码行数:18,代码来源:force.py


示例20: chi_rk4

def chi_rk4(tend):
    # Same thing as chi_integrate, but uses a fourth-order Runge-Kutta
    #  scheme
    t = 0
    X = 1.0
    h = 1e-4 # 1e-5 is not small enough and still takes forever!
    v = -1.58807
    ts = []
    Xs = []
    while t < 1:
        ts.append(t)
        Xs.append(X)
        A = array((X,v))
        k1 = h*F(A,t)
        k2 = h*F(A+k1/2,t+h/2)
        k3 = h*F(A+k2/2,t+h/2)
        k4 = h*F(A+k3,t+h)
        A += (k1+2*k2+2*k3+k4)/6
        X,v = A
        t += h
        if X < 0: break
    return ts,Xs
开发者ID:berquist,项目名称:PyQuante,代码行数:22,代码来源:ThomasFermi.py



注:本文中的NumWrap.array函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python NumWrap.zeros函数代码示例发布时间:2022-05-24
下一篇:
Python Nouvelle.tag函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap