From: Ashar Malik (asharjm_at_gmail.com)
Date: Sun Jun 03 2018 - 14:29:11 CDT

Every time a new molecule is loaded it becomes the "top" molecule.
You can use this.

if you load a molecule, you can fetch its ID using

molinfo top get id

you can save this number to a variable and use that in the remainder of
your script.

Hope I understood your problem and this helps. Otherwise write back.

On Mon, Jun 4, 2018 at 7:02 AM, Rune Thomas Kidmose <rtk_at_mbg.au.dk> wrote:

> Basically, I cant figure out how to reinitialize VMD before running the
> same script twice or more in the same session.
>
>
> My current problem is that I have a script which loads 5
> different molecules. During the loading each molecule is then automatic
> given a mol ID number (0-4) as is standard.
>
> I then use those mol IDs to set various features for specfic molecules
> (view matrices, modstyles, modmaterials etc. so e.g. mol modcolor 0 3
> ColorID 8 etc.). However, if I then make some changes within the tcl
> script and I want to reload the script to see the effects of the changes,
> I am hit with the problem that the molecules I now load get new mol ID's
> assigned (not 0-4 but e.g. 5-9). This means that the mol id specific
> commands are not executed on the newly loaded molecules. This is of course
> because I run the script in the same VMD 1.93 session that I just ran the
> script from. But even if manual delete the molecules before running the
> script again I still face the same problem.
>
>
> My current solution is to just restart VDM and run the script, which
> works, but I cant help to wonder if there is some smart way to mitigate
> this?
>
>
> I run the scripts using the play command from the tcl consol.
>
>
> In PyMol I always start my scripts with the command "reinitialize" which
> resets everything in PyMol, does something related exist for VMD 1.93 ?
>
>
> Does what I describe make sense?
>
>
> Cheers
>
>
> Ruki
>
>
>
>

-- 
Best,
/A