Re: extracting coordinates from dcd file

From: JC Gumbart (gumbart_at_ks.uiuc.edu)
Date: Mon Jul 30 2007 - 17:09:17 CDT

Try loading your psf and dcd file like this:

mol new ***.psf
mol addfile ***.dcd waitfor all

The waitfor all flag is important; otherwise it will continue with
your script before the dcd is finished loading (this is my guess as
to why this happened).

Also, to save memory, set your selection outside of the loop and then
use "$sel frame $i" inside the loop to change the frame. If the
selection atoms were to change through the simulation, you'd also
need "$sel update". Also, you may want to start your loop at 0, not 1.

On Jul 30, 2007, at 1:50 PM, M. Madhu wrote:

>
> Hi,
>
> I want to get xyz coordinates for a selected atom from a trajectory
> (dcd) file.
> I have a tcl script for extracting the coordinates from a dcd file,
> but it does not
> give me any values. It gives only blank lines corresponding to the
> number
> of frames. However, if I don't use the loop and do the calculation
> for a single
> pdb file, it works fine.
>
> The following is the tcl script: Could anyone tell me what is wrong
> with it.
>
> Thanks,
> Madhu
>
> =============================================================
> set outfile [open coords.dat w];
> mol delete all
>
> mol load mydcdfile.dcd psf mypsffile.psf
> set nf [molinfo top get numframes]
>
> # loop
> for {set i 1 } {$i < $nf } { incr i } {
> set sel1 [atomselect top "protein and resid 1 and type CA"
> frame $i]
> set x1 [$sel1 get x]
> set y1 [$sel1 get y]
> set z1 [$sel1 get z]
> puts $outfile "$x1"
> }
> close $outfile
> ==============================================================
> _________________________________________________________________
> Catch the cricket action with MSN!
> http://content.msn.co.in/Sports/Cricket/Default.aspx

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:46:43 CST