From: Olaf Lenz (olenz_at_fias.uni-frankfurt.de)
Date: Thu Mar 29 2007 - 04:38:08 CDT

-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Hi!

Your question is a relatively basic Tcl question, and not VMD-related,
therefore I think you are using the wring mailing list. I would
recommend to use a basic tutorial on Tcl, e.g.

        http://www.msen.com/~clif/TclTutor.html

namd vmd wrote:
> I want to assign different variable names for each residue in a protein
> using a for loop. Something like:
>
> for {set i 1} {$i < 10} {incr i} {
> set prot${i} [atomselect top "protein and resid $i "]
> puts $prot${i}
> }

To give you a short answer to your question, anyway: you can write the
code as follows, using associative arrays:

for {set i 1} {$i < 10} {incr i} {
        set prot($i) [atomselect top "protein and resid $i "]
        puts $prot($i)
}

Olaf
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFGC4kAtQ3riQ3oo/oRA4KcAKClpf6yo38C4zX0ogyMYtsgJbELlwCfYFUc
aNW0UPnVyV3kPVHbIanbxsQ=
=PgFQ
-----END PGP SIGNATURE-----