VMD-L Mailing List
From: Vlad Cojocaru (Vlad.Cojocaru_at_eml-r.villa-bosch.de)
Date: Thu Apr 19 2007 - 11:13:21 CDT
- Next message: Vlad Cojocaru: "process and plot matrix data"
- Previous message: Ana Celia Araujo Vila Verde: "RE: tcl variable withing variable name"
- Maybe in reply to: Axel Kohlmeyer: "Re: tcl variable withing variable name"
- Next in thread: Peter Freddolino: "Re: tcl variable withing variable name"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Dear all,
Thanks a lot for answering ... It also looks like "set RES_SEL [set
${RESNAME}_AT]" works just fine for what I want to do.... but probably
an array would be a nicer solution ....
cheers
vlad
>
>
>
> Peter Freddolino wrote:
>
>> Hi Vlad,
>> I may not properly understand what you're after, but if I do, then you
>> can do this using eval:
>> eval "set RES_SEL \$${RESNAME}_AT"
>>
>> However, using eval is almost never the right answer; in your case you'd
>> probably be happier using a tcl array to store the selections, indexed
>> using the residue names:
>>
>> array set SELARR {LEU "name CD1 CD2" VAL "name CG1 CG2"}
>>
>> ...
>>
>> set RES_SEL $SELARR($RESNAME)
>>
>> Peter
>>
>> Vlad Cojocaru wrote:
>>
>>
>>> Dear vmd users,
>>>
>>> It might be a stupid question but still I couldnt figure out the
>>> answer ... I am trying to do something like the following:
>>>
>>> set LEU_AT "name CD1 CD2"
>>> set VAL_AT "name CG1 CG2"
>>> foreach res {77 183 188 198} {
>>> set CA [atomselect 0 "name CA and resid $res"]
>>> set RESNAME [$CA get resname]
>>> set RES_SEL ?$${RESNAME_AT??
>>> set A [atomselect 0 "$RES_SEL and resid $res"]
>>> .............
>>> }
>>>
>>> The problem is at line 6 when defining $RES_SEL (see question marks) .
>>> $RESNAME would become VAL or LEU and I would like to select that
>>> selection corresponding to $RESNAME ... For that I would need to
>>> assign one variable name ($RES_SEL) using another variable ($RESNAME)
>>> Can anybody tell how to do this in tcl ?
>>>
>>> If naybody has a better solution to do this ... I would appreciate ..
>>>
>>> Thanks
>>> Vlad
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>
-- ---------------------------------------------------------------------------- Dr. Vlad Cojocaru EML Research gGmbH Schloss-Wolfsbrunnenweg 33 69118 Heidelberg Tel: ++49-6221-533266 Fax: ++49-6221-533298 e-mail:Vlad.Cojocaru[at]eml-r.villa-bosch.de http://projects.villa-bosch.de/mcm/people/cojocaru/ ---------------------------------------------------------------------------- EML Research gGmbH Amtgericht Mannheim / HRB 337446 Managing Partner: Dr. h.c. Klaus Tschira Scientific and Managing Director: Prof. Dr.-Ing. Andreas Reuter http://www.eml-r.org ----------------------------------------------------------------------------
- Next message: Vlad Cojocaru: "process and plot matrix data"
- Previous message: Ana Celia Araujo Vila Verde: "RE: tcl variable withing variable name"
- Maybe in reply to: Axel Kohlmeyer: "Re: tcl variable withing variable name"
- Next in thread: Peter Freddolino: "Re: tcl variable withing variable name"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]