linux下面安装geant4,Ubuntu 12.04 下Geant4的安装
系統(tǒng)Ubuntu 12.04 32位版,gcc 4.6,Geant 4.9.5p1,CLHEP
2.1.2.2
參考
Installing Geant4 Release 4.9.4.p02 on Linux
http://geant4.slac.stanford.edu/tutorial/installation/Geant4.9.4.p02/Linux/Geant4_9_4_p02_Linux_Installation.htm#_What_are_the
準(zhǔn)備編譯環(huán)境:
sudo apt-get install build-essential cmake
cmake版本2.8.7
1)安裝CLHEP
由于新版CLHEP采用cmake方式編譯,原教程不適用,參考cmake/INSTALL安裝方法如下:
mkdir ~/build
cd ~/build
cmake /home/tyllr/CLHEP/2.1.2.2/CLHEP
make
make test
sudo make install
在/usr/local/lib下得到編譯好的多個庫,成功!
2)安裝Geant4
添加低能電磁作用數(shù)據(jù)包,data files for low
energyelectromagnetic processes
解壓到Geant4目錄新建的 data 文件夾下。
tyllr@tyllr-MXC061:~/geant4_9_5_p01$ mkdir ~/geant4build
tyllr@tyllr-MXC061:~/geant4_9_5_p01$ cd ~/geant4build/
tyllr@tyllr-MXC061:~/geant4build$ cmake ../geant4_9_5_p01
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- setting default compiler flags for CXX
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Could NOT find EXPAT (missing:?EXPAT_LIBRARY
EXPAT_INCLUDE_DIR)
-- The following Geant4 features are enabled:
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tyllr/geant4build
找不到 EXPAT,嘗試:
sudo apt-get install libexpat-dev
cmake ../geant4_9_5_p01
結(jié)果如下:
-- setting default compiler flags for CXX
-- Found EXPAT: /usr/lib/i386-linux-gnu/libexpat.so
-- The following Geant4 features are enabled:
GEANT4_USE_SYSTEM_EXPAT: Using system install of EXPAT
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tyllr/geant4build
tyllr@tyllr-MXC061:~/geant4build$ make
-j2
我是core 2
duo的cpu,所以用雙核選項。編譯很漫長,喝杯咖啡慢慢等。。。
完成后 sudo make
install,結(jié)束安裝。
3)測試?yán)?/p>
mkdir ~/g4examplebuild
cd ~/g4examplebuild
cmake ../geant4_9_5_p01/examples/novice
make
運行可執(zhí)行文件:
tyllr@tyllr-MXC061:~/g4examplebuild$ cd N01
tyllr@tyllr-MXC061:~/g4examplebuild/N01$ ./exampleN01
*************************************************************
Geant4 version Name:
geant4-09-05-patch-01?(20-March-2012)
Copyright : Geant4 Collaboration
Reference : NIM A 506 (2003), 250-303
WWW : http://cern.ch/geant4
*************************************************************
========= Table of registered couples
==============================
Index :
0?used in the geometry :
Yes?recalculation needed : No
Material : ArgonGas
Range
cuts?:?gamma?1
mm?e-?1
mm?e+?1 mm?proton 1 mm
Energy thresholds :?gamma?-1
MeV?e-?-1
MeV?e+?-1 MeV proton -1 MeV
Region(s) which use this couple :
DefaultRegionForTheWorldIndex :
1?used in the geometry :
Yes?recalculation needed : No
Material : Aluminum
Range
cuts?:?gamma?1
mm?e-?1
mm?e+?1 mm?proton 1 mm
Energy thresholds :?gamma?-1
MeV?e-?-1
MeV?e+?-1 MeV proton -1 MeV
Region(s) which use this couple :
DefaultRegionForTheWorldIndex :
2?used in the geometry :
Yes?recalculation needed : No
Material : Lead
Range
cuts?:?gamma?1
mm?e-?1
mm?e+?1 mm?proton 1 mm
Energy thresholds :?gamma?-1
MeV?e-?-1
MeV?e+?-1 MeV proton -1 MeV
Region(s) which use this couple :
DefaultRegionForTheWorld====================================================================
Start Run processing.
=====================================
G4EventManager::ProcessOneEvent()?=====================================
G4PrimaryTransformer::PrimaryVertex
(-2000(mm),0(mm),0(mm),0(nsec))
1 primaries are passed from G4EventTransformer.
!!!!!!! Now start processing an event !!!!!!!
*********************************************************************************************************
* G4Track Information:?Particle
= geantino,?Track ID =
1,?Parent ID = 0
*********************************************************************************************************
Step#?X(mm)?Y(mm)?Z(mm)
KinE(MeV)?dE(MeV) StepLeng
TrackLeng?NextVolume ProcName
0?-2e+03?0
總結(jié)
以上是生活随笔為你收集整理的linux下面安装geant4,Ubuntu 12.04 下Geant4的安装的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 人像抠图——基于深度学习一键去除视频背景
- 下一篇: 删除Linux Terminal中的历史