Installing hammurabi linked with Galprop:
Start with the basic build
This process is slightly more complicated because of the inter-dependencies of the two codes. The modified version of Galprop depends on the hammurabi magnetic field module, while the hammurabi integration then clearly depends on the resulting Galprop CRE module. Make sure the simple hammurabi compilation works and runs first.
Get the version of Galprop included on the hammurabi site
which is a modified version of the Galprop found on https://sourceforge.net/projects/galprop. Specifically, it was taken from the tar file of revision 2766 of that repository. (Note that this differs slightly from the version on http://galprop.stanford.edu. I also tested with their version 54.1.984.)
The compilation is a bit sensitive to compiler versions, and you may have to experiment with changing the orders of some of the flags. What is included in this release is what worked for gcc 4.4.7 on Linux or gcc 4.3.6 on OSX.
1) In addition to the hammurabi dependencies needed for the basic install, install CCfits and CLHEP. (This version is tested with CCfits-2.2 and CLHEP 2.0.4.5.) Note that these dependencies should be built with the same compilers you will use for Galprop and hammurabi.
2) In the hammurabi directory, build the library that will be needed by Galprop:
make clean; make libhamprop.a
3) Expand (e.g., gunzip) the customized Galprop package in a separate directory. Then in the Galprop directory, compile Galprop itself. First, set the environment needed by its autoconfigure script. E.g.,
setenv CC "gcc-mp-4.3 -m64"
setenv CXX "g++-mp-4.3 -m64"
setenv F77 gfortran-mp-4.3
setenv FC gfortran-mp-4.3
setenv CPP cpp-mp-4.3
setenv CXXCPP cpp-mp-4.3
Now following the Galprop instructions with a few modifications:
4) autoreconf -i -v -f
5) Edit the source/Makefile.am to set the path to hammurabi and fftw on lines 11 and 14.
6) After changing this for the correct paths to cfitsio, CCfits, HEALPix, GSL, and CLHEP (for each dependency, the given directory should contain the lib and include subdirectories), then configure:
./configure --with-cfitsio=${HOME}/space/sw/cfitsio/cfitsio/build --with-ccfits=${HOME}/space/sw/CCfits/CCfits/build --with-healpix=${HEALPIX_CXX}/${HEALPIX_TARGET} --with-gsl=${HOME}/space/sw/gsl/gsl-1.13/build/ --with-clhep=${HOME}/space/sw/clhep/2.0.4.5/CLHEP/build/ --prefix=${PWD}/build --with-galdef=./GALDEF/ --with-fitsdata=${PWD}/FITS/ --enable-openmp
7) and then build Galprop:
make
and if that succeeds, then
make install
which just copies things to the build area.
At the end of the make step, the linking of the galprop executable itself often fails because the flags aren't all set correctly, or because the order can be important on some compilers. If the libraries are built correctly (source/libgalprop.a and source/libskymap.a) but the linking fails, you will not have a galprop executable, but hammurabi should build fine anyway. So if you have the files source/libgalprop.a and source/libskymap.a, that is all you really need for hammurabi. They are installed in build/lib/ if the compilation goes all the way to the end, but you can copy them by hand if not. Just make sure the hammurabi Makefile points to the directory containing them.
(I've often had odd problems trying to link the galprop executable, with errors related to the openMP functions. On OSX, adding -lgcc_eh to the link line seems to fix it. Then run 'make' again to finish and then 'make install'.)
8) Then, go back to the hammurabi directory and first clean then build the hammurabi.galprop executable:
make clean ; make hammurabi.galprop
(The clean step is important! The flags are different for libhamprop.a and hammurabi.galprop.)
9) For running these, update the path for searching for dynamically loaded libraries so that CLHEP and CCfits are found. For csh/tcsh following needs to go into the .cshrc or .tcshrc sourced at the opening of the session:
On OSX :
setenv DYLD_LIBRARY_PATH "/path/to/clhep/build/lib/:/path/to/CCfits/build/lib/"
while on Linux, it's
setenv LD_LIBRARY_PATH "/path/to/clhep/build/lib/:/path/to/CCfits/build/lib/"
For bash, it's
export LD_LIBRARY_PATH="/paths..."
etc.