Thursday, July 24, 2014

working with Geant4 on Ubuntu 13.10

Started some preliminary work with the Geant4 C++ toolkit for Monte Carlo simulations. The name comes from GEANT-3, GEometry ANd Tracking.

Also looking at GATE - Geant4 Application for Tomographic Emission as mentioned in this pdf.

Installing Geant4 ran into QT related errors. The solution was here, editing
/usr/include/qt4/QtOpenGL/qgl.h

to have at the end of the if defined includes

#if defined(Q_WS_MAC)
# include
#else
# ifndef QT_LINUXBASE
#   include
# endif
#endif

It turned out that installing in a user directory was more convenient, as that was the method in the install guide. Installed versions 9.6 and 10.0, since the GATE was supposed to work with 9.6. My make string was
cmake -DCMAKE_INSTALL_PREFIX=~/geant4 ../geant4_9_6_p03 -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_QT=ON -DGEANT4_INSTALL_EXAMPLES=ON 

make -j2 (using two cores for building) ran for 50 minutes to build geant4 v9.6.
make by itself (only one core) took 80 minutes for 10.0.

With this installation, the make string for applications using Geant4 was
cmake -DGeant4_DIR=/home/hari/geant4/lib/Geant4-9.6.3 ../LXe
and so on.

The LXe example needed the path to low energy data to be defined as an environment variable, like
export G4LEDATA=/home/hari/geant4_10/share/Geant4-10.0.2/data/G4EMLOW6.35

In Ubuntu, one method to set environment variables without reboot seems to be to edit /etc/environment to add at the bottom
G4LEDATA=/home/hari/geant4_10/share/Geant4-10.0.2/data/G4EMLOW6.35
Geant4_DIR=/home/hari/geant4_10/lib/Geant4-10.0.2
and then call
source /etc/environment
at the bottom of .bashrc - but that did not seem to work - have to put export statements in .profile, as mentioned in the ubuntu help file. And that will work only after logging in again.

Once these environment variables are set, then the make string does not need the path to Geant4 and so on.




No comments:

Post a Comment