lundi 26 décembre 2011

Tutorial - installing the Cowan Fortran program on Mac OS X

I recently became interested in computing X-ray spectras from first principles. A huge challenge.
There are a whole lot of methods to do that, but one of the most popular is based on the Cowan's classic book "The Theory of Atomic Structure and Spectra".
Since the first edition, back in '81, he developped a FORTRAN 77 code that was able to compute, among others, atomic multiplets. The code was enormously developped since then, and the last version by the author is hopefully still available in full on Cormac McGuiness website (here).
I am just starting with it. And the first challenge was to get it installed on mac, and this is what I will try to explain here.

Most of the problems come from the fact that this bundle of programs is very old, and you will run into some dependency issues - luckily, nothing too funny here. As a foreword, you can use MacPorts to grab most of your software packages on-line, but these are not included in.

First, you need a FORTRAN 77 compiler. As mentioned by McGuiness, g77 is no longer available on modern Linux distributions, and gfortran (included in gcc) will not compile the code. However, Gaurav Khanna from UMass Dartmouth is maintaining a  set of g77 binaries (here) which are working perfectly so far.

Second, you will need a working LaTeX distribution as the documentation has to be compiled from tex sources. You can port TeXLive, but the (huge) bundle Mactex is user-friendly and well maintained. However, you will need also to use the package latex2html, which is not part of the Mactex packages. Mild Opinion did a mini-tutorial for that, so just follow its instructions - and don't forget to deal with the required dependencies!

Once you've done that, download the full package of Cowan's program on Cormac's website (here). Then, in a terminal:
- "tar zxvf CowanCode.tgz" and go to the uncompressed repertory
- edit "Makefile": change DISTDIR to where you want the program to be installed.
- go to the Code directory, edit "Makefile": erase the line "FC=ifort" and change DISTDIR
- go to the main directory, "make" and "make install"

The compilation is running fine, including the documentation (I should store the html file online...), but I did not tested the binaries yet.

Aucun commentaire:

Enregistrer un commentaire