Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1069231
  • 博文数量: 264
  • 博客积分: 7225
  • 博客等级: 少将
  • 技术积分: 5096
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-17 08:53
文章分类

全部博文(264)

文章存档

2011年(33)

2010年(52)

2009年(152)

2008年(27)

我的朋友

分类:

2009-06-22 17:02:34

径向分布函数(pair correlation function)简介

, , , ,
转自:

星期四, 2008-11-27 01:28 — Elizerbeth

    径向分布函数通常指的是给定某个粒子的坐标,其他粒子在空间的分布几率(离给定粒子多远)。所以径向分布函数既可以用来研究物质的有序性,也可以用来描述电子的相关性。

    径向分布函数通常用g(r,r')来表示。
    对于|r-r'|比较小的情况,g(r,r')主要表征的是原子的堆积状况及各个键之间的距离。对于长程的性质,由于对于给定的距离找到原子的几率基本上相 同,所以g(r,r')随着|r-r'|的增大而变得平缓,最后趋向于恒值。通常定义g(r,r')时,归一化的条件为|r-r;|趋向于无穷大 时,g(r,r')趋向于一。通常,对于晶体,由于其有序的结构,径向分布函数有长程的峰,而对于amorphous的物质,则径向分布函数一般只有短程 的峰。

    同样的概念有时被用到描述电子的相关性,如电子的pair correlation指的就是给定一个电子,其它电子在此电子周围出现的几率。由于电子之间有库仑斥力,还有由于波函数反对称化的作用,所以pair correlation的具体形式比较复杂,目前尚未有解析的表达。有时候文献里提到的exchange-correlation hole也是基于pair correlation的概念。有兴趣的同学可以参见《chemist guide to density functional theory》一书中的第68页。

    以下是计算径向分布函数的小程序(by )
  1.   function subgr,data,rmin,rmax,deltar,lilnbar=lilnbar,enone=enone
  2.    
  3.   dim=n_elements(data(*,0))
  4.   nr=(rmax-rmin)/deltar+1
  5.   result=fltarr(nr)
  6.   xmin=min(data(0,*),max=xmax)
  7.   ymin=min(data(1,*),max=ymax)
  8.   if (dim eq 3) then begin
  9.    zmin=min(data(2,*),max=zmax)
  10.   endif
  11.   x0=xmin+rmax & x1=xmax-rmax
  12.   y0=ymin+rmax & y1=ymax-rmax
  13.   w1=where(data(0,*) gt x0 and data(0,*) lt x1 and $
  14.    data(1,*) gt y0 and data(1,*) lt y1,nw1)
  15.   if (nw1 eq 0) then message,'no particles ???',/inf
  16.   rmin2=rmin*rmin
  17.   rmax2=rmax*rmax
  18.   npts=n_elements(data(0,*))
  19.   one=fltarr(npts)+1.0
  20.   if (dim ne 2) then begin
  21.    vol=(zmax-zmin)*(xmax-xmin)*(ymax-ymin)
  22.   endif else begin
  23.    vol=(xmax-xmin)*(ymax-ymin)
  24.   endelse
  25.   lilnbar=lilnbar+npts/vol
  26.   enone=enone+nw1
  27.    
  28.   ; =======================
  29.   ; sphere, center at origin, slice off top at z=z0: the surface
  30.   ; area that is removed is 2piR^2(1-z0/R) so thus the remaining
  31.   ; surface area (from origin up to z0) is 2 pi R z0, a nice
  32.   ; simple formula. Makes sense by dimensional analysis...
  33.   ; =======================
  34.    
  35.   twopi=2*3.14159265358
  36.   rvec=findgen(nr)*deltar+rmin
  37.   normz=1.0/(twopi*rvec*deltar)
  38.    
  39.   for i=0L,nw1-1L do begin
  40.    d0=data(*,w1(i))
  41.    dd=one##d0-data
  42.    dis=total(dd*dd,1)
  43.    w2=where(dis gt rmin2 and dis lt rmax2,nw2)
  44.    if (nw2 gt 0) then begin
  45.   ; if (min(dis(w2)) lt 0.1) then message,'foo',/inf
  46.    newdis=sqrt(dis(w2))
  47.    thehisto=histogram(newdis,max=rmax,min=rmin,binsize=deltar)
  48.    if (dim eq 3) then begin
  49.    z0=zmax-d0(2)
  50.    z1=d0(2)-zmin
  51.    normz=twopi*rvec*( (rvec
  52.    normz(0)=1.0
  53.    normz=1.0/normz
  54.    normz(0)=0.0
  55.    endif ; else if dim=2 then normz has already been set
  56.    result=result+thehisto*normz
  57.    endif
  58.   endfor
  59.    
  60.   return,result
  61.   end
  62.    
  63.    
  64.   ;------------------------------------------------------------
  65.   function ericgr3d,data,track=track,rmin=rmin,rmax=rmax, $
  66.    deltar=deltar,noplot=noplot
  67.   % assumes pretrack data (last column is timestamp) unless /track
  68.   ; in which case penultimate column is timestamp.
  69.   ;
  70.   ; no harm to have deltar really small, can always rebin later
  71.    
  72.   if (not keyword_set(rmin)) then rmin=0.0
  73.   if (not keyword_set(rmax)) then rmax=10.0
  74.   if (not keyword_set(deltar)) then deltar=0.01
  75.   nel=n_elements(data(*,0))
  76.   tel=nel-1
  77.   if (keyword_set(track)) then tel=nel-2
  78.   dim = 3; needs to be this!
  79.    
  80.   xmin=min(data(0,*),max=xmax)
  81.   ymin=min(data(1,*),max=ymax)
  82.   dx=xmax-xmin & dy=ymax-ymin
  83.   if ((dx lt rmax*2) or (dy lt rmax*2)) then begin
  84.    message,'rmax is too large',/inf
  85.    rmax = (dx < dy)*0.3
  86.    message,'setting rmax to : '+string(rmax),/inf
  87.   endif
  88.    
  89.   tmin=min(data(tel,*),max=tmax)
  90.   nr=(rmax-rmin)/deltar+1
  91.   rvec=findgen(nr)*deltar+rmin
  92.    
  93.   count=0
  94.   lilnb=0.0
  95.   enone=0L
  96.   for t=tmin,tmax do begin
  97.    w=where(data(tel,*) eq t,nw)
  98.    if (nw gt 2) then begin
  99.    message,string(t)+'/'+string(tmax),/inf
  100.    tempgr=subgr(data(0:dim-1,w),rmin,rmax,deltar,lilnbar=lilnb,enone=enone)
  101.    if (count eq 0) then resultgr=tempgr else resultgr=resultgr+tempgr
  102.    count=count+1
  103.    w2=where(resultgr gt 0.0,nw2)
  104.    nnbar=count/(enone*lilnb*deltar)
  105.    if (not keyword_set(noplot) and nw2 gt 1) then begin
  106.    if (dim eq 3) then $
  107.    plot,rvec(w2),resultgr(w2)*nnbar
  108.    if ((dim eq 2) and ((t mod 10) eq 0)) then $
  109.    plot,rvec(w2),resultgr(w2)*nnbar
  110.    endif
  111.    endif else begin
  112.    message,'no particles at time t='+string(t),/inf
  113.    endelse
  114.   endfor
  115.   resultgr=resultgr*nnbar
  116.    
  117.   n=n_elements(resultgr)
  118.   result=transpose([[rvec(0:n-1)],[resultgr]])
  119.    
  120.   return,result
  121.   end
复制代码
阅读(5298) | 评论(1) | 转发(1) |
给主人留下些什么吧!~~

chinaunix网友2009-11-17 19:28:00

不错,在你这找到了,学习了