From: Ajasja Ljubetič (ajasja.ljubetic_at_gmail.com)
Date: Fri May 27 2011 - 16:28:34 CDT

Hi,

the problem is you can't have anonymous atom selections (atomselections
that are not saved to a variable).

try

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

regards,
Ajasja

On Fri, May 27, 2011 at 21:55, dhacademic <dhacademic_at_gmail.com> wrote:

> 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
> work:
>
> set s1 [atomselect top "(resname TIP3 and name O) and (within 5 of
> protein)"]
> 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!
>
> Best,
> Hao
>