From: Maxim Belkin (mbelkin_at_ks.uiuc.edu)
Date: Mon Feb 08 2016 - 10:28:24 CST

I don’t see any significant problem here so molecule deletion should work just fine. However, in the script you refer to the molecule using "top" (mol addrep top) and numbers (second number in mol modstyle and mol modcolor). The correct way to write it would be:

set test "test_115.xplor"
source readedm.tcl

set mol [mol new]
  readedm $test
  mol addrep $mol
  mol modstyle 0 $mol Isosurface 0.300000 0 2 1 1 1
  mol modcolor 0 $mol ColorID 0
mol delete $mol

Here indentation is for visual purposes only.

Now, in the "readedm.tcl" they use "top" molecule which is fine in your case as long as you don’t add/delete molecules after "mol new" and before "readedm $test".

> On Feb 8, 2016, at 10:16, Irem Altan <irem.altan_at_duke.edu> wrote:
>
> Below is the relevant part of the code:
>
>
> set test “test_115.xplor”
>
> source readedm.tcl
>
> set molnum1 [mol new]
> readedm $test
> mol addrep top
> mol modstyle 0 0 Isosurface 0.300000 0 2 1 1 1
> mol modcolor 0 0 ColorID 0
>
> mol delete $molnum1
>
>
> where readedm.tcl is http://www.ks.uiuc.edu/Research/vmd/script_library/scripts/readedm/readedm.tcl
>
> I now realize that had I been creating the variables correctly, mol modstyle 0 etc. should not have worked.
>
>> On Feb 8, 2016, at 11:05 AM, Maxim Belkin <mbelkin_at_ks.uiuc.edu> wrote:
>>
>> Please post the relevant part of the script you use. You are apparently making a mistake in there and it’s hard to help you without knowing what exactly you are doing.
>>
>> The error message says that you are trying to do something like:
>>
>> mol delete $variable
>>
>> where variable = molnum$molnum
>>
>> However, you should be doing:
>>
>> mol delete $molnum
>>
>> where molnum is 0, 1, 2, 3... and not molnum0, molnum1, molnum2,...
>>
>>
>>
>>
>>> On Feb 8, 2016, at 09:55, Irem Altan <irem.altan_at_duke.edu> wrote:
>>>
>>> Thanks for the answer. I can create the variables and load molecular data just fine, but when I do mol delete $molnum, I get the error "can't read “molnum1": no such variable”. mol delete 0, however, works.
>>>
>>>> On Feb 8, 2016, at 10:34 AM, Maxim Belkin <mbelkin_at_ks.uiuc.edu> wrote:
>>>>
>>>> set molnum [mol new]
>>>> ...
>>>> mol delete $molnum
>>>>
>>>>
>>>> On 02/08/2016 09:02 AM, Irem Altan wrote:
>>>>> Hi,
>>>>>
>>>>> I am reading data into molecules via a .tcl script, and then I eventually remove them:
>>>>>
>>>>> mol new
>>>>> …
>>>>> mol delete 0
>>>>>
>>>>> Now if I want to read in an extra molecule, its number becomes 1, despite the fact that 0 doesn’t exist anymore. Is there a way for me to set the number to 0? If not, how can I check within my script automatically what the next number will be?
>>>>>
>>>>> Best,
>>>>> Irem
>>>>
>>>
>>
>