From: Ashar Malik (asharjm_at_gmail.com)
Date: Mon Jan 25 2016 - 12:59:23 CST

It is always a good idea to keep the selection statements small. You can
always make a large selection and gradually make it smaller. In the
previous case I think you would need an "and" before the last segment.

As said before anything is possible with VMD especially when you couple it
with the command line. One thing to keep in mind is that you could use
Graphic//Representation//selection to try out these commands. By entering
combinations in the selection tap and clicking "create rep" would update
the visualization window or give an error like you just said "can not parse
selection".

Do not that in the selection tab you don't have to say

set sel1 [atomselect $mol {...

You will only put the selection statement which is in the curly braces in
my previous message or use Norman's method or make your own new one. This
would help you troubleshoot your selection statement rapidly and hence not
be dependant on answers here.

Hope the " and " works.
Good luck.
On Jan 26, 2016 3:58 AM, "Monika Madhavi" <monikamadhavi_at_gmail.com> wrote:

> Thanks all. Btw is it possible to combine something with "not" here. If I
> want to select only inter-molecular H but not intra-molecular can I use
> set sel1 [atomselect $mol "name \H.*\ and
> sqrt(sqr(x-$x1)+sqr(y-$y1)+sqr(z-$z1)) < 5 not index $ind1"]
>
> It is mentioned in examples that we can use ''not" command but it gives
> and error "cannot parse statement"
>
> Thank you.
> Monika
>
>
> On Mon, Jan 25, 2016 at 8:39 PM, M K <mahyar.karimi20_at_gmail.com> wrote:
>
>> ah, I think because Monika wants the "H atoms" around "H atoms", it is
>> tricky with exwithin :)
>> However, I believe it should be possible with exwithin, if we combine it
>> with some other keywords :)
>> Nothing is impossible in VMD... :-P
>>
>> On Mon, Jan 25, 2016 at 8:56 PM, Ashar Malik <asharjm_at_gmail.com> wrote:
>>
>>> correction to the last message:
>>>
>>> should have been $mol and not top (have a habit of doing top)
>>>
>>> set sel1 [atomselect $mol {name "H.*" and sqrt(sqr(x-$x1)+sqr(y-$y1)+
>>> sqr(z-$z1)) < 5}]
>>>
>>> on exwithin:
>>>
>>> If my understanding is correct - exwithin would select EVERYTHING except
>>> all Hydrogens?? which I think is not what Monika is trying to do??
>>>
>>>
>>> On Mon, Jan 25, 2016 at 10:35 PM, M K <mahyar.karimi20_at_gmail.com> wrote:
>>>
>>>> I was wondering if "exwhithin" command can be used here. For example:
>>>>
>>>> exwithin 5 of "name "H.*"
>>>>
>>>> Does it work for Monika's purpose?
>>>>
>>>> Bests
>>>>
>>>> On Mon, Jan 25, 2016 at 6:09 PM, Norman Geist <
>>>> norman.geist_at_uni-greifswald.de> wrote:
>>>>
>>>>> You may not nest quotes, without escaping them.
>>>>>
>>>>>
>>>>>
>>>>> set sel1 [atomselect $mol "name \"H.*\" and
>>>>> sqrt(sqr(x-$x1)+sqr(y-$y1)+sqr(z-$z1)) < 5"]
>>>>>
>>>>>
>>>>>
>>>>> or use single quotes within double quotes:
>>>>>
>>>>>
>>>>>
>>>>> set sel1 [atomselect $mol "name ‘H.*’ and
>>>>> sqrt(sqr(x-$x1)+sqr(y-$y1)+sqr(z-$z1)) < 5"]
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Norman Geist
>>>>>
>>>>>
>>>>>
>>>>> *Von:* owner-vmd-l_at_ks.uiuc.edu [mailto:owner-vmd-l_at_ks.uiuc.edu] *Im
>>>>> Auftrag von *Monika Madhavi
>>>>> *Gesendet:* Montag, 25. Januar 2016 06:31
>>>>> *An:* vmd-l_at_ks.uiuc.edu
>>>>> *Betreff:* vmd-l: select atoms within a sphere - atomselect
>>>>>
>>>>>
>>>>>
>>>>> Dear all,
>>>>>
>>>>>
>>>>>
>>>>> I want to select all the inter-molecular hydrogen atoms within a
>>>>> sphere of radius 5A from a central hydrogen atom. Coordinates of the
>>>>> central atom are x1,y1,z1. I tried this atomselect command.
>>>>>
>>>>>
>>>>>
>>>>> set sel1 [atomselect $mol "name "H.*" and
>>>>> sqrt(sqr(x-$x1)+sqr(y-$y1)+sqr(z-$z1)) < 5"]
>>>>>
>>>>>
>>>>>
>>>>> this gives me an error saying "extra characters after quoted text"
>>>>>
>>>>>
>>>>>
>>>>> Please help me to resolve this problem.
>>>>>
>>>>>
>>>>>
>>>>> Thank you.
>>>>>
>>>>> Monika
>>>>>
>>>>> --
>>>>>
>>>>> W.A.Monika Madhavi
>>>>>
>>>>> Lecturer (Probation),
>>>>>
>>>>> Department of Physics,
>>>>>
>>>>> University of Colombo.
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Best,
>>> /A
>>>
>>
>>
>
>
> --
> W.A.Monika Madhavi
> Lecturer (Probation),
> Department of Physics,
> University of Colombo.
>