From: Jianhui Tian (jianhuitian_at_gmail.com)
Date: Mon Apr 23 2007 - 09:24:48 CDT

Hi all,

I have a water box of 1536 molecules. Now what I want to do is to make
atomselect of each of the molecule and then get the residue list of other
molecules within some distance of each water molecule. The problem is that
the tcl code will get killed. I dont know the reason. Is it due to the
memory limitation. I only have 512 memory in my PC now. How can I do what I
want to do here? I also posted the code I write about this part.

#########################################
#########################################
 proc simplifylist {slist} {
 set newlist { }
 foreach elem $slist {
  if {[lsearch $newlist $elem] == -1} {
    lappend newlist $elem
  }
 }
 set newlist [lsort $newlist]
 return $newlist
}

########################################
# Load the trajectoty files.
mol new prmtop type parm7
mol addfile dcd type dcd waitfor all

set numfrm [molinfo top get numframes]
set systm [atomselect top all]

#######################################
#Get all the atomselect.
for {set i 1} {$i <= 1536} {incr i} {
   set atom($i) [atomselect top "water within 5.5 of resid $i"]
}

for {set i 0} {$i < $numfrm} {incr i} {

 ######### Get all the connected list for each of the water molecule.
 for {set j 1} {$j <= 1536} {incr j} {
  $atom($j) frame $i
  $atom($j) update
  set list($j) [$atom($j) get resid]
  set list($j) [simplifylist $list($j)]
  puts "frame $i residue $j: $list($j)\n"
 }
}

exit