Re: How to write a dcd in fortran?

From: lam nguyen (lamvn08_at_gmail.com)
Date: Mon Oct 03 2011 - 18:03:37 CDT

Thanks all for your suggestions. Actually I already went through these past
emails without success. But I just found a code which works for me at:

http://ra.bcs.uwa.edu.au/wiki/index.php/Mod_read_write_dcd

However I have to modify this code a bit to make it work. Here it is:

-----------------------------------------
character*4 coor
character*80 string1,string2
integer i,ifirst,nframe,nfreq,total,peroff,two,twentyfour,zero
!real delta
!double precision delta
integer*8 delta
real, dimension(:), allocatable :: xw,yw,zw
open(10,file='gotoequil.dcd',form='unformatted')

coor='CORD'; nframe=5; ifirst=0; nfreq=100; total=100
delta=1; peroff=0; twentyfour=24; zero=0

write(10)coor,nframe,ifirst,nfreq,total,zero,zero,zero,zero,zero,delta,peroff,zero,zero,zero,zero,zero,zero,zero,twentyfour

two=2; string1='welcome to the heaven!'; string2='go to hell!'
write(10)two,string1,string2
write(10)natom

allocate(xw(natom),yw(natom),zw(natom))
xw=x; yw=y; zw=z

do nrun=1,nframe
!************* writing frames to DCD:

write(10)(xw(i),i=1,natom)
write(10)(yw(i),i=1,natom)
write(10)(zw(i),i=1,natom)
!****************
enddo

------------------------------------------------------

The weird thing is, delta has to be integer. And x,y,z are real. If they are
double precision VMD cannot read DCD.
Anyone has ideas about how to write double precision, or I have to stick
with what I have now?

Thanks,

Lam

On Mon, Oct 3, 2011 at 1:56 PM, Joshua D. Moore <joshuadmoore_at_gmail.com>wrote:

> http://www.ks.uiuc.edu/Research/namd/mailing_list/namd-l/8441.html
>
> On Mon, Oct 3, 2011 at 3:13 PM, Axel Kohlmeyer <akohlmey_at_gmail.com> wrote:
> > On Mon, Oct 3, 2011 at 3:07 PM, lam nguyen <lamvn08_at_gmail.com> wrote:
> >> Thanks Axel,
> >> I found a C code which I'm not familiar with. I'm trying to read and
> >> understand the code, but if there is a fortran format it would help me
> much
> >> better.
> >
> > you have try harder.
> > i am certain that there is some fortran code floating around.
> > you can check out the NamdWiki as well.
> >
> > axel.
> >
> >
> >> Lam
> >>
> >> On Mon, Oct 3, 2011 at 11:26 AM, Axel Kohlmeyer <akohlmey_at_gmail.com>
> wrote:
> >>>
> >>> On Mon, Oct 3, 2011 at 2:21 PM, lam nguyen <lamvn08_at_gmail.com> wrote:
> >>> > Dear all,
> >>> > Does anyone know the structure of writing a DCD in fortran? I use one
> in
> >>> > the
> >>> > following link but VMD cannot read the DCD I write:
> >>> >
> >>> > http://www.ks.uiuc.edu/Research/vmd/plugins/molfile/dcdplugin.html
> >>>
> >>> are you grouping the write statements properly?
> >>>
> >>> if i remember correctly, people have posted fortran
> >>> code to _read_ dcd to the vmd mailing list, so i would
> >>> search there and used that as a template.
> >>>
> >>> axel.
> >>>
> >>> >
> >>> > Thanks a lot,
> >>> > Lam
> >>>
> >>>
> >>>
> >>> --
> >>> Dr. Axel Kohlmeyer
> >>> akohlmey_at_gmail.com http://goo.gl/1wk0
> >>>
> >>> Institute for Computational Molecular Science
> >>> Temple University, Philadelphia PA, USA.
> >>
> >>
> >
> >
> >
> > --
> > Dr. Axel Kohlmeyer
> > akohlmey_at_gmail.com http://goo.gl/1wk0
> >
> > Institute for Computational Molecular Science
> > Temple University, Philadelphia PA, USA.
> >
> >
>

This archive was generated by hypermail 2.1.6 : Mon Dec 31 2012 - 23:20:52 CST