next up previous contents index
Next: @references Up: Referencing Tcl data Previous: Referencing Tcl data



If a keyword starts with a $, the rest of the keyword is used as the Tcl variable name. The Tcl interpreter is queried for the associated data, which is then used as it would be for any other keyword. The variable can be either an array, in which case element 0 is for the first atom, 1 for the second, ...; or a scalar value, in which case that value is used for all the atoms. For an array example, suppose the Tcl array ``foo'' contained the values foo(n) = 2*n. Then the statement $foo < 10 selects atom with indices 0 to 4, while $foo 20 to 30 6 selects indices 10, 11, 12, 13, 14, 15, and 3. If foo has a scalar value, such as PRO, the statement resname eq $foo selects the proline residues. Because of a limitation in Tcl, the only way VMD recognizes if a variable is an array is if element 0 exists.

Justin Gullingsrud
Tue Apr 6 09:22:39 CDT 1999