Install geent4 software developed by CERN on Ubuntu 18.04

Installing Geant4 on Ubuntu 18.04

GEANT 4 is a particle physics simulation software developed by CERN. This paper introduces the installation process of GEANT 4.10.04 on Ubuntu 18.04.

Explain:

  • Use the default bash
  • Assume the installation directory is / projects/soft/ext

Pre software installation:
Install the software package required by ROOT (see another blog: Install CERN's ROOT software on Ubuntu )Based on, the following packages are recommended:

libxerces-c-dev
libmotif-dev
libglw1-mesa-dev
inventor-dev
opticalraytracer
libpythia8-dev
pythia8-doc-html
pythia8-doc-worksheet
pythia8-examples

Other software recommended for installation

vim
vim-doc
vim-scripts
emacs
colordiff
lftp
dkms
build-essential
libzlcore-dev
libxmu-dev

Prepare source file:

cd /projects/soft/ext
mkdir sources
cd sources
<download geant4.10.04.p02.tar.gz>([Geant4 Download address](http://geant4.web.cern.ch/support/download)Direct download)
tar -zxvf geant4.10.04.p02.tar.gz
cd ../
mkdir G4data
cd G4data
<download data files>([Geant4data Download address](http://geant4.web.cern.ch/support/download)Direct download)

These data files include:

G4ABLA.3.0.tar.gz
G4NEUTRONXS.1.4.tar.gz
G4SAIDDATA.1.1.tar.gz
G4EMLOW.6.35.tar.gz
G4PhotonEvaporation.3.0.tar.gz
RealSurface.1.0.tar.gz
G4ENSDFSTATE.1.0.tar.gz
G4PII.1.3.tar.gz
G4NDL.4.4.tar.gz
G4RadioactiveDecay.4.0.tar.gz

Extract these files:

for i in `ls *.gz` ; do tar -zxvf $i ; done

Compilation and installation

 cd /projects/soft/ext/sources
    mkdir build-geant4.10.04.p02
    cd build-geant4.10.04.p02
    cmake -D CMAKE_INSTALL_PREFIX=/projects/soft/ext/geant4.10.04.p02-install -DGEANT4_INSTALL_DATADIR=/projects/soft/ext/G4data -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_USE_GDML=ON -DGEANT4_USE_QT=ON -DGEANT4_USE_XM=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_INVENTOR=OFF -DGEANT4_USE_RAYTRACER_X11=ON -DGEANT4_USE_SYSTEM_ZLIB=ON ../geant4.10.04.p02    
    make -j2
    make install

Environment settings

source /projects/soft/ext/geant4.10.04.p02-install/bin/geant4.sh

Or put it in. bashrc:

cat /projects/soft/ext/geant4.10.04.p02-install/bin/geant4.sh ~/.bashrc

Or open. / bashrc and add source /projects/soft/ext/geant4.10.04.p02-install/bin/geant4.sh at the end

Compile example

  mkdir -p $HOME/workdir/geant4
    cd $HOME/workdir/geant4
    cp -r /projects/soft/ext/geant4.10.04.p02-install/share/Geant4-10.0.4/examples .

    mkdir build-B1
    cd build-B1
    cmake ../examples/basic/B1
    make
    ./exampleB1

If the following screen appears, the installation is successful

Tags: Ubuntu vim cmake

Posted on Mon, 03 Feb 2020 11:01:48 -0500 by ThunderLee