From: Bennion, Brian (Bennion1_at_llnl.gov)
Date: Thu Apr 19 2012 - 14:32:53 CDT

This is the classic "i put the atomselection in the loop" problem.
you are making enough atomselections to run out of memory for this job.

Brian

________________________________________
From: owner-vmd-l_at_ks.uiuc.edu [owner-vmd-l_at_ks.uiuc.edu] On Behalf Of Bryan Roessler [roessler_at_uab.edu]
Sent: Thursday, April 19, 2012 11:17 AM
To: vmd-l_at_ks.uiuc.edu
Subject: vmd-l: Problem with hydration script

proc residue_hydration {firstFrame lastFrame} {
for {set f $firstFrame} {$f < $lastFrame} {incr $f} {
set sel1 [atomselect top "protein and within 3 of water"]
$sel1 frame $f
lappend restotal [lsort -unique -integer [$sel1 get resid]]
}
set outDataFile [open hydration.csv a]
for {set r 1} {$r < 1480} {incr r} {
set num [llength [lsearch -exact -all $restotal $r]]
puts $outDataFile "$r,$num"
unset indnumber num
}
close $outDataFile
}

I'm having a trouble with this hydration analysis script. I'm trying to record the number of frames that a particular residue is within 3A of water.

Whenever I run the first for loop, it continues to infinity (crashing VMD) although I cannot understand why. I've tried using "animate goto $f" and "display update ui" to no avail. Note the use of the "-unique" switch so that the residue is only counted once (even if multiple atoms are within 3A of water).

It's driving me nuts!