From: John Stone (johns_at_ks.uiuc.edu)
Date: Tue May 24 2011 - 12:13:07 CDT

Maria,
  This is most likely an "atom selection leak", where your script is
creating a large number of atom selections but not deleting them as
it no longer needs them. Make sure that you delete any atom selections
that are being created as each frame is loaded, before the script moves
on to process the next frame.

Cheers,
  John Stone
  vmd_at_ks.uiuc.edu

On Tue, May 24, 2011 at 06:19:26PM +0200, maria goranovic wrote:
> Thank you Ajasja. This worked. However, now I have a segmentation fault
> after 604 frames. Cannot figure out this one at all ... ??A
>
> On Tue, May 24, 2011 at 4:48 PM, Ajasja LjubetiA:*
> <ajasja.ljubetic_at_gmail.com> wrote:
>
> Hi,
> since bigdcd loads one frame from memory processes it and then deletes
> it you only have one frame loaded.
> TryA changing the line
> A set sel [atomselect $molid "name OW and within $cut of ($seltext)"
> frame $i]
> toA
> A set sel [atomselect $molid "name OW and within $cut of ($seltext)"]
> and also delete
> A $sel frame $i
> In general you have to be change any selection where you
> areA referencingA the frame number.
> Best regards,
> Ajasja
> On Tue, May 24, 2011 at 15:39, maria goranovic
> <mariagoranovic_at_gmail.com> wrote:
>
> Hi
> I am trying to use Justin's script closewater.tcl to find the closest
> 1000 water molecules to the protein in each frame of the trajectory.
> Although this works perfectly, my trajectory is too big for vmd to
> handle (16,000 frames of A 85,000 atoms, no velocities). So, I thought
> of combining bigdcd.tcl to closewater.tcl to get the data out. This
> needed some minor modifications in closewater.tcl. I have the
> following problem though.
> closewater.tcl reads in the entire trajectory, and calculates the
> number of waters using the following:
> set sel [atomselect $molid "name OH2 and within $cut of ($seltext)"
> frame $i]
> (where molid is 0)
> when I use bigdcd, I call closewater using only the frame number, and
> get the following error:
> bigdcd aborting at frame 3
> atomsel: frame 3 out of range for molecule 0
> How can this be sorted out?A
> I am attaching the entire script that is being use below:
> ##############################################
> mol load gro temp.gro
> source mybigdcd.tcl
> # closewater.tcl
> # Justin Gullingsrud
> # jgulling_at_mccammon.ucsd.edu
> # 8 November 2004
> # This script processes a trajectory to create a new file containing
> just
> # a selection of atoms and the N closest water to that selection.
> A The N
> # waters are recomputed for each timestep, and need not be the same
> waters
> # in each timestep (in fact, they probably will not be); thus it is in
> general
> # meaningless to analyze the dynamics of individual waters. A However,
> it
> # may be useful for analyzing the distribution of waters around a
> relatively
> # static protein or DNA chain.
> # usage: closewater <molid> <selection text> <# waters> <filename
> prefix>
> proc closewater A {i} {
> A A set molid 0
> A A set seltext "protein"
> A A set nwat 3000
> A A set prefix "close"
> A A set wat [atomselect $molid "name OW"]
> A A if { [$wat num] < $nwat } {
> A A A error "Molecule contains ony [wat $num] water molecules."
> A A }
> # A set nframes [molinfo $molid get numframes]
> # A puts "the number of frames is $nframes"
> # A for { set i 0 } { $i < $nframes } { incr i } {
> A A A puts "now working in frame $i"
> A A A set numinner 0
> A A A set inner [list]
> A A A set cut 1
> A A A while {1} {
> A A A A set sel [atomselect $molid "name OW and within $cut of
> ($seltext)" frame $i]
> A A A A set outer [$sel list]
> A A A A $sel delete
> A A A A set numouter [llength $outer]
> A A A A if { $numouter < $nwat } {
> A A A A A set inner $outer
> A A A A A set numinner $numouter
> A A A A A incr cut
> A A A A A continue
> A A A A }
> A A A A break
> A A A }
> A A A puts "Found $numouter waters at cutoff $cut"
> A A A # take all waters from inner, and just enough from outer
> A A A catch { unset ohash }
> A A A foreach ind $outer { set ohash($ind) 1 }
> A A A foreach ind $inner { unset ohash($ind) }
> A A A set outer [lrange [array names ohash] 0 [expr $nwat - $numinner
> - 1]]
> A A A set watind [concat $inner $outer]
> A A A set sel [atomselect $molid "($seltext) or same residue as
> (index $watind)"]
> A A A $sel frame $i
> A A A set j [format %06d $i]
> # A A $sel writepdb [format $prefix-%04d.pdb $i]
> A A A $sel writepdb [format $prefix-$j.pdb]A A A
> A A A $sel delete
> # A }
> }
> bigdcd closewater temp.xtc
> bigdcd_wait_till_done
> ##############################################
> --
> Maria G.
> Technical University of Denmark
> Copenhagen
>
> --
> Maria G.
> Technical University of Denmark
> Copenhagen

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