VMD-L Mailing List
From: Ana Celia Araujo Vila Verde (avilaverde_at_engr.psu.edu)
Date: Thu Apr 19 2007 - 10:29:43 CDT
- Next message: Vlad Cojocaru: "Re: tcl variable withing variable name"
- Previous message: Axel Kohlmeyer: "Announcement: QM/MM Workshop"
- In reply to: Vlad Cojocaru: "tcl variable withing variable name"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Hi,
I'm not entirely sure I understood you correctly, but here are my two cents (check the line with the comment below):
foreach res {77 183 188 198} {
set CA [atomselect 0 "name CA and resid $res"]
set RESNAME [$CA get resname]
set RES_SEL [set RESNAME] ;# when you use [set RESNAME] without a value, it returns the value currently stored in variable RESNAME. So, RES_SEL will take the current value stored in RESNAME.
set A [atomselect 0 "$RES_SEL and resid $res"]
.............
}
_________________________________
Ana Célia Araújo Vila Verde
Penn State University
Department of Chemical Engineering
Fenske Laboratory
University Park, PA 16802
USA
Phone: +(1) (814) 863-2879
Fax: +(1) (814) 865-7846
avilaverde_at_engr.psu.edu
http://www.che.psu.edu/Faculty/JMaranas/group/avv.html
http://www.gfct.fisica.uminho.pt/Members/acvv
_________________________________
-----Original Message-----
From: owner-vmd-l_at_ks.uiuc.edu [mailto:owner-vmd-l_at_ks.uiuc.edu] On Behalf Of Vlad Cojocaru
Sent: Thursday, April 19, 2007 8:58 AM
To: VMD list
Subject: vmd-l: tcl variable withing variable name
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: "Re: tcl variable withing variable name"
- Previous message: Axel Kohlmeyer: "Announcement: QM/MM Workshop"
- In reply to: Vlad Cojocaru: "tcl variable withing variable name"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]