From: Tristan Croll (tristan.croll_at_qut.edu.au)
Date: Fri Mar 28 2014 - 03:45:22 CDT

Found my answer right where one would expect (I RTFM).

http://www.ks.uiuc.edu/Research/vmd/vmd-1.7/ug/node108.html

  * global: Moves the object into the global namespace. Atom selections created within a Tcl proc that are not made global are deleted when the proc exits.

So the answer is to do something like:

foreach sel1 $list1 sel2 $list2 {
  $sel1 global
  $sel2 global
}

within the proc that originally generates the atomselections.

If I understand correctly this is because an atomselect object is actually an iteration of the atomselect proc itself, and the atomselectnnnn variable is just the name of that proc.

Cheers,

Tristan

Tristan Croll
Lecturer
Faculty of Science and Technology
Institute of Health and Biomedical Engineering
Queensland University of Technology
60 Musk Ave
Kelvin Grove QLD 4059 Australia
+61 7 3138 6443

This email and its attachments (if any) contain confidential information intended for use by the addressee and may be privileged. We do not waive any confidentiality, privilege or copyright associated with the email or the attachments. If you are not the intended addressee, you must not use, transmit, disclose or copy the email or any attachments. If you receive this email by mistake, please notify the sender immediately and delete the original email.

On 28 Mar 2014, at 6:00 pm, "Norman Geist" <norman.geist_at_uni-greifswald.de<mailto:norman.geist_at_uni-greifswald.de>> wrote:

You might be interested in global variables or environment variables. Try something like:

set env(SEL1) [atomselect top “all”]

and to use it:

$env(SEL1) get index

Should work, but untested. Additionally, you shouldn’t call a atomselect object a “list” which is something very different, especially for TCL, just for better understanding.

Norman Geist.

Von: owner-vmd-l_at_ks.uiuc.edu<mailto:owner-vmd-l_at_ks.uiuc.edu> [mailto:owner-vmd-l_at_ks.uiuc.edu] Im Auftrag von Tristan Croll
Gesendet: Freitag, 28. März 2014 01:04
An: vmd-l list
Betreff: vmd-l: TCL scripting question: how to make a list of atomselections persistent?

I have a proc which on the fly creates two sets of atomselections, each of which I have stored in list variables (call them $list1 and $list2). A second proc then uses data from the atomselections in $list1 to write coordinates to $list2. This works fine as long as the second proc is called from within the first – but I want to be able to re-call the second proc (from a head proc running a GUI) to update coordinates as the reference structure changes. This is where problems arise: $list1 and $list2 are actually just lists of text pointers to atomselections, but the actual atomselect variables were “helpfully” dropped the moment the first proc completed. I’m just wondering if someone could advise me on the most elegant way to hand such procedurally-generated variables back up the chain to that head proc?

Thanks,

Tristan

Tristan Croll
Lecturer
Faculty of Health
Institute of Health and Biomedical Engineering
Queensland University of Technology
60 Musk Ave
Kelvin Grove QLD 4059 Australia
+61 7 3138 6443

This email and its attachments (if any) contain confidential information intended for use by the addressee and may be privileged. We do not waive any confidentiality, privilege or copyright associated with the email or the attachments. If you are not the intended addressee, you must not use, transmit, disclose or copy the email or any attachments. If you receive this email by mistake, please notify the sender immediately and delete the original email.

________________________________
[http://static.avast.com/emails/avast-mail-stamp.png] <http://www.avast.com/>

Diese E-Mail ist frei von Viren und Malware, denn der avast! Antivirus<http://www.avast.com/> Schutz ist aktiv.