VMD-L Mailing List
From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Fri May 27 2011 - 17:05:16 CDT
- Next message: Irene Newhouse: "RE: Protein cavities"
- Previous message: Ajasja Ljubetič: "Re: use variable in atomselect"
- In reply to: Ajasja Ljubetič: "Re: use variable in atomselect"
- Next in thread: Ajasja Ljubetič: "Re: use variable in atomselect"
- Reply: Ajasja Ljubetič: "Re: use variable in atomselect"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
On Fri, May 27, 2011 at 5:28 PM, Ajasja Ljubetič
<ajasja.ljubetic_at_gmail.com> wrote:
> Hi,
> the problem is you can't have anonymous atom selections (atomselections
> that are not saved to a variable).
this is not correct, one can very well do that.
the problem is that hao didn't say _what_ didn't work,
i.e. whether there was a syntax error or the commands
didn't yield the desired result.
> try
> set s1 [atomselect top "(resname TIP3 and name O) and (within 5 of
> protein)"]
there is a possible problem with this: in typical charmm pdb files the
"name" of
the water oxygen is OH2, so the selection string would have to be changed.
> set s1id [$s1 get resid]
here is a second problem. resid is the residue id number as it is listed
in the pdb files. those numbers usually are only unique per chain but not
globally. so using "residue" instead would be better, as that is the internal
residue number that VMD maintains and that is zero based and guaranteed
to be unique.
> set s2 [atomselect top "resid $s1id"]
of course the selection would have to replace resid with residue here as well.
> $s2 writepdb mywater.pdb
the advantage of using a variable here is that
$s2 delete
$s1 delete
can be added to clean up and avoid memory leaks.
cheers,
axel.
> 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
>
>
-- Dr. Axel Kohlmeyer akohlmey_at_gmail.com http://goo.gl/1wk0 Institute for Computational Molecular Science Temple University, Philadelphia PA, USA.
- Next message: Irene Newhouse: "RE: Protein cavities"
- Previous message: Ajasja Ljubetič: "Re: use variable in atomselect"
- In reply to: Ajasja Ljubetič: "Re: use variable in atomselect"
- Next in thread: Ajasja Ljubetič: "Re: use variable in atomselect"
- Reply: Ajasja Ljubetič: "Re: use variable in atomselect"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]