Geant4.10 On Ubuntu 13.10
Hi particle simulator friend ! I encountered several problems while trying to compile Geant4.10 on my Ubuntu 13.10 machine. So if you want to avoid reading the manual and searching the web for possible solutions, follow this quick & essential tutorial.
Quick Geant4.10 Installation
To start you need this:
- Geant4 Toolkit source code (select the source files you prefer)
- cmake 1
- c++ compiler : open a terminal and typesudo apt-get install build-essential
- make 1
- xerces-c 1
- libX11, libX11-devel, libXt, libXt-devel and xorg1
Now that everything is set-up you should decide the path/to/ your geant installation, and unpack the source file in path/to/. So you’ll get a directory named path/to/geant4.10.00 . The next step will be to create a directory in which you’ll build the source files, these are the command lines to use in your terminal:
$ cd /path/to $ mkdir geant4_10_00-build $ ls geant4_10_00 geant4_10_00-build
Now we are ready to move into the newly build directory and configure the makefile of Geant, so follow the next instructions:
$ cd /path/to/geant4_10_00-build $ cmake -DCMAKE_INSTALL_PREFIX=/path/to/geant4_10_00-install -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_QT=ON /path/to/geant4_10_00/
Lets try to go through the last line; -DCMAKE_INSTALL_PREFIX will tell cmake where you want to install geant4.10. While -DGEANT4_INSTALL_DATA=ON asks cmake to download the data files (which are essential if you want to simulate particles crossing some kind of material). Finally the options DGEANT4_USE_OPENGL_X11 and DGEANT4_USE_QT will tell cmake to use X11 and QT as the graphical user interface. The last argument /path/to/geant4.10.00/ tells cmake where to search for the source files, once cmake has finished with the creation of the makefile you are ready to compile :
$ make -jN
Where N is the number of cpu cores of your machine. It’s almost finished, your compilation will be completed by:
$ make install
Before running an example you need to configure your system to run geant and this is done by:3
$ cd /path/to/geant4.10.00-install/bin/ $ . geant4.sh
To see if the installation was correctly accomplished you should try to run an example, so lets try the basic B1 example. Create on your desktop a directory called B1-build and move in that directory with your terminal. Then write the following code:
$ cmake -DGEANT4_DIR= /home/simple/geant/geant4.10.00-install/lib/Geant4-10.0.0/ /home/simple/geant/geant4.10.00/examples/basic/B1/ $ make -jN $ make install
Now you are ready to execute your basic geant program by:
I hope this tutorial has helped you during the installation of Geant and execution of the first simulation. Anyhow this is only a simple installation, for more complex ones you should read the manual and select the cmake arguments that fit your needs. Cheers and Have fun
1 Get it from synaptic Package Manager
2 Get it from Qt Poject
3 To automate this process open .bashrc (a file in your Home directory) and write this command on a new line:
- / 3 weeks ago
Badges make it easier for your staff to access their work quickly. They also enable...
- / 1 month ago
Cybersecurity is a domain that has been in demand in the past and will...
- / 2 months ago
One of the main concerns of any business or industry owner should be the...