While at MIT last year on sabbatical, I was introduced to AIM calculations. The exact nature of the chemical bond is highly controversial and always has attracted debate and interest, as highlighted recently in Nature in the article “Beyond the bond“. AIM stands for Atoms in Molecules, an approach developed by Richard Bader at MacMaster university, and is another way of approaching an understanding of what we call a ‘bond’ that has seemed surprisingly effective. I had heard of this approach before and had been intrigued, but not found the time to explore any further. Thus, on sabbatical, I was blessed with some time to try out AIM, and, even better, an enthusiastic graduate student who had been learning about AIM and was happy to tell me everything he knew. He lent me his book “Atoms in Molecules: An Introduction“, by Paul Popelier at Manchester, which I can highly recommend as presenting a clear and readable guide to starting out with AIM. (I’d met Paul once to discuss Ionic liquids (an area of our research) and he was immensely helpful and nice, another reason to recommend this book :)
One of the programmes used for AIM analysis at MIT is XAim. It is linux-based and produces nice diagrams that can describe key features of the wave-function from Gaussian and ADF wfn outputs, such as the electronic density rho and the laplacian of the density. These features are used to interpret ‘bonding’ characteristics in a molecule and can provide surprising results, relative to what may be expected from classical valence bond theory. Wfn output files are generated in Gaussian using the output=wfn keyword in the route card (the part that starts with # and defines the parameters of the calculation), along with a filename for the wfn file at the end of the geometry description, separated by a single line. A fuller description is available on Gaussian’s website.
However, arriving back in the UK meant getting my own copy of Xaim. Xaim is available only as binaries and unfortunately, on Ubuntu 10 I soon discovered it wasn’t working with the error:
/usr/local/XAIM/bin/Xaim: No such file or directory.
This was a rather obscure error, since it didn’t really hint at which file or directory was missing and the program had been properly installed with the correct permissions. Online searching also got me nowhere, except to realise a couple of other people had had the same issue. I had a sneaking suspicion that it might be to do with libraries, but where to start?
Well, since it was a boring sunday afternoon and I was procrastinating on a number of other projects (ok, I was running stuff in the background), I finally got around to sorting this out. It took me about 4 hours of trawling through usegroups, so hopefully these instructions are useful to someone to save them a stack of time:
First thing I tried was to look for the missing libraries using ldd. Unfortunately ldd gave me the following error:
$ ldd Xaim
not a dynamic executable
I solved this from the following forum post: http://ubuntuforums.org/archive/index.php/t-1041476.html by downloading the ia32 libraries:
sudo apt-get install ia32-libs
Running XAim again now gave the following error:
./Xaim: error while loading shared libraries: libXm.so.3: cannot open shared object file: No such file or directory
with ldd of Xaim now working and affording the following response:
$ ldd Xaim
linux-gate.so.1 => (0xf77bb000)
libm.so.6 => /lib32/libm.so.6 (0xf777a000)
libXm.so.3 => not found
libXt.so.6 => /usr/lib32/libXt.so.6 (0xf7726000)
libX11.so.6 => /usr/lib32/libX11.so.6 (0xf7609000)
libc.so.6 => /lib32/libc.so.6 (0xf74af000)
libSM.so.6 => /usr/lib32/libSM.so.6 (0xf74a6000)
libICE.so.6 => /usr/lib32/libICE.so.6 (0xf748c000)
libxcb.so.1 => /usr/lib32/libxcb.so.1 (0xf7472000)
libdl.so.2 => /lib32/libdl.so.2 (0xf746e000)
libuuid.so.1 => /lib32/libuuid.so.1 (0xf7469000)
libXau.so.6 => /usr/lib32/libXau.so.6 (0xf7465000)
libXdmcp.so.6 => /usr/lib32/libXdmcp.so.6 (0xf745e000)
A forum post at http://ubuntuforums.org/showthread.php?t=39556 suggested that libmotif3 needed to be installed. I tried this:
sudo apt-get install libmotif3
but still got the same ldd response, even though /usr/lib/libXm.so.3 was now present. Linking it to /lib32 or /usr/lib32 also did not help, the reason being that it was a 64-bit library.
$ ldconfig -p |grep -i libXm.so.3
libXm.so.3 (libc6,x86-64) => /usr/lib/libXm.so.3
./Xaim: error while loading shared libraries: libXm.so.3: wrong ELF class: ELFCLASS64
This therefore required a manual install of the 32 bit libraries to override. These were downloaded from ftp://ftp.uni-hannover.de/pub/mirror/linux/ubuntu/pool/multiverse/o/openmotif/libmotif3_2.2.3-2_i386.deb
and installed using:
sudo dpkg -i –force-architecture libmotif3_2.2.3-2_i386.deb
(which gave a number of warnings).
[edit: a better method for installing the 32-bit library is as follows:
sudo dpkg -X libmotif3_2.2.3-2_i386.deb libmotif
sudo cp libXm.so.3.0.2 /usr/lib32/
sudo ln -s libXm.so.3.0.2 libXm.so.3
this installs the correct library in the correct place and stops ubuntu automatically upgrading you to the 64-bit version, then rendering Xaim unworkable again.]
ldconfig now told me that all the locations were the correct 32bit architecture:
$ ldconfig -p |grep -i libXm.so.3
libXm.so.3 (libc6) => /lib32/libXm.so.3
libXm.so.3 (libc6) => /usr/lib/libXm.so.3
libXm.so.3 (libc6) => /usr/lib32/libXm.so.3
Although ld was now giving issues:
$ ld /usr/local/XAIM/bin/Xaim
ld: i386 architecture of input file `/usr/local/XAIM/bin/Xaim’ is incompatible with i386:x86-64 output
but now running Xaim worked (provided it was run through X by first invoking xhost + and then using ssh -X option). Hurrah!
So hopefully you can look forward to some lovely maps produced by XAim in our future papers.