From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Thu Aug 31 2006 - 10:52:13 CDT

On 8/31/06, alexandra.marques_at_fc.up.pt <alexandra.marques_at_fc.up.pt> wrote:
>
> Hi
>
> I still have a problem with my script to write the list of water molecules for
> each frame. The problem is with the format of the output file, that is, for
> each frame, the waters are listed in the horizontal and vertical lines. For
> example:
>
> Frame 0, 4561 4593 4614 4639 5215 5216 5220 7142 7186 7201 8694
> Frame 0, 4561 4593 4614 4639 5215 5216 5220 7142 7186 7201 8694
> Frame 0, 4561 4593 4614 4639 5215 5216 5220 7142 7186 7201 8694
> Frame 0, 4561 4593 4614 4639 5215 5216 5220 7142 7186 7201 8694
> Frame 0, 4561 4593 4614 4639 5215 5216 5220 7142 7186 7201 8694
> Frame 0, 4561 4593 4614 4639 5215 5216 5220 7142 7186 7201 8694
> Frame 0, 4561 4593 4614 4639 5215 5216 5220 7142 7186 7201 8694
> Frame 0, 4561 4593 4614 4639 5215 5216 5220 7142 7186 7201 8694
> Frame 0, 4561 4593 4614 4639 5215 5216 5220 7142 7186 7201 8694
> Frame 0, 4561 4593 4614 4639 5215 5216 5220 7142 7186 7201 8694
> Frame 0, 4561 4593 4614 4639 5215 5216 5220 7142 7186 7201 8694
>
> As my trajectory has 5000 frames the output file is very big and hard to
> analyse. Does anyone knows how should I modify the script in order to the
> waters be listed for each frame only in one line?
> The script is:
>
> set outfile [open watersTDT.txt w]
> set sel [atomselect top "name O and resname WAT and within 3.5 of residue 255"]
> set n [molinfo top get numframes]
> for { set i 0 } { $i < $n } { incr i } {
> $sel frame $i
> $sel update
> set residuelist [$sel get residue]
> puts "list of waters within 3.5 of residue 255:"
> puts "$residuelist"

> foreach res $residuelist {
> puts $outfile "Frame $i, $residuelist"

why do you output $residuelist here and not $res ??
this loop is redundant. either write $residuelist once
or write $res in each line.

i'm also wondering why you need to output this and cannot
do the subsequent analysis right from withing vmd anyways.

almost anything you could do with an external program you
can do with tcl as well, and even though tcl is signifiantly slower
than compiled code, the time needed to write out and then
read in and parse formatted text is significant, too.

cheers,
   axel.

> }
> }
> close $outfile
>
>
> Thank you very much for your help
> Alex
>
>
> -------------------------------------------------------------
> A FCUP utiliza o sistema de webmail Horde/IMP (www.horde.org)
>
> Visite: http://www.fc.up.pt/
>
>

-- 
=======================================================================
Axel Kohlmeyer   akohlmey_at_cmm.chem.upenn.edu   http://www.cmm.upenn.edu
  Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.