VMD-L Mailing List
From: Vermaas, Josh (vermaasj_at_msu.edu)
Date: Fri May 28 2021 - 14:03:41 CDT
- Next message: Paulo E. Abreu: "Status of VR in VMD"
- Previous message: Ebru Cetin: "VMD Timeline Plug-in Selection in Hydrogen Bonds Calculations"
- In reply to: Nathan Kern: "Re: Atom selection with asterisk atom name"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Example #101021231231231 of why copying the list is useful. I’ve been using escape characters like a noob for years!!!
-Josh
From: Nathan Kern <nathan.kern_at_lehigh.edu>
Date: Friday, May 28, 2021 at 12:49 PM
To: "Vermaas, Josh" <vermaasj_at_msu.edu>
Cc: Saikat Pal <saikatpaliitg_at_yahoo.com>, VMD Mailing List <vmd-l_at_ks.uiuc.edu>
Subject: Re: vmd-l: Atom selection with asterisk atom name
Correction:
set sel1 [atomselect top {name "C5.*" "C4.*" "O4.*"}]
On Fri, May 28, 2021 at 12:48 PM Nathan Kern <nathan.kern_at_lehigh.edu<mailto:nathan.kern_at_lehigh.edu>> wrote:
It's probably worth pointing out that if you don't need to do parameter substitution, then Tcl's literal string construct {} will tend to result in code that's easier to read, since you wouldn't usually need to escape quotes.
E.g. Josh's selection example:
set sel1 [atomselect top "name \"C5.*\" \"C4.*\" \"O4.*\"”]
Could be rewritten as:
set sel1 [atomselect top {name "C5.*" C4.*" O4.*"}]
Nathan
On Fri, May 28, 2021 at 12:42 PM Vermaas, Josh <vermaasj_at_msu.edu<mailto:vermaasj_at_msu.edu>> wrote:
Hi Saikat,
Please keep the mailinglist in your replies for context. In scripts, the quotes need to be escaped, otherwise Tcl can’t determine where the strings begin and end. Try:
set sel1 [atomselect top "name \"C5.*\" \"C4.*\" \"O4.*\"”]
When answering questions of which selection is correct, you can try things like “puts [$sel2 num]”. Does it give a reasonable output? My guess is that it didn’t, since I suspect that no atoms matched the sel2 selection you wrote, since single quotes won’t use regular expressions.
-Josh
From: Saikat Pal <saikatpaliitg_at_yahoo.com<mailto:saikatpaliitg_at_yahoo.com>>
Date: Friday, May 28, 2021 at 11:38 AM
To: "Vermaas, Josh" <vermaasj_at_msu.edu<mailto:vermaasj_at_msu.edu>>
Subject: Re: vmd-l: Atom selection with asterisk atom name
Thank you for your kind reply. I want to use it in tcl script. So when I have tried the following command:
set sel1 [atomselect top "name "C5.*" "C4.*" "O4.*"]
It shows error:
extra characters after close-quote
But when I have used:
set sel2 [atomselect top "name 'C5.*' 'C4.*' 'O4.*'"]
There is no error. So my question is it correct?
Thanks and Regards,
Saikat Pal
On Wednesday, 26 May, 2021, 10:33:01 pm IST, Vermaas, Josh <vermaasj_at_msu.edu<mailto:vermaasj_at_msu.edu>> wrote:
Hi Saikat,
This is in the user guide. https://www.ks.uiuc.edu/Research/vmd/current/ug/node94.html
For your selection (anything starting with C1, C4, C5, or O5), I think it would simplify to this:
name “C[145].*” “O4.*”
-Josh
From: <owner-vmd-l_at_ks.uiuc.edu<mailto:owner-vmd-l_at_ks.uiuc.edu>> on behalf of Saikat Pal <saikatpaliitg_at_REMOVE_yahoo.com>
Date: Wednesday, May 26, 2021 at 3:53 AM
To: VMD Mailing List <vmd-l_at_ks.uiuc.edu<mailto:vmd-l_at_ks.uiuc.edu>>
Subject: vmd-l: Atom selection with asterisk atom name
Dear all,
I want to select multiple atoms with asterisks like C5* C4* O4* C1*. So what should I do?
Thanks and Regards,
Saikat Pal