From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Thu Apr 15 2010 - 19:45:15 CDT

On Thu, Apr 15, 2010 at 5:06 PM, Ronald Salesky <rsalesky_at_unm.edu> wrote:
> Hello all,
>
> I am attempting to have TCL variable arguments within a matrix w/o success.
> For example
>
>
> set beta 45
> set pi 3.14159
> set rbeta  [expr $beta * $pi / 180.0]
> set roty {{[expr cos($rbeta)] 0.0 [expr -sin($rbeta)] 0.0} {0.0 1.0 0.0 0.0}
> {[expr sin($rbeta)] 0.0 [expr cos($rbeta)] 0.0}  {0.0 0.0 0.0 0.0}}
> set r [coordtrans $roty {$x $y $z}]
>
> which results in the message:
>
> "vectrans: poorly formed matrix" when attempting to run in the VMD
> Tkconsole. Is there a way to do this? Or is it not possible because vectors
> and matrices are VMD extensions to TCL?

this is actually a trivial question about tcl lists.
a list in tcl is a string with the elements separated
by whitespace and { } is a literal string, while " "
is a string that gets expanded. so if you replace
all { } with " ", the variables will be expanded and
the expressions evaluated. for more details see
the tcl tutorial at www.tcl.tk

cheers,
     axel.

>
> Thank you,
>
> Ron
>
>

-- 
Dr. Axel Kohlmeyer    akohlmey_at_gmail.com
http://sites.google.com/site/akohlmey/
Institute for Computational Molecular Science
Temple University, Philadelphia PA, USA.