From: John Stone (johns_at_ks.uiuc.edu)
Date: Wed Aug 06 2003 - 10:38:57 CDT

Ioana,
  There's no reason for you to write your own trajectory reader code,
the 'atomselect' command can do exactly what you've asked about
(retrieving coordinates for a subset of atoms).

The 'atomselect' command will report atom coordinates for any subset of
atoms that interest you.

Here is a simple script that uses 'atomselect' to retrieve, interpolate,
and generate new trajectory frames from atom coordinates. For your purpose,
you'd want to replace "all" with the appropriate atom selection identifying
the subset of atoms you want to work with. Obviously this script is not
precisely what you're doing, but it should be obvious how flexible the
'atomselect' command is once you've seen it in use:
  http://www.ks.uiuc.edu/Research/vmd/script_library/scripts/morph/morph.txt

If you want to create a reduced trajectory file, then you may find
Justin's "CatDCD" program useful:
  http://www.ks.uiuc.edu/Development/MDTools/catdcd/

If you insist on doing things the hard way, you can process the
DCD file yourself, but I don't have time to provide you assistance
with this. My only suggestion in this case is that you read the
source code for CatDCD, or the "dcdplugin" in VMD, in order to
understand the binary format. There's a reason we provide all of
these 'atomselect' features in VMD:
  _So you don't have to do this for yourself!!!_

:-)

Thanks,
  John Stone
  vmd_at_ks.uiuc.edu

On Tue, Aug 05, 2003 at 10:53:22PM -0700, Ioana Cozmuta wrote:
> Hi John,
>
> Thank you for your reply.
> I was more or less asking if I want to write my own code to extract from a
> trajectory that for a reduced group of atoms, what is the way to read the
> binary dcd file and then read only the coordonates corresponding to the
> selected group of atoms I want.
>
> -what is the order in which the information is written in the dcd file
> -how do I deal with the binary encription of the coordinates ?
>
> Thank you,
> Ioana
>
>
> On Tue, 5 Aug 2003, John Stone wrote:
>
> >
> > Ioana,
> > What I was trying to suggest in my previous email, is that
> > you're having problems _because_ you're forwarding your
> > display to a different machine. Try running it on the console
> > of the machine and you'll probably be ok. I believe the 'dgl'
> > error you got is caused by forwarding the display connection.
> >
> > Regarding getting Z coords, you can use the 'atomselect' command
> > in VMD to retrieve coordinates as in an example along these lines:
> > set sel [atomselect top "all"]
> > $sel get z
> >
> > You may also wish to set the active frame and other things but
> > the concept is similar. This is all documented in the VMD
> > User's Guide.
> >
> > Thanks,
> > John Stone
> > vmd_at_ks.uiuc.edu
> >
> > On Tue, Aug 05, 2003 at 08:32:21PM -0700, Ioana Cozmuta wrote:
> > > Hi John,
> > >
> > > I am running the vmd on another machine by forwarding the graphical
> > > display on my station. Moreover I understood that the machine (it is a
> > > mass storage) moves files biger than a certain size on tape automatically
> > > so when the files are used they are read from the tape. Do you think that
> > > this delay causes the trouble I've got?
> > >
> > > I am using this opportunity to ask another question:
> > > I want to retrieve the z coordinate of a couple of atoms from the NAMD
> > > generated dcd (trajectory) file. What is the way to do this (I wrote out
> > > the trajectory in binary format)?
> > >
> > > Thank you,
> > > Ioana
> > >
> > >
> > >
> > > On Tue, 5 Aug 2003, John Stone wrote:
> > >
> > > >
> > > > Ioana,
> > > > That looks like a low level error in dmconvert. The "dgl" error
> > > > sounds like it may require that you be running it locally on the
> > > > console of the SGI, since "dgl" is the SGI way of doing their
> > > > proprietary graphics stuff, potentially employing hardware
> > > > video codecs etc. Did you run all this on the console of
> > > > your SGI?
> > > >
> > > > Thanks,
> > > > John Stone
> > > > vmd_at_ks.uiuc.edu
> > > >
> > > > On Tue, Aug 05, 2003 at 04:04:15PM -0700, Ioana Cozmuta wrote:
> > > > > Hi,
> > > > >
> > > > > I am trying to make an mpeg (dmconvert) movie using the vmdmovie menue but
> > > > > I get the following error.
> > > > >
> > > > > Converting frames from rgb format to ppm... Converting frames to SGI
> > > > > MPEG-1 video format dmconvert -v -f mpeg1v -p video,rate=24 -n
> > > > > /u2/ioana/calibr_meas/1K/diff_1K/movieK.####.ppm,start=0,end=9,step=1
> > > > > /u2/ioana/calibr_meas/1K/diff_1K/movieK.####.ppm
> > > > > /u2/ioana/calibr_meas/1K/diff_1K/movieK.mpg
> > > > > bgerror failed to handle background error.
> > > > > Original error: -------- Scanning input ... dgl error (read): <bad
> > > > > errno = 0>
> > > > > Error in bgerror: invoked "break" outside of a loop
> > > > >
> > > > > Does anyone have any idea what is causing this error?
> > > > >
> > > > > Thank you,
> > > > > Ioana
> > > >
> > > > --
> > > > NIH Resource for Macromolecular Modeling and Bioinformatics
> > > > Beckman Institute for Advanced Science and Technology
> > > > University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
> > > > Email: johns_at_ks.uiuc.edu Phone: 217-244-3349
> > > > WWW: http://www.ks.uiuc.edu/~johns/ Fax: 217-244-6078
> > > >
> >
> > --
> > NIH Resource for Macromolecular Modeling and Bioinformatics
> > Beckman Institute for Advanced Science and Technology
> > University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
> > Email: johns_at_ks.uiuc.edu Phone: 217-244-3349
> > WWW: http://www.ks.uiuc.edu/~johns/ Fax: 217-244-6078
> >

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349              
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078