How to create an interface between Sandbox.UrQMD Fortran code and GEANT4 toolkit

For complete installation, please visit physics arXivi:1203.3877v1

-- KhaledAbdelWaged - 06-Feb-2012


Geant4 use many transport codes to generate non-elastic reactions in macroscopic targets. The motivation was to provide a satisfactory level of description of final state hadron production for accurate and comprehensive simulations of particle detectors used in modern particle and nuclear physics experiments.

In Geant4 there are mainly 4 codes which are frequently applied for simulating N-body collisions within the hadronic cascade models, namely, Binary, Bertini, FTF and QGS. The Geant4 Binary and Bertini cascade models implement large resonance collision term but multiparticle production through string formation and fragmentation is not considered, which sets the upper limit of model applicability in nucleon induced reactions to about 5 GeV/c incident momentum. In contrast to Binary and Bertini cascade models, FTF and QGS, takes multiparticle production into account, to handle interaction for particles above about 15-20 GeV/c. For a reliable description of secondaries produced in high and low energy domains, Geant4 invoke Binary (Bertini) in the FTF(QGS) models. The corresponding hybrid model is called FTFB(QGSB).


To improve the simulation, it is worthwhile to supplement Geant4 toolkit with a single transport code which takes into account both resonance and multiparticle production. The Sandbox.UrQMD (Ultra relativistic Quantum Molecular Dynamics) model, which is first released in 1998, is designed to simulate (ultra)relativistic heavy ion collisions in a wide energy range from Bevalac and SIS up to AGS, SPS and RHIC. Thanks to the Sandbox.UrQMD collaborators, the Sandbox.UrQMD is provided as open source Fortran code on its website.

What the interface may offer?

Geant4-Sandbox.UrQMD interface offers interactions of Protons, neutrons, pions and kaons (and their antiparticles) as well as light and heavy ions interactions with matter. It gives type, mass, energy, and momentum of all secondary particles that are created in matter. Similar to CORSIKA-Sandbox.UrQMD interface, the upper energy limit is recommended to be about several 100 GeV. For the simulation, the appropriate Sandbox.UrQMD cross sections (for determining the mean free path between the interactions) are used.However, the probability for an interaction with matter at a given point is computed by the Geant4 cross sections classes.

This page provides installation requirements and instructions of the Geant4 -Sandbox.UrQMD interace.This interface is developed by Khaled Abdel-Waged et al., and sponsered by King Abdul Aziz City for Science and Technology /National Center for Mathematics and Physics under the contract number 31-465.

Software installation requirements

The Geant4 interface to Sandbox.UrQMD-1.3cr Fortran code uses the following software tools and packages:

  1. Sandbox.UrQMD-1.3cr event generator (in its original Fortran implementation)
  2. Geant4 version: ver.9.3.p01 or higher
The interface and original Sandbox.UrQMD-1.3cr source code have been compiled and tested using:
  1. gcc 4.1.2 with g77 (FORTRAN77 and GNUmake)

Operating systems used for this test is : Red Hat Linux 4.1.2-64

Overall interface design

The use of Sandbox.UrQMD-1.3cr physics in Geant4 has resulted in the introduction of a new event model (G4UrQMD1_3Model).

The general steps in the logical sequence are determined by:

  1. Instantiation of the G4UrQMD1_3Model process.
  2. Generation of interaction events.

Instantiation of G4UrQMD1_3Model

Upon instantiation of Geant4 -Sandbox.UrQMD interface, the class constructor initialises variables associated with the class and the Sandbox.UrQMD-1.3cr FORTRAN model. The latter involves initialisation of a series of common-block variables from the C++ code, mimicking the initialisation process performed by the FORTRAN code when used in standalone mode.

Generation of interaction events

In order to generate interaction events, the ApplyYourself member function of Geant4 is executed. The details of the projectile and target are determined (e.g., mass number, charge, projectile energy…). The FORTRAN subroutine Sandbox.UrQMD() is called from ApplyYourself. Upon completion of the Sandbox.UrQMD event, the information on the secondary particles generated are transferred to the product vector.

If no data exist for the specific projectile-target combination, a “Warning” is declared, and the run is stopped.

Class structure for model

The interface comprises G4UrQMD1_3Model class, which is derived from G4HadronicInteraction, and is defined within the Geant4 user physics list if access to UrQMD1_3physics is required. It controls initialisation of Sandbox.UrQMD-1.3cr through common block variables.

A small FORTRAN subroutine is included with the G4UrQMD distribution. This is required to ensure that block data initialisation in G4UrQMD1_3Model is performed (through FORTRAN EXTERNAL statements). Specifically the new FORTRAN subroutine is:

  1. g4urqmdblockdata.f

Installing Sandbox.UrQMD-1.3cr and building the libG4hadronic_urqmd13 library

Before installation, please first read architecutre.gmk file in Geant4 subdirectory ../../config/sys which defines all the Geant4 paths.

Copy the file g4urqmd-1.3cr.2012.tar to the directory (e.g.):

cd $G4INSTALL/source/processes/hadronic/models

If you are not successfull to install files into the directory "models" because of "permission denied", then please try to copy the files in $G4INSTALL/examples/extended/hadronic

Untar the files:

tar –xvzf g4urqmd-1.3cr.2012.tar

This creates the UrQMD13 directory, which contains:

  1. a subdirectory UrQMDsrc/ containing Sandbox.UrQMD-1.3cr ( to be downloaded by the user himself)
  2. a subdirectory include/ containg (G4UrQMD1_3Interface.hh & G4UrQMD1_3Model.hh)
  3. a subdirectory src/ containing (

Execute the script patch_make_and_install.csh from the directory UrQMD13. This executes a patch script and compiles all the relevant FORTRAN files in UrQMD13src, and copies the object files to the directory:


Change directory and execute make on the C++ source:

cd ..


This will build the library:


Ensure that the GNUmakefile for you application (in UrQMD13 directory) includes the following lines:

CPPFLAGS += -I$(G4BASE)/.../.../UrQMD13/include

The main () program

Geant4 does not provide the main(). In the main(), one has to construct G4ProcessManager, in order to process a run for the interface.

Ensure that the GNUmakefile for you application (in “main” directory) includes the following lines:

CPPFLAGS += -I$(G4BASE)/.../.../.../UrQMD13/include

EXTRALIBS += -L$(G4INSTALL)/lib/$(G4SYSTEM)–lG4hadronic_UrQMD13



cd $(G4BASE)/.../.../.../UrQMD13; $(MAKE)

Download G4UrQMD-1.3cr.2012.tar

* G4UrQMD-1.3cr.2012.tar

Edit | Attach | Watch | Print version | History: r15 < r14 < r13 < r12 < r11 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r15 - 2020-08-19 - TWikiAdminUser
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox/SandboxArchive All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback