Geant 4

Overview

Geant4 is a toolkit for the simulation of the passage of particles through matter. Its areas of application include high energy, nuclear and accelerator physics, as well as studies in medical and space science.

The following version is installed on the CSF:

  • Geant4 11.4.0
  • Geant4 11.1.3

Restrictions on use

GEANT4 is not open source software, it has a custom license, which you should read before using GEANT4. GEANT4 is available to all CSF3 users, there is no access to the source code on CSF3 but this can be found on the GEANT4 Github.

Set up procedure

To access the toolkit load one of the modulefiles:

module load apps/gcc/geant4/11.4.0
module load apps/gcc/geant4/11.1.3

For reliable behaviour, we recommend loading module files in your job script rather than on the login node.

Using the Toolkit

Compile your GEANT4 Application

Create your build directory:

mkdir ~/scratch/my_application_build

cd ~/scratch/my_application_build

Compile your code with

cmake -DGeant4_DIR=$GEANT4DIR ~/path/to/my_application_source

make

The executable will be created.

Please do not run your Geant4 application on the login node. Jobs should be submitted to the compute nodes via sbatch or srun for an interactive session.

Run

Serial batch job submission

If your application is interactive, for example, if it produces graphical output, connect to a compute node for an interactive session:

srun -p interactive -t 60 --pty bash

module load apps/gcc/geant4/11.1.3

~/path/to/my_application

If your application isn’t interactive, please submit jobs via batch:

#! /bin/bash --login
#SBATCH -p serial        # Run in the "serial" partition (compute nodes dedicated to 1-core jobs)
#SBATCH -t 1-00:00:00    # maximum runtime in D-HH-MM-SS

module load apps/gcc/geant4/11.1.3

~/path/to/my_application

Parallel batch job submission

From 11.4.0 onwards.

As well as requesting number of cores from SLURM, you will need to specify the number of cores to the code you will run, please refer to the GEANT4 documentation if unsure.

Interactive:

srun -p interactive -n 4 -t 60 --pty bash

module load apps/gcc/geant4/11.1.3

~/path/to/my_application

Batch:

#! /bin/bash --login
#SBATCH -p multicore     # Run in the "multicore" partition (nodes dedicated to >1 core jobs)
#SBATCH -n 4             # Number of cores desired
#SBATCH -t 1-00:00:00    # maximum runtime in D-HH-MM-SS

module purge
module load apps/gcc/geant4/11.4.0

~/path/to/my_application [ARGS]

Further info

  • Documentation: Geant4 Website
  • Tutorials/examples are available in $GEANT4DIR/share/Geant4/examples
  • GEANT4 datasets available in $GEANT4DIR/data

Last modified on December 16, 2025 at 2:01 pm by Martin Wolstencroft