Manual Installation¶
Compiling the Code¶
Fortran Compiler¶
The ProDiMo code is written in Fortran 90/95, so you need a Fortran compiler. The code is tested with the GNU Fortran compiler gfortran and the Intel Fortran compiler ifx. We recommend using a recent version of the compiler, at least gfortran version 10 or ifx version 2023 (not available for MAC OS X).
On a Linux system gcc/gfortran is usually already available, if not it can be installed with the package manager of your distribution. Also the ifx compiler is available via some linux package managers or with the conda package manager (for details see download ifx).
To test if the compiler is available and what version you have type in a terminal
gfortran --version
or
ifx --version
If you get an error message, the compiler is not installed or not in your PATH. If you get a version number, you can continue with the next steps.
On Mac OS X, we recommend using a package manager like homebrew or macports to install the gfortran compiler. If you use Python, conda is also a good and easy to use option to install gcc/gfortran.
For example, with homebrew you can install it with (see https://formulae.brew.sh/formula/gcc#default):
brew install gcc
Installing cfitsio¶
ProDiMo requires the cfitsio library (version >=4.2) to read and write FITS files. The library can be downloaded from the cfitsio website. But first try if the library is available via above mentioned package managers.
If you want or need to compile it yourself see the the cfitsio webpage in particular
Optional: Installing xraylib¶
This step is optional, and only required if you want to use the X-ray Radiative Transfer. If you don't know yet skip this step for now as it can also be done later.
The xraylib library is used to calculate X-ray scattering cross-sections that are required for the X-ray RT. The xraylib documentation has detailed installation instructions for various systems. On Max OS X, the easiest and recommended way is to use homebrew, for linux systems one can install the xraylib with the conda package manager.
Adapting the makefile¶
In the ProDiMo source code directory src_develop (within your cloned ProDiMo repository) you will find several makefiles (e.g. makefile.gfortran, makefile.ifx or makefile.prodimo). Choose one of those depending on your compiler and copy it to makefile e.g (within src_develop):
cp makefile.gfortran makefile
Now we need to adapt the makefile to your system. Open the file makefile in a text editor and check the following lines:
#----------------------------------------------------------
# location of cfitsio-library
# Adapt the path if necessary
FITS = -L/usr/local/lib -lcfitsio
Depending on your system the path (/usr/local/lib) has to be adapted to the location where the cfitsio library is installed. If you installed it via a package manager, it is usually in /usr/local/lib or /usr/lib. If you compiled it yourself, it might be in a different directory, so adjust the path accordingly.
No further changes should be necessary in the makefile for the standard compilation. If your compiler is not in the PATH of your system (e.g. if you cannot simply call it in a terminal by typing gfortran or ifx), you need to adapt the F90 and FLINK variable in the makefile to point to the full path of your compiler executable.
To include it in the compilation for ProDiMo, adaptations for the makefile are necessary. The provided makefiles already include the necessary changes, but they need to be activated and the path to the library has to be adapted to your system.
Optional: xraylib library¶
If you already installed the xraylib library, the following changes in the makefile are required, otherwise you can skip this section
# Uncomment the following lines and set the path accordingly
# /some/path/ needs to be replaced with the actual path.
XRAYLIB_INC=-I/some/path/include/xraylib
XRAYLIB=-L/some/path/lib -lxrlf03 -lxrl
Further down in the makefile, a compiler flag needs to be set to activate the xraylib in ProDiMo:
# Activate xraylib by setting the compiler directive -DXRAYLIB
DEFS = -cpp -DXRAYLIB
Compilation¶
Now you can compile the ProDiMo code. In the src_develop directory, simply type:
make
This will compile the ProDiMo code and create the executable prodimo in the same directory. If everything goes well, you should see no error messages during the compilation process (there might be some warning though).
To test if the compilation was successful type:
./prodimo
within the src_develop directory. If the compilation was successful, you should see a header with some information about the ProDiMo version and an error message saying "no input file was found". That is okay, it means the code is compiled and ready to use, we just need proper input files.
If you need to recompile the code (e.g. after an update) it is best to use:
make realclean
make
The first statement removes all object files and executables are removed, and ensures a clean compilation. The second statement compiles the code again.
OS environment¶
Before you can run ProDiMo, a couple of environment variables need to be set. Those settings are useful for e.g. running ProDiMo from any directory, among other things. If you used conda to install ProDiMo setting OS environment variables should not be necessary.
We recommend to add the following settings to your shell environment by editing your login profile. Copy the code below (for your shell) to your login profile and adapt the paths (i.e. replace things like path_to_ProDiMo, the root directory of your ProDiMo source installation).
The number of threads depends on your needs an the machine you are using. Information on what would be your best choice are explained in Accelerate ProDiMo.
For bash edit .bashrc, .bash_profile, .profile, for zsh edit .zshrc,.zprofile
# If you use openmp (recommended) 6 is the number of threads you assign to a openmp program (e.g. ProDiMo)
# adapt to your needs
export OMP_NUM_THREADS=6
# Add your ProDiMo executable to you path so you can call it from everywhere
export PATH="$PATH:path_to_ProDiMo/src_develop/"
# these settings are recommended
export OMP_STACKSIZE=4G
export GOMP_STACKSIZE=4G
ulimit -s unlimited
# As cfitsio is usually installed as a shared libary, you need to set the library path if cfitsio is not
# installed in a standard lib directory (e.g. /usr/lib or /usr/local/lib). If it is you can skip this entry.
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/path_to_cfitsio/cfitsio/lib"
# Only required for IDL, that should be enough to run prodimo.pro
export IDL_PATH="<IDL_DEFAULT>:path_to_ProDiMo/idl:path_to_ProDiMo/idl/AstronomyLibrary/pro:path_to_ProDiMo/idl/AstronomyLibrary/lib"
Same configuration but a different syntax and a different files to edit e.g. .cshrc or .tcshrc
# If you use openmp (recommended) 6 is the number of threads you assign to a openmp program (e.g. ProDiMo)
# adapt to your needs
setenv OMP_NUM_THREADS 6
setenv PATH $PATH\:/path_to_ProDiMo/src_develop/
# these settings are recommended if you run big models.
setenv OMP_STACKSIZE 4G
setenv GOMP_STACKSIZE 4G
limit stacksize unlimited
# As cfitsio is usually installed as a shared libary, you need to set the library path if cfitsio is not
# installed in a standard lib directory (e.g. /usr/lib or /usr/local/lib). If it is you can skip this entry.
setenv LD_LIBRARY_PATH $LD_LIBRARY_PATH\:/path_to_cfitsio/cfitsio/lib/
# Only required for IDL, that should be enough to run prodimo.pro
setenv IDL_PATH "<IDL_DEFAULT>:path_to_ProDiMo/idl:path_to_ProDiMo/idl/AstronomyLibrary/pro:path_to_ProDiMo/idl/AstronomyLibrary/lib"
Those kinds of settings should be enough for most systems and installations. The memory stacksize is the most important setting. Try to increase the value to >4G if you encounter the runtime error message
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.