From: Gustavo Gust (gust77gust_at_gmail.com)
Date: Wed Nov 11 2009 - 09:04:34 CST

Dear colleagues,
with vmd, I'm trying to use a script like this (vmd -dispdev text -e
script.tcl), which select the O atoms from TIP3 water molecules at 3
angstroms from the molecule GOL:

package require pbctools
set dir1 "/home/molecule/eq1"

mol load psf $dir1/structure/file.psf dcd $dir1/file.dcd
set nf [molinfo top get numframes]
pbc readxst $dir1/file.xst -all
pbc wrap -all
pbc box
set outfile [open file.dat w]
for { set i 1 } { $i < $nf } { incr i } {
set sel [atomselect top "(resname TIP3 and name OH2) and pbwithin 3 of
(resname GOL)" frame $i]
set nw [$sel num]
puts $outfile "$i $nw"
$sel delete
}
close $outfile

Sometimes it's working fine, but frequently I get the following error
message:

terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Abort

I'm using VMD 1.8.7 and, according to former messages in the mail list
(Arneh Babakhani, Josh Stone, Feb 02 2007), I've included the line

$sel delete

but I couldn't fix this error. Also, I've tried to select index, but it's
not working anyway.

Is there other alternatives or suggestions to avoid this problem?
I'm running VMD 1.8.7 in a Linux machine with Open Suse 10.3 and 2 Gb of
RAM. Every dcd file has 1.9 Gb. The dimensions of the box are in xst file.

Thank you for your attention,

Gustavo Velardez