本帖最后由 wbn 于 2018-5-15 04:28 编辑
...你说的第二种方法用的也是第一种的公式...
我以前写过一个f90 code通过gmx的rdf输出算coordination num,你可以拿去改改。不保证对啊
- ! the program to calculate coordination number from g(r)
- program gr2coln
- implicit none
- type rdf
- real*8 r,gr
- endtype
- character rdffile*50,head
- real*8 peakhead,peaktail,total,boxlength,nip
- integer i
- type(rdf) g_r(2000)
- call getarg(1,rdffile)
- write(*,*) "input where the peak begins in nm"
- read(*,*) peakhead
- write(*,*) "input where the peak ends in nm"
- read(*,*) peaktail
- write(*,*) "the box length in nm"
- read(*,*) boxlength
- write(*,*) "number of ion pairs in box"
- read(*,*) nip
- open(10,file=rdffile,status='old')
- read(10,*) head
- do while(head=='@'.or.head=='#')
- read(10,*) head
- enddo
- i=1
- total=0.0
- read(10,*) g_r(i)%r,g_r(i)%gr
- do while(g_r(i)%r<peakhead)
- i=i+1
- read(10,*) g_r(i)%r,g_r(i)%gr
- enddo
- do while(g_r(i)%r<peaktail)
- i=i+1
- read(10,*) g_r(i)%r,g_r(i)%gr
- total=total+g_r(i)%gr*4*3.14159*g_r(i)%r*g_r(i)%r*(0.002)
- enddo
- total=total*nip/(boxlength*boxlength*boxlength)
- write(*,*) "The coordination number is : ",total
- close(10)
- end
复制代码 |