|
发表于 2014-4-21 08:34:33
|
显示全部楼层
大工-阿里巴巴 发表于 2014-4-18 10:57
你的结果文件可以用txt打开不?打开之后如果是矩阵的形式,直接导入origin即可 ...
阿里师兄,写了一个小程序,初步的想法是把gromacs中g_covar 生成的 covar.dat文件转换成DCCM的矩阵表示,然后用画图软件画出来就好了。
因为接触生物方向不多,不知道得到的是不是跟想的一样,期待大家使用,发现其中的错误,提出意见。先谢谢了。- program dat2matrix
- implicit none
- !
- ! ********** WRITEN BY ALLEN.WHL, 04/19/2014 ************
- ! Convert "covar.dat" created by g_covar to DCCM matrix
- !
- integer i1, i2, i3, natoms, textline
- real*8, allocatable :: valuex(:,:,:), valuey(:,:,:), valuez(:,:,:), valueT (:,:), valueT1 (:,:)
- character*30 :: inputfile
- print*, " enter input-file name "
- read(*, *) inputfile
- open (13, file="out.dat")
- open (12,file=inputfile,status='old')
- do while (.true.)
- read(12,*,end=100)
- textline = textline+1
- enddo
- 100 continue
- rewind(12)
- natoms = int(sqrt(textline/3.0d0))
- allocate (valuex(natoms,3,natoms), valuey(natoms,3,natoms), valuez(natoms,3,natoms), valueT (natoms,natoms), &
- valueT1 (natoms,natoms))
- do i1 = 1, natoms
- do i2 = 1, natoms
- valueT (i1, i2) = 0.0d0
- valueT1 (i1, i2) = 0.0d0
- end do
- end do
- do i1 = 1, natoms
- do i2 = 1, 3
- do i3 = 1, natoms
- read(12, *) valuex(i1, i2, i3), valuey(i1, i2, i3), valuez(i1, i2, i3)
- end do
- end do
- end do
- do i1 = 1, natoms
- do i3 = 1, natoms
- valueT (i1, i3) = valueT (i1, i3) + valuex(i1, 1, i3) + valuey(i1, 2, i3) + valuez(i1, 3, i3)
- end do
- end do
- do i1 = 1, natoms
- do i2 = 1, natoms
- if (i1 == i2) valueT1 (i1, i2) = 1.0d0
- if (i1 /= i2) valueT1 (i1, i2) = valueT (i1, i2)/ dsqrt(valueT (i1, i1)) /dsqrt(valueT (i2, i2))
- end do
- end do
- do i1 = 1, natoms
- write(13, *) (valueT1 (i1, i2), i2 = 1, natoms)
- end do
- end
复制代码 |
|