Wednesday, August 11, 2010

ChemSketch on Linux Again

Last year I wrote about using ChemSketch on Linux.  It is about the only Windows program that I regularly use these days.  Since switching to Linux I have not  completely settled on a chemical structure drawing program.  Sometimes I still use ChemSketch on Windows and then copy the image into OpenOffice, sometimes use another program on Linux - usually MarvinSketch.

Thanks to a comment left by Dragly on my original ChemSketch post in January, I can now reliably use ChemSketch on Linux.

ChemSketch is a Windows program, so I have to use Wine in order to run ChemSketch.  The problem was that ChemSketch would run fine the first time it is started after installation, but every other time I tried to run the program it would hang-up without the ChemSketch window ever appearing.

Dragly's comment referred me to:
http://markmail.org/message/grddjlgsn3dh5kqp
And he also pointed out that the program could be run with the window maximized by using this command, provided that the file path to the program is correct:
wine start /MAX C:\\WINDOWS\\TEMP\\ACDFREE12\\CHEMSK.EXE
This works, but it behaves a bit flakey for me running Ubuntu 10.04 and Wine 1.1.42.  First the ACD/Lab Products panel appears (very slowly) - after clicking the "OK" button, the program itself loads on the workspace to the right of the one I am working on. The 3D View program behaves the same way - you need to use:
wine start /MAX C:\\WINDOWS\\TEMP\\ACDFREE12\\SHOW3D.EXE 
to get it to open normally, and then it shifts one workspace to the right.

After digging around a bit, it turns out that the problem is in the Wine registry file, which for me is at
/home/steve/.wine/user.reg
This file is updated every time you close a program that is running under Wine.  The quick and dirty solution would be to delete this file before running ChemSketch.  Except for losing all the settings for every program you run with Wine, this works pretty well.  The program starts normally - if a bit slowly compared to Windows.

The clever thing to do would be to edit user.reg to delete the offending setting, which starts with
[Software\\Advanced Chemistry Development (ACD)\\Size]
and is followed by a bunch of numbers.  Deleting this setting allows you to run ChemSketch and the 3DViewer "normally."    This is a bit tedious but do-able.  To be really clever I should write a program to do it for me every time I run ChemSketch.

Under Windows, you can open the 3DViewer from ChemSketch by using the ACD/Labs menu. Unfortunately, when I run under Linux, this menu does not have any of the labels visible.  The first menu item is the 3DViewer.  Or you can right-click the ACD/Labs icon in the Gnome panel at the top of the screen and select the 3D Viewer to open it.

Copying between the ChemSketch and 3D Viewer windows works, and so do the Database search options.  The only remaining problem is getting the figure into an Open Office document.  You can't simply copy the image, nor can you insert an OLE object the way you would in Windows.  Instead you will need to save the figure as an image and import the image into the Open Office document.  The downsides of this are adding an extra step to save the image, and not being able to edit the image easily unless you also saved the original ChemSketch file.

Enhanced by Zemanta

4 comments:

Anonymous said...

Did you know about ChemDoodle? It is built for Linux.

Steve W said...

Thanks for the tip, I'll have to check it out.

M. Ail said...

I googled my problem and found this hack to fix the problem, and it worked fine. Right afterwards I discovered an even easier way to start ChemSketch via wine's explorer.exe, but using the shortcut .ink file!

M. Ail said...

*the lnk file. BUT! Actually, it even works by just double-clicking the shortcut!