Ubuntu18.04上安装CERN开发的Geant4软件

Ubuntu18.04上安装Geant4

Geant4是CERN开发的一款粒子物理模拟软件,本文介绍Geant4.10.04在Ubuntu18.04上的安装过程。

说明:

  • 使用默认的bash
  • 假设安装目录为/projects/soft/ext

预备软件安装:
在安装了ROOT需要的软件包(见另一博客:Ubuntu上安装CERN的ROOT软件)的基础上,建议安装以下软件包:

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

建议安装的其他软件

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

准备源文件:

cd /projects/soft/ext
mkdir sources
cd sources
<download geant4.10.04.p02.tar.gz>([Geant4下载地址](http://geant4.web.cern.ch/support/download)直接下载)
tar -zxvf geant4.10.04.p02.tar.gz
cd ../
mkdir G4data
cd G4data
<download data files>([Geant4data下载地址](http://geant4.web.cern.ch/support/download)直接下载)

这些数据文件包括:

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

解压缩这些文件:

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

编译安装

 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

环境设置

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

或者将其放入.bashrc中:

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

或者打开./bashrc,在末尾加入source /projects/soft/ext/geant4.10.04.p02-install/bin/geant4.sh

编译例子

  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

如果出现以下界面,则安装成功
Ubuntu18.04上安装CERN开发的Geant4软件_第1张图片

本文主要参考http://hep.tsinghua.edu.cn/~yangzw/CourseDataAna/Weihai/install_geant4_and_root_on_ubuntu.html

你可能感兴趣的:(Ubuntu软件安装)