Wednesday, 23 June 2010

Visualising orbitals and density with Molekel

Molekel is an open-source 3D molecular visualisation package for analysing the results of computational chemistry packages. It has been developed at the Swiss National Supercomputing Centre by Ugo Varetto (et al.?). Unlike Avogadro, it does not have facilities for setting up calculations or building structures; however, at least for what I want to do, it has the edge in visualising orbitals and density. So, my curent workflow is to set up Gaussian calculations with Avogadro, and then analyse them with Molekel.

One interesting aspect of Molekel is that the electron density (and orbitals, etc.) are calculated on the fly by Molekel rather than extracted from a cube file. This makes the program much more capable and completely avoids the need for cube files. On the other hand, it is not possible to save the volumetric information generated by Molekel, so there is no way to sanity check the accuracy against a Gaussian cube (e.g. by subtracting them with cubman, and then visualising the results).

It took me a little while to figure out a workflow for using Molekel successfully on Windows with Gaussian 09 log files from a Linux server. Here's how it goes:

  1. Run a single point calculation with POP=(FULL, ESP) and GFOLDPRINT. I also use IOP(3/36=-1) to reduce the file size. The current release of Molekel will not be able to colour surfaces with the electrostatic potential unless the ESP option is specified (this information is courtesy of src/old/readgauss.cpp around line 1043).
  2. Convert the log file to Gaussian03 format using the bash script available here. (I hope they will fix this in the next version of Molekel.)
  3. Convert to dos format with unix2dos. If you don't do this, you will get a segfault from Molekel after opening the file. (They should fix this.)
  4. scp the file over to your Windows machine. (It would be nice to be able to open the file directly on the server using ssh; maybe this is planned for the future?)
  5. Start Molekel, File, Open, Choose "G03", then the filename and "Open". If you don't choose G03 and instead use "All files", it will fail horribly.
  6. Under Display, 3D View Properties, change Samples to "10" to add reasonable anti-aliasing. This also affects images saved to disk so it's worth doing as the difference is quite noticeable.
  7. Also under Display, Set Background to white, and turn off the bounding box and the axes. (There is a bug if you leave the axes on and choose scaling > 1 when saving an image - the axes are repeated several times.)

In practice, I carried out steps (2) and (3) using Cygwin on Windows, but it would be easier to do this on the Linux server. (As a side issue, I note that only the File, Edit, Interaction and Help menu are accessible through keyboard shortcuts - hopefully this will be fixed in a future release.)

To actually draw the orbitals and so forth you go to Surfaces/Electron Density, but see the video tutorials on the Molekel website for more information. One thing that might save you some time is to generate all of the orbital isosurfaces you want first, and then go to File/Save Orbital Pictures and choose a folder - this automatically saves all of the orbital images one after the other with sensible names.

As a final point, if you have a better graphics card than I do, you will be able to apply some really impressive shading effects using the GLSL shaders under Display/Shaders. Again see the video tutorials on the Molekel website for a demo.


Karol said...

Concerning opening files on remote servers via ssh, you can do that independently of Molekel using sshfs. So, if you have a sshfs mount point, you can open the file as if it where local.

-oh said...

Have you had a need to plot spin densities with Molekel? I'm on a mac, and I can't find the "button" in 5.4 but according to 4.3 manuals spin density was one of the volume plotting options. An e-mail to unfortunately has gone unanswered.

baoilleach said...

I think that Molekel 5.x was a complete rewrite of the code, so some features were never reimplemented. Perhaps you could see whether an older version of Molekel is available somewhere. Funding for Molekel development seems to have dried up (which is a shame). But remember that it's open source, so you can always geek out and implement it yourself (or get funding for a comp sci summer student).

Dai Q. Ho said...

Dear you! Please show me how to generate a cube file from Gaussian 03 calculation for using Grid Data... on Molekel program? Thank you so much in Advance!

Anonymous said...

Why using a Windows desktop? Seems to be silly once powerful Linux graphical interfaces became available. Nearly the same applies to Mac: why paying for Darwin when Linux is so much more powerful? Cheers, chiendarret

baoilleach said...

I also use Linux, but the main reason I'm interested in having a free QM system for carrying out and analysing calculations is for teaching and the computer suites available to me are all Windows based.

Anonymous said...

thanks for this. was so helpful!!!

Fang Wang said...

Thanks a lot for your post. I wonder how to convert the Gaussian09 log file to Gaussian03 format. The link is not working now. Thanks.

Li Junfu said...

Thanks a lot for your post. I wonder how to convert the WebMO Raw Output to Gaussian03 format. The link is not working now. Thanks.

Jacob Martin said...

The link to the converter from G09 to G03 is now at this link

Albert said...

Thanks for your post. It helped me a lot!

Mari-Liis Ludvig said...

Did my calculation with g03, used keywords POP=(FULL, ESP) and GFOLDPRINT. Tried to open the lof file with molekel, and it chrashed, no explanation, only core dumped, segmentation violation. Have you got any good ideas why?