Laboratory of Crystallography and Coordination Chemistry

National Centre for Scientific Research "Demokritos", Institute of Materials Science

Athens, Greece



Small Molecule Crystallography on GNU/Linux




For a scientist, to leave Windows may be like an ugly divorce; unlike web browsers, mail clients and text editors, scientific software may be very particular. For specific jobs there may exist only one or two "killer apps" that everyone uses (or is expected to use). In such cases, more often than not, marketing has it that they are unavailable (in a native version) in Operating Systems other than Windows.


I had the same problem with various crystallographic packages when I decided to quit Windows for a GNU/Linux OS, and I have tried to deal with that problem without resorting to virtualization. Below is what I've done so far.


Please note that this is not a complete howto, and it may probably not work for all machine/OS combinations. These are mostly some notes of mine, that I decided to post here so that I do not forget how I have set up my system. There are already some reviews covering the subject (see Crystallography under Linux, Crystallography on Ubuntu), but they mostly concern software for protein crystallography. I haven't seen anything on small molecule crystallography, so I thought that posting what I have found would be useful.


What is described here has been tested on Ubuntu 10.04 Lucid Lynx (kernel version 2.6.32-25-generic, GNOME version 2.30.2), running on a Toshiba Satellite L505-141 laptop (ATI Technologies Inc M96 [Mobility Radeon HD 4650] graphics card) and it presupposes a working knowledge of the GNU/Linux OS and the Wine application layer. Wine is a sort of application layer/emulator that allows the execution of Windows programs on a Linux machine without the need of setting up a virtual machine.



1. WinGX (with Wine)

2. Mercury (native Linux version)

3. Mercury (Windows version with Wine)

4. Diamond (with Wine)

5. Remotely accessing the Cambridge Crystal Structure Database





WinGX (with Wine)


This is probably the most useful package for small molecule crystallographers. There is no Linux native version of WinGX (yet), so you first need to install Wine (e.g. sudo apt-get install wine).


1) Download the WinGX package. The latest version (currently 1.80.05) can be found here.

(You may want to read about the WinGX installation on GNU/Linux here, but as you'll see below, things can be much simpler than that. So you might as well just read on.)


2) Press Alt+F2 and enter "winefile" in the window that pops up. After winefile has started, go the location of the installer file and double-click it. Let the installer run as you would on Windows. I left all the default values during installation. The following description is based on that premise. (NB: If you change directory locations, make sure this is reflected on the parameters you choose next)


3) Installation has always worked flawlessly for me, and at the end you have a "WinGX" submenu under your "Wine" menu (click Applications-Wine-Programs-WinGX). If you want to add the WinGX launcher to your panel, right-click it and select "Add this launcher to panel".


4) To set environmental parameters. Right-click your panel launcher and select "Properties". You may see that the "Command" field shows:

env WINEPREFIX="/home/user/.wine" wine C:\\windows\\command\\start.exe /Unix /home/user/.wine/dosdevices/c:/users/Public/Start\ Menu/Programs/WinGX/WinGX.lnk

(where user is the name of your user account).


Go to that field and add the following at its beginning:

env WINGXDIR="c:\wingx" env CHECKDEF="c:\wingx\files\check.dat" env PGFONT="c:\wingx\files\grfont.dat"


5) Finally, all you have to do is copy the license .txt file to the wingx directory, which is found at:



Now, when you first click on your launcher, WinGX will do a search of the executables and then start by asking you the location of your project folder.


You're good to go!


NB: As version 1.80 comes without several executables (e.g. shelx), you will need to unzip the respective files in the wingx/bin directory. Remember that the c:\wingx\bin directory is now to be found at /home/user/.wine/drive_c/wingx. Respectively, all the subdirectories are to be found in that tree.


WinGX 1.80.05 on Ubuntu 10.04


Same as above with special effects (rotating cube plus 3D windows). The dome image behind is the inside of the ESRF synchrotron storage-ring at Grenoble.


Mercury (native Linux version)


Download the latest version of Mercury from the download page (currently this is 2.3, available here). For the installation follow the instructions on the download page.


Launcher creation

After installing, you'll notice that there is no desktop or panel icon to launch Mercury. Of course, you can always launch it from the command-line (using the command /usr/bin/mercury2.3/mercury_2.3/bin/mercury), or using Alt-F2 to give that command. However this is not very handy. To simplify things, you can add an application launcher to your panel:


1) Right-click your panel and select "Add to panel..."->"Custom Application Launcher"->"Add"

In the "Name" and "Description" fields enter what you wish, and in the "Command" field enter the path to the mercury executable (e.g. in my installation: /usr/bin/mercury2.3/mercury_2.3/bin/mercury). Click "OK". You now have a Mercury launcher on your panel.


2) To spruce it up a little, you can add the Mercury icon instead of the generic launcher icon. I took the Mercury ("Hg") icon from a previous Mercury installation and you can retrieve it from here. Either during the creation of the launcher, click on the icon on the left and enter the path to your custom icon file. Click "OK" and now you have Mercury on your desktop!



Display problems

For problems related to your graphics card, or the GCC library, please start by reading the CCDC FAQ. Here, I address some additional problems I had with the display of Mercury.


a) The Mercury window appears semi-transparent.

Adding the -mesa argument (as suggested by the FAQ) did not fix the problem, even when special effects were disabled.

The solution was to edit the the script by adding the line
somewhere before the end.

(In my installation this is in /usr/bin/mercury2.3/mercury_2.3/bin/


b) The GUI buttons have very large fonts

This greatly reduces the area available for structure viewing. This can easily be solved by editing the script, and choosing the appropriate font you prefer. Actually, this gives you the opportunity to fine-tune the display to your preferences.


Display problems in Mercury


The solution is to use a '-font' argument when starting, eg:

mercury -font -adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1
(this one gave me the nicest results)


However if that font is not on your system, or if you simply you do not like it, you can list your system fonts with the command 'xlsfonts' from a shell, or you can try to build up the font string piece-by-piece with the command 'xfontsel', also from ashell.


Ultimately, the font string may be added to the last line of the script that launches Mercury, to make the change permanent. If you like you can download my modified script here and use it to replace the original, or use it as an example (be sure to back up the original first!).

*Special thanks to Dave Bardwell from the CCDC Support for providing these solutions. I simply reproduce them here.

**These issues have been now picked up by the CCDC team and have been added to the FAQ's for Mercury and Hermes.

Using the modified script: native GNU/Linux Mercury (left) and Windows version under Wine (right).


Same as above, viewed with cube rotation.



EDIT (24/8/2011) - Mercury 2.4 and 2.4.5:


The 2.4 version of Mercury has had the transparency problem resolved out of the box, so kudos to the developers. As for the issue of font size, these were quite large both in 2.4 and 2.4.5 versions. This was easily resolved by simply replacing the file with the one given above.


Mercury 2.4. fresh install


Mercury 2.4.5 fresh install


Mercury 2.4.5 with the new file


  Mercury (Windows version with Wine)  
  Installation works quite flawlessly (using winefile and running the installer binary as mentioned above).  
  Diamond 3  

Diamond is a structure viewing program, that also comes only as a Windows application. Its installation using Wine proceeds very smoothly and at the end you have it installed and working (even the online update works).


Rendering issues

When rendering is not used, I have had absolutely no trouble with Diamond. However, when rendering is used, I have observed the following:


-Some .diamdoc files I had previously created on Windows turn out all black. However, when I turn rendering off, everything shows just fine (of course without photorealism). On the other hand, other .diamdoc files previously prepared on Windows show perfect.


-When I create new .diamdoc files from a .cif dataset, sometimes everything turns out perfect. However, in some instances I had to turn rendering/lighting off and then back on before it worked.


-A .dsf file (previously created with Diamond 2) using rendering, shows just fine. A .diamdoc file directly created from that file (saving it as .diamdoc with Diamond 3) exhibits the same rendering issue.


File location issues

My entire "/home/thanasis" directory structure shows up correctly under the "Open" dialog box browser, but no files are visible in any of the directories. However, selecting the directory "/home/thanasis/.wine/drive_c/users/thanasis/My Documents" shows the entire "/home/thanasis" directory structure correctly, including all files inside them(!)


I do not know why these issues arise. I had not seen them on another installation I had done, on a desktop running Ubuntu 9.04 (but then I hadn't taken so much care). So it may either be the distro, or my laptop. It may be quite probable that on other machines all may work flawlessly. I'd be happy to hear other people's experience and probable workarounds.


All in all, Diamond 3 is perfectly usable on Ubuntu under Wine, despite being a bit buggy. Hopefully these issues will be remedied in the future.



Three .diamdoc files open in diamond. Left: rendering creating an all-black picture. Center: turning off rendering giving the picture without photorealism. Right: another file showing just fine with rendering on.


Same as above with special effects.


  Remotely accessing the Cambridge CSD  

GNU/Linux OS's offer the highest security and speed for server deployments. For that reason they are the No 1 choice for server applications (more than 70% of web servers and more than 90% of the top 500 supercomputers use some GNU/Linux distribution). The CCDC offers a Linux version of its CSD database, which is extremely easy to access remotely from a GNU/Linux machine, assuming the CSD server also has an ssh server installed.


1) On a shell, type:


ssh -X -l user


ssh -X


where is the server's IP address,

user is the name of your user account on that server


and the command "ssh" starts a secure shell.


The flag "-X" instructs ssh to start the X-server environment and the flag "-l user" instructs ssh to login under "user".


2) After giving the password you are logged in

3) In the shell, you can start each application by its appropriate command.


That's it!





Top of Page