Monday, December 5, 2011

How to run MOPAC6 on a modern Linux machine

Ahum, so we were trying to test the differences between AM1 and PM3 in GAMESS and MOPAC2009 and surprisingly we found a not insignificant difference in the total energies. The energies are shifted by a constant factor of roughly ~1.000014.

However, going back to the MOPAC manual (http://openmopac.net/manual/fun_con.html) we see that the implementation of physical constants were changed in 1993. The GAMESS implementation of semi-empirical methods is basically the MOPAC6 Fock-formation code with some GAMESS routines to diagonalize the whole shebang (for at least as far as single-point energies goes - I haven't been looking at derivatives yet).

Most likely this difference is due to conversion factors between kcal/mol (what MOPAC will give you) and hartrees (GAMESS). For instance, this table I randomly found on the Internet, which is "taken from and old book by Karplus and Porter", says that 1 Hartree = 27.2107 eV, while Jimmy Stewart (Mr. MOPAC) says it's more like 27.2113961 eV. I guess the hartree must recently have been increased in energy along with the speed of light and neutrinos ...

Anyways, I wanted to go back and try MOPAC6 and see if the problem was in the code there. Compiling the MOPAC6 source code, however, proved very difficult, since the source syntax in certain places is not compatible with a newer gfortran, and not even my fall-back f77 compiler would eat it. However, Intel's trusty old Ifort compiler was willing to eat MOPAC6 code, albeit with a couple of warnings. 
However, then the second problem arised. The Makefile was seemingly buggy and refused to work out-of-the-box on my Ubuntu 10.10 machine. So I decided to make a Makefile that would actually run. The script can be found at the bottom of this page, and compiles like a charm, if you have Ifort. Ifort is free for non-commercial use, and usually also quite a bit faster than gfortran.

However, a possibly more simple (and possibly more fun) option is to install Wine (a Windows compatible environment for Linux) and use Wine to execute Mopac. Jimmy Stewart has a Windows compatible binary version of MOPAC6 available for download. Now, lemme show you how to install Wine and fire up MOPAC! On Ubuntu this is as simple as (let's say you have a file named methan.mop):


$ sudo apt-get install wine   # This installs WINE

$ wine mopac6.exe methan      # This runs MOPAC6 via wine with methan.mop


And that's it! Either get Ifort (free for non-commercial use) or use Wine to run MOPAC6 via the binary. I honestly found the last method to be hilarious, but I guess I'm not too different from the guy below.


The newest MOPAC and GAMESS are available for free for personal and academic use.

UPDATE: Just a short note on how to run the compiled version of MOPAC6. First, rename mopac.exe to MOPAC. Next, set the mopac directory in mopac.csh. Now open a cshell and use the mopac.csh script to envoke MOPAC6:

$ csh                     # Start a cshell
% source mopac.csh        # A script necessary to run MOPAC6
% mopac methan            # To actually run MOPAC6 with the file methan.mop


$ indicates bash shell, and % indicates a cshell.


MOPAC6 Makefile for Intel Ifort: (put it in the source code directory and type 'make')

6 comments:

  1. wait... you want to look at the source code but end up using the windows executable through wine?

    http://troll.me/images/idiot-gaston/what-is-this-sorcery-thumb.jpg

    ReplyDelete
  2. You'll be the star of Jersey Shore for sure. I suggest "The Compilation", as Mr MOPAC is already taken.

    It'll be interesting so see how this version agrees with GAMESS. Maybe Stewart a lady changed the constants in this version?

    ReplyDelete
  3. What exactly IS the agenda of the present post? :)

    ReplyDelete
  4. That should have been "already". Nice going iPad

    ReplyDelete
  5. @Jan: Mrs Mopac, Jan? :-)

    @Anders: Please tell me that when run under Wine it was slower. :-)

    ReplyDelete
  6. Mrs Mopac?! I don't know if I'm ready to "commit" ;)

    ReplyDelete