From: dhacademic (
Date: Fri May 27 2011 - 14:55:26 CDT

Hi All,

Here is a question about using variable in atomselect. I want to pick those
oxygen atoms (from water) within 5 angstrom of protein, and write all these
water molecules into a file. Following is the script I used, but it does not

set s1 [atomselect top "(resname TIP3 and name O) and (within 5 of
set s1id [$s1 get resid]
[atomselect top "resid $s1id"] writepdb mywater.pdb

It looks like that variable can not be used in atomselect. Can anyone give
some help? Thanks very much!