From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Thu Oct 28 2010 - 09:22:13 CDT

dear ajasja,

On Thu, Oct 28, 2010 at 7:56 AM, Ajasja Ljubetič
<ajasja.ljubetic_at_gmail.com> wrote:
> Dear all,
> I believe the following script should work, but it returns "can't unset
> "upproc_var_atomselect23903": no such variable" .

you are triggering an "undocumented feature" in VMD.

if you want the long explanation and the code to remove
the inconsistency in this behavior, you'll have to give me
some time to dig it out of my private VMD tree. i've been
proposing a couple of times to have this fixed, but it has
been put on the backburner, since so extremely few people
run into this issue, and the changes would require extensive
testing to make sure no existing script/plugin is broken by it.
since atom selections are such a key feature in VMD, the
reluctance to apply this kind of change is very understandable.

the short explanation is: don't worry. it is a side effect of
$sel global and can be ignored. try replacing:

  $sel delete

with:

 catch { $sel delete } msg

and your code should work fine.

cheers,
    axel.

> Best regards,
> Ajasja
>
>
> proc freesel {sel} {
>  $sel delete
> }
> proc atest {sel} {
>   set a [atomselect top $sel]
>   $a global
>   return $a
> }
> proc dotest {} {
>   set selx [atest "protein"]
>   freesel $selx
> }
> dotest

-- 
Dr. Axel Kohlmeyer
akohlmey_at_gmail.com  http://goo.gl/1wk0
Institute for Computational Molecular Science
Temple University, Philadelphia PA, USA.