Install
=======

KMFR was originally written in Fortran targeting the Compaq Visual Fortran
compiler for Windows and relied on some of its non-standard extensions. Since
the CVF was last released in 1999 and is no longer supported, in 2019 the model
was ported to pure Fortran 2003. Testing has been performed using GFortran 8
and 9 but any recent compiler should work.

System requirements
===================

* Fortran 2003 compiler. GCC gfortran 8 & 9 tested.

A Unix-like operating system. KMFR has minor dependencies on Unix conventions
such as directory path syntax and shell escape commands. Mac OS X and GNU/Linux
are known to work.

CERNLIB, a once-widespread mathematical library. Specifically, the MATHLIB and
KERNLIB parts of it are used. On Debian-based Linux distributions (including
Ubuntu) it is enough to install the cernlib package:

    # apt-get install cernlib

Unfortunately, Red Hat family of distributions (CentOS, Fedora, Scientific
Linux) stopped supporting CERNLIB packages. Generic instructions on how to
install CERNLIB on any GNU/Linux can be fond on the DESY website.

On Mac OS X CERNLIB can be conveniently installed using the Fink package
manager by executing a shell command

    $ sudo apt-get install cernlib2006-dev 

Build instructions
==================

1. Uncompress the distribution file and cd to the kmfr-VERSION directory.
2. On Linux execute the command

    $ make -f makefile.linux

3. On Mac OS X execute the command

    $ make -f makefile.mac

Note: certain edits to the makefile might be necessary to set up paths to the
Fortran compiler and libraries. 

Usage
=====

Configuration parameters of the model are specified in a text configuration
file using the Fortran namelist format. A sample configuration file with
comments is provided (sample-kmfr.cfg). Refer to it for user-modifiable
settings.

The calculation is started by running either

$ /path/to/kmfr sample-kmfr.cfg

or

$ /path/to/kmfr < sample-kmfr.cfg

Calculation results can be found in the automatically created output directory.

Calculated cross sections can be found in the sct1.dat, sct2.dat,... files,
where the numeric index corresponds to the reaction code in the text file key.
For each reaction this file lists, respectively, the reaction code, its
integrated cross section, threshold, and the number of emitted neutrons and
protons. All energy values are specified in [MeV] and cross sections in [mb]
units. 
