IAP GITLAB

Skip to content
Snippets Groups Projects
README.md 6.88 KiB
Newer Older
ralfulrich's avatar
ralfulrich committed
# CORSIKA 8 Framework for Particle Cascades in Astroparticle Physics 
Ralf Ulrich's avatar
Ralf Ulrich committed

ralfulrich's avatar
ralfulrich committed
The purpose of CORSIKA is to simulate any particle cascades in
astroparticle physics or astrophysical context. A lot of emphasis is
put on modularity, flexibility, completeness, validation and
correctness. To boost computational efficiency different techniques
are provided, like thinning or cascade equations. The aim is that
CORSIKA remains the most comprehensive framework for simulating
particle cascades with stochastic and continuous processes.
Ralf Ulrich's avatar
Ralf Ulrich committed

The software makes extensive use of static design patterns and
compiler optimization. Thus, the most fundamental configuration
decision of the user must be performed at compile time. At run time
ralfulrich's avatar
ralfulrich committed
model parameters can still be changed.
Ralf Ulrich's avatar
Ralf Ulrich committed

ralfulrich's avatar
ralfulrich committed
CORSIKA 8 is by default released under the GPLv3 license. See [license
ralfulrich's avatar
ralfulrich committed
file](https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/blob/master/LICENSE)
ralfulrich's avatar
ralfulrich committed
which is part of every release and the source code.

If you use, or want to refer to, CORSIKA 8 please cite ["Towards a Next
ralfulrich's avatar
ralfulrich committed
Generation of CORSIKA: A Framework for the Simulation of Particle
Cascades in Astroparticle Physics", Comput.Softw.Big Sci. 3 (2019)
2](https://doi.org/10.1007/s41781-018-0013-0). We kindly ask (and
ralfulrich's avatar
ralfulrich committed
require) any relevant improvement or addition to be offered or
contributed to the main CORSIKA 8 repository for the benefit of the
ralfulrich's avatar
ralfulrich committed
whole community.

When you plan to contribute to CORSIKA 8 check the guidelines outlined here:
ralfulrich's avatar
ralfulrich committed
[coding
ralfulrich's avatar
ralfulrich committed
guidelines](https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/blob/master/CONTRIBUTING.md). Code
ralfulrich's avatar
ralfulrich committed
that fails the review by the CORSIKA author group must be improved
before it can be merged in the official code base. After your code has
ralfulrich's avatar
ralfulrich committed
been accepted and merged, you become a contributor of the CORSIKA 8
ralfulrich's avatar
ralfulrich committed
project (code author). 
ralfulrich's avatar
ralfulrich committed

IMPORTANT: Before you contribute, you need to read and agree to the
[collaboration
ralfulrich's avatar
ralfulrich committed
agreement](https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/blob/master/COLLABORATION_AGREEMENT.md). The agreement can be discussed, and eventually improved.
ralfulrich's avatar
ralfulrich committed

We also want to point you to the [MCnet
ralfulrich's avatar
ralfulrich committed
guidelines](https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/blob/master/MCNET_GUIDELINES), which are very useful also for us.
ralfulrich's avatar
ralfulrich committed


## Get in contact
Nikos Karastathis's avatar
Nikos Karastathis committed
  * Connect to https://gitlab.iap.kit.edu register yourself and join the "Air Shower Physics" group. Write to one of the steering comittee members (https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/-/wikis/Steering-Committee) in case there are problems with that. 
ralfulrich's avatar
ralfulrich committed
  * Connect to corsika-devel@lists.kit.edu (self-register at
    https://www.lists.kit.edu/sympa/subscribe/corsika-devel) to get in
ralfulrich's avatar
ralfulrich committed
    touch with the project.
    
  * Register on the corsika slack channel: https://corsika.slack.com
ralfulrich's avatar
ralfulrich committed
## Installation
Ralf Ulrich's avatar
Ralf Ulrich committed

CORSIKA 8 is tested regularly at least on `gcc11.0.0` and `clang-14.0.0`. 
ralfulrich's avatar
ralfulrich committed
### Prerequisites

You will also need:

- Python 3 (supported versions are Python >= 3.6), with pip
- conan (via pip)
ralfulrich's avatar
ralfulrich committed
- g++, gfortran, binutils, make
Maximilian Reininghaus's avatar
Maximilian Reininghaus committed
- optional: FLUKA (see below)
ralfulrich's avatar
ralfulrich committed
On a bare Ubuntu 20.04, just add:
ralfulrich's avatar
ralfulrich committed
sudo apt-get install python3 python3-pip cmake g++ gfortran git doxygen graphviz
Ralf Ulrich's avatar
Ralf Ulrich committed
```
Ralf Ulrich's avatar
Ralf Ulrich committed

ralfulrich's avatar
ralfulrich committed
On a bare CentOS 7 install python3, pip3 (pip from python3) and cmake3. Any of the devtools 7, 8, 9 should work (at least). 
Also initialize devtools, before building CORSIKA 8:
``` shell
source /opt/rh/devtoolset-9/enable
```

CORSIKA 8 uses the [conan](https://conan.io/) package manager to
manage our dependencies. Currently, version 1.55.0 or higher is required.
If you do not have Conan installed, it can be
ralfulrich's avatar
ralfulrich committed
installed with:
Ralf Ulrich's avatar
Ralf Ulrich committed
```
ralfulrich's avatar
ralfulrich committed
### Compiling

Once Conan is installed, follow these steps to download and install CORSIKA 8:
ralfulrich's avatar
ralfulrich committed

git clone --recursive https://gitlab.iap.kit.edu/AirShowerPhysics/corsika.git
# Or for https: git clone --recursive git@gitlab.iap.kit.edu:AirShowerPhysics/corsika.git
ralfulrich's avatar
ralfulrich committed
mkdir corsika-build
cd corsika-build
../corsika/conan-install.sh
cmake ../corsika -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX=../corsika-install
make -j4  #The number should match the number of available cores on your machine
Ralf Ulrich's avatar
Ralf Ulrich committed
make install
```
Ralf Ulrich's avatar
Ralf Ulrich committed

Maximilian Reininghaus's avatar
Maximilian Reininghaus committed
### FLUKA support

Warning: may only work when the next version of FLUKA is released (as of 2023.06.15)

Maximilian Reininghaus's avatar
Maximilian Reininghaus committed
For legal reasons we do not distribute/bundle FLUKA together with CORSIKA 8.
If you want to use FLUKA as low-energy hadronic interaction model, you have to download
it separately from (http://www.fluka.org/), which requires registering there as FLUKA user.
You need to download binaries suitable for your system (check compiler and glibc versions)
and unpack the binaries into a directory of your choice. You also need the data archive
(fluka20xy.z-data.tar.gz) unpacked in the same directory. To compile CORSIKA 8 with FLUKA,
you need to specify the path of libflukahp.a when invoking cmake with the option
`-DC8_FLUKALIB=<path>`. CMake will print a status message indicating whether FLUKA support
is enabled or disabled when the library is (not) found.

Ralf Ulrich's avatar
Ralf Ulrich committed

## Installation (using docker containers)

There are docker containers prepared that bring all the environment and packages you need to run CORSIKA. See [docker hub](https://hub.docker.com/repository/docker/corsika/devel) for a complete overview. 

### Prerequisites

You only need docker, e.g. on Ubunut: `sudo apt-get install docker` and of course root access.

## Compiling

Follow these steps to download and install CORSIKA 8, master development version
ralfulrich's avatar
ralfulrich committed
```shell
ralfulrich's avatar
ralfulrich committed
git clone --recursive https://gitlab.iap.kit.edu/AirShowerPhysics/corsika.git
Ralf Ulrich's avatar
Ralf Ulrich committed
sudo docker run -v $PWD:/corsika -it corsika/devel:clang-8 /bin/bash
mkdir build
cd build
../corsika/conan-install.sh
ralfulrich's avatar
ralfulrich committed
cmake ../corsika -DCMAKE_INSTALL_PREFIX=../corsika-install
make -j4  #The number should match the number of available cores on your machine
Ralf Ulrich's avatar
Ralf Ulrich committed
make install
```

ralfulrich's avatar
ralfulrich committed
## Runing Unit Tests

To run the Unit Tests, just type `ctest` in your build area.
Ralf Ulrich's avatar
Ralf Ulrich committed

ralfulrich's avatar
ralfulrich committed
## Running examples

ralfulrich's avatar
ralfulrich committed

From your top corsika build directory, (the one that includes `corsika-build` and `corsika-install`) type
ralfulrich's avatar
ralfulrich committed
```shell
cmake -Dcorsika_DIR=$PWD/corsika-build -S ./corsika/examples -B ./corsika-build-examples
cd corsika-build-examples
make -j4 #The number should match the number of available cores on your machine
ralfulrich's avatar
ralfulrich committed

From any directory, run the program `corsika-build-examples/bin/corsika`. As an example, you can run with the following flags:
ralfulrich's avatar
ralfulrich committed
```shell
corsika-build-examples/bin/corsika  --pdg 2212 -E 1e5 -f my_shower
This will run a vertical 100 TeV proton shower and will create and put the output into `./my_shower`.
ralfulrich's avatar
ralfulrich committed

Hans Dembinski's avatar
Hans Dembinski committed
### Generating doxygen documentation

ralfulrich's avatar
ralfulrich committed
To generate the documentation, you need doxygen and graphviz. If you work with 
the docker corsika/devel containers this is already included. 
Ralf Ulrich's avatar
Ralf Ulrich committed
Otherwise, e.g. on Ubuntu 18.04, do:
ralfulrich's avatar
ralfulrich committed
```shell
Hans Dembinski's avatar
Hans Dembinski committed
sudo apt-get install doxygen graphviz
```
Switch to the corsika build directory and do
ralfulrich's avatar
ralfulrich committed
```shell
ralfulrich's avatar
ralfulrich committed
make docs
Hans Dembinski's avatar
Hans Dembinski committed
```
ralfulrich's avatar
ralfulrich committed
open with firefox:
```shell
firefox ../corsika-install/share/corsika/doc/html/index.html
ralfulrich's avatar
ralfulrich committed