VMD plugin: ERROR) Creation of window for 'emc_gui' failed: Windows 10 install

I currently am trying to add EMC plug-in for VMD. I have VMD version 1.9.4a53 (Tcl8.6.10 / Tk8.6.10), EMC emc_win32_v9.4.4_20220801, and Perl version v5.32.1. I have followed all environmental variables/paths in the README of the EMC root directory and also added the command in the VMD resource file. Running on Windows 10 64-bit. When opening VMD extensions EMC is there and the Text editor works, however, the GUI fails with the following message:

ERROR) Creation of window for ‘emc_gui’ failed (wrong # args: should be “dict exists dictionary key ?key …?”).

Could you point me in the right direction to solve this issue? Also, I have tried VMD 1.9.3 and an emc version from 2021, but the same error exists with that combination as well.

Could you give the full TCL error output including line numbers indicating where things go wrong. Attaching this output here as a file will help this thread to be more readable. Thanks in advance!

Yes, I can. Here is the copy and paste of the TCL error output (I am a new user of matsci.org and it wouldn’t let me upload a file since I am to new to matsci.org):

wrong # args: should be “dict exists dictionary key ?key …?”
while executing
“dict exists $d {*}$keys”
(procedure “::EMC::gui::dictnlappend” line 4)
invoked from within
“::EMC::gui::dictnlappend ::EMC::gui::fields $field items $name”
(procedure “::EMC::gui::GetForceFieldNames” line 18)
invoked from within
“::EMC::gui::GetForceFieldNames”
(procedure “::EMC::gui::initialize” line 4)
invoked from within
“::EMC::gui::initialize”
(procedure “::EMC::gui::emc_gui” line 13)
invoked from within
“::EMC::gui::emc_gui”
(procedure “emc_gui_tk” line 2)
invoked from within
“emc_gui_tk”

Thank you for your bug report. I will have to look into this.


I have encountered an error with the emc plugin. The error message says “key charmm not known in dictionary” and there are missing tabs from the gui, although the gui opens. Any idea what might be causing it? I tried installing the emc plugin both ways, in the emc root and in the vmd plugin folder, with no success.

That error could indicate, that the plug-in cannot locate your force field directory, which is expected to be at

$EMC_ROOT/field

Please make sure, that this boundary condition is satisfied, i.e. $EMC_ROOT variable is set (as described in How to setup EMC for Windows) and your force field directory was not renamed.

The path was correctly set, and the field\charmm\c36a directory structure is preserved be but the problem persists. Could it be related to the different tcl versions? VMD uses 8.6 while the plugin requires 8.5.
However, this is not the only problem I am facing on windows. When I try to run the bulk example using the emc_setup.pl on a command prompt I get the following response:
D:.…\EMC_v9.4.4\examples\setup\chemistry\bulk>emc_setup.pl
EMC Setup v4.1.3 (April 7, 2022), (c) 2004-2022 Pieter J. in 't Veld

Info: reading script from “.\chemistry.esh”
Info: phase1 = {water, alcohol, salt, sugar}
Error: no project name was set.

I managed to make emc work properly by installing git for windows and running the .esh scripts directly using linux commands. Some examples fail, but I didn’t have time to look into them in more detail.

I have uploaded a new version of EMC v9.4.4 (August 1, 2023), which should have an updated version of the VMD EMC GUI. Please let me know, if issues remain.

Unfortunately, the problem persists. Here is what appears in the command window when I select the EMC gui from the VMD menu:

Info) -------------------------------------------------------------------------
Info) WELCOME TO THE EMC SETUP GUI
Info) -------------------------------------------------------------------------
Info) EMC GUI developed by
Info) Marc Siggel, Eduard Schreiner, and Pieter J. in 't Veld
Info) Version 1.5.3, 23 July 2022
Info)
Info) EMC developed by
Info) Pieter J. in 't Veld
Info)
Info) Please include this reference in published work using EMC:
Info) P.J. in 't Veld and G.C.Rutledge, Macromolecules 2003, 36, 7358
Info) -------------------------------------------------------------------------
ERROR) Creation of window for ‘emc_gui’ failed (key “charmm” not known in dictionary).

The gui window opens, but with only two tabs. I noticed that when I unpack the compressed file I receive the following message:

tar: v9.4.4/scripts/modules/Charmm/Core: Cannot create symlink to ‘…’: File name too long
tar: Exiting with failure status due to previous errors

I have tried different ways of unpacking the file, such as 7zip and the tar -zxvf command from msys2. 7zip exits with errors (about being unable to create symbolic links) without unpacking, and the linux like msys unpacks the EMC content with the above error. Could that be related to the gui error?

I experimented a little with the gui.tcl script and I realized that the error message was about line 74. Changing “set ffdefault(field) charrm” to “set ffdefault(field) field” activates the full gui with all tabs available. I am not sure what is the role of “set ffdefault(field) charmm” and why that option even exists in the drop down menu, but at least in Windows operating systems it is causing a malfunction of the whole gui.

I think I found the cause of the problem. There is no force field file named “charmm” in any of the force field sub-directories. Replacing “charmm” with “c36a” or any other force field name in line 74 of the gui.tcl script, fixes the problem.

There is still something wrong though, the force field list doesn’t seem to be populated properly. I think the way it reads force field files depends on directory structure and it doesn’t read all of them?

I installed everything on ubuntu (still on windows using the wsl2) and everything works fine. So the problem with the force field drop down menu must be some windows incompatibility of tcl scripting language.
However, there are several other problems with the example scripts, because the package has evolved but they keep the original configuration. For example the scripts look for an executable named emc_linux but the executable is now named emc_linux_x86_64 (renaming the executable solves this issue) and the record example fails (both on windows and linux) with the error:
Error: core/string.c:654 StringRead:
String expected in line 175 of input.
Program aborted.

ls: cannot access ‘record_*.pdb’: No such file or directory