Related Posts Plugin for WordPress, Blogger...

Sunday, February 27, 2011

How to install Geant4 in Ubuntu Linux...

Geant4 is a toolkit for the simulation of the passage of particles through matter. Its areas of application include high energy, nuclear and accelerator physics, as well as studies in medical and space science. The two main reference papers for Geant4 are published in Nuclear Instruments and Methods in Physics Research A 506 (2003) 250-303, and IEEE Transactions on Nuclear Science 53 No. 1 (2006) 270-278
In Ubuntu you need the following prerequisites... 


build-essential gfortran lesstif2-dev inventor-dev libxaw7-dev freeglut3-dev libxerces-c2-dev

to install them open terminal from Applications --> Accessories --> Terminal

and type in

sudo apt-get install build-essential gfortran lesstif2-dev inventor-dev libxaw7-dev freeglut3-dev libxerces-c2-dev 


 Now download the Geant4***.tar.gz file from  


Download the GNU or Linux tar format from the above page...

for example this...


also download the Clhep***.tar.gz file from 



For example this...


Keep both these files in home directory...

Now in the terminal type in

cd ~
tar -xzvf geant4*.tar.gz
cd geant4*
tar -xzvf ../clhep*.tgz
cd 2.1.*/CLHEP
./configure --prefix /home/user_name/geant4.9.4.p01/2.1.0.1/

Here user name should be the login name... ie; one should specify the total path to CLHEP folder...

now type in

make
make install
cd ../..
./Configure -build


Here are the options that one should select for a single machine installation...

Just hit enter for all default locations specified by the program, except for

CLHEP_BASE_DIR:        where       /home/user_name/geant4.9.4.p01/2.0.4.1/

  should be entered.

Enter "y" (without quotes) for all questions except for the questions on "multiple machines" and "static libraries"

One can refer the following file for details...

http://www.ziddu.com/download/13983033/geant_4_options.txt.html

This will end up with the following output...

##############################
######################
# Your Geant4 installation seems to be successful! 
# To be sure please have a look into the log file: 
# /home/user_name/geant4.9.4.p01/.config/bin/Linux-g++/g4make.log             
####################################################


Now type in 

./Configure -install
./Configure


which will end up in...


                --- Geant4 Toolkit Installation  ---
                  (setting environments for USER )

---------------------------------------------------
The Geant4 toolkit installation was found.
The files env.[c]sh will be copied to your current directory.
For setting Geant4 environments you should make:

source env.csh

or

. env.sh

It will also check G4WORKDIR setting and set it to
your HOME if needed.
You can use these files also for further modifications
(adding your own environments).
---------------------------------------------------


With this installation will be over...

To run an example create a folder where ever you like. Let us say name it as  "work"

Now copy an example folder A01 from

geant4.9.4.p01/examples/extended/analysis/ to work folder

Now open terminal and enter

export G4WORKDIR=/path_to/Work
 export LD_LIBRARY_PATH=~/geant4.9.4.p01/2.1.0.1/lib/:$LD_LIBRARY_PATH
source ~/geant4.9.4/env.sh

These 3 steps should be done every time you start the program...

As we have copied A01 folder into work folder,

Now in terminal:


cd $G4WORKDIR/A01
make
$G4WORKDIR/bin/Linux-g++/A01app
Now you will see a window with title G4UI SESSION


where you can search for commands in the search box and implement them in the "session" box in the bottom.

for example if one implements the following in the bottom "session" box

/vis/open OGLI
/vis/drawVolume
/vis/scene/add/trajectories
/vis/scene/add/hits
/run/beamOn 1

The final screen will look like below:
http://i52.tinypic.com/2hnmg4l.png

The whole installation will be around 730MB..
Cheers............


You may refer the following for simplest way of installation...

http://conquer-ur-computer.blogspot.com/2011/03/geant4-direct-installation-for-ubuntu.html


Is this post useful?
Working well!
Not working...
Needs some modifications..

  
pollcode.com free polls

Print Friendly and PDF

37 comments:

  1. This will resolve most general errors during the installation like....


    /usr/bin/ld: cannot find -lXmu
    /usr/bin/ld: cannot find -lXt




    /usr/bin/ld: cannot find -lG4GMocren
    /usr/bin/ld: cannot find -lG4FR
    /usr/bin/ld: cannot find -lG4visHepRep
    /usr/bin/ld: cannot find -lG4OpenGL
    /usr/bin/ld: cannot find -lG4RayTracer
    /usr/bin/ld: cannot find -lG4Tree
    /usr/bin/ld: cannot find -lG4VRML
    /usr/bin/ld: cannot find -lG4UIcommon
    /usr/bin/ld: cannot find -lG4gl2ps
    collect2: ld returned 1 exit status
    make: * [/home/****/geant4.9.4/bin/Linux-g++/exampleN02] Error 1






    make[1]: *** [granular] Error 2


    make: *** [all] Error 2'


    make[1]: *** [makesub] Error 2


    In file included from /home/******/usr/include/Inventor/Xt/SoXt.h:59,


    ############################################################
    # It looks like you had errors during Geant4 installation
    # (or interrupted installation)!
    # Please check log file:
    # /home/*****/geant4/geant4.9.0/.config/bin/Linux-g++/g4make.log
    ############################################################

    etc....

    ReplyDelete
    Replies
    1. (# It looks like you had errors during Geant4 installation
      # (or interrupted installation)!
      # Please check log file:
      # /home/*****/geant4/geant4.9.0/.config/bin/Linux-g++/g4make.log)
      i have error that bath conficure how to solve that problem

      Delete
  2. Hi...I successful installed on UBUNTU10.10. But my G4UI Session is empty... ???

    ReplyDelete
  3. You need to start with "/vis/open OGLI"

    to start Open GL graphical interface...

    and give the remaining commands....

    Of course OpenGL is still in development stage...

    if you minimize and maximize sometimes you may not see any thing...

    Just give another "/vis/open OGLI" in session, Then you will see a second tab as i have shown above

    Then by switching between 2 tabs you can see the content of the black window...

    ReplyDelete
  4. Thanks sanjeev.

    But: example A01:
    HadCalLayerPhysical[-1] HadCalLayerLogical 1 Lead
    HadCalScintiPhysical[0] HadCalScintiLogical 0 Scintillator /HadCalorimeter
    Idle> /vis/open OGLI
    Segmentation fault
    root@batmunkhm-P5K-SE-EPU:/usr/g4work/A01#

    ReplyDelete
  5. !#
    It is good to see bloggers provide useful feedback on comments. Not often will this happen and seems to be a rarity these days.

    http://evo4g-sprint.blogspot.com/
    http://milwaukee-hater.blogspot.com/

    ReplyDelete
  6. I also needed to install
    libxi-dev and qt4-dev . :D

    ReplyDelete
  7. I'm sorry not qt4-dev, libqt4-dev :D

    ReplyDelete
  8. Hello Anonymous!

    I have successfully installed Geant4.9.4.p01 on Linux Ubuntu10.10. I can building an examples from Terminal on G4UISession.
    ..... ..... How to build g4py in Geant4? I have installed ROOT and boostPYTHON

    Please detail help me...???

    ReplyDelete
  9. I am sorry I tried to install but in the line make install is giving error something like install-am error, does someone can help me?
    thanks

    ReplyDelete
  10. Hi, I followed your instructions, but had this result:

    ############################################################
    # It looks like you had errors during Geant4 installation
    # (or interrupted installation)!
    # Please check log file:
    # /home/*****/geant4/geant4.9.0/.config/bin/Linux-g++/g4make.log
    ############################################################

    Can you help me? Tank you

    ReplyDelete
  11. Hey ! Thanks a lot for your instructions.
    I'm a student who try (hardly) to install Geant4 on my computer under Ubuntu 10... The installation seems to be okay, but when I compile, for example, the N03 example, I get :

    /home/my_name/geant4.9.4.p01/lib/Linux-g++/libG4OpenGL.so: undefined reference to `G4Xt::PutStringInResourceDatabase(char*)'
    /home/my_name/geant4.9.4.p01/lib/Linux-g++/libG4OpenGL.so: undefined reference to `G4Xt::getInstance()'
    collect2: ld returned 1 exit status
    make: *** [/home/my_name/work//bin/Linux-g++/exampleN03] Error 1

    I did'nt install all the visualisation tools.

    Could you help me ? :D
    Thanks a million !
    (And sorry for my approximative English)

    ReplyDelete
  12. Hello NGC6543!. You may be need to:

    #source /usr/local/geant4.9.4.p01/env.sh
    #cd N03
    #make

    g`luck!

    ReplyDelete
  13. Hi everybody,

    I am beginner in geant4, does some one know
    where I can find helpful material for using
    geant4?
    I will be very grateful if some one can teach me how to begin?
    thanks a lot.

    ReplyDelete
  14. @btkhcgs : my environment variables are well defined. I don't understand...

    Thanks anyway. :)

    ReplyDelete
  15. I have installed correctly (I think) but when trying to open the example I get this:

    angela@Edgar:~$ cd $G4WORKDIR/A01
    bash: cd: /path_to/Work/A01: No such file or directory


    Any ideas?

    ReplyDelete
  16. because you should write path of you directory not path_to
    you should write /home/______/Work/A01

    ReplyDelete
  17. Hi , Iam a completely beginner with Geant4 , i have installed it on my laptop but when just started to try the first example A01 i got this results:

    reating shared library /home/zaid/g4work/tmp/Linux-g++/A01app/libA01app.so ...
    /usr/bin/ld: cannot find -lXmu
    collect2: ld returned 1 exit status
    make: *** [/home/zaid/g4work/tmp/Linux-g++/A01app/libA01app.so] Error 1

    Any ideas ?

    ReplyDelete
  18. I hope you didn't install the basic dependencies.. Please follow the above mentioned instructions carefully starting from beginning freshly... Hope you could resolve it..

    Cheers,
    SANJEEV

    ReplyDelete
  19. Hi, I followed your instructions, but had this result:

    ############################################################
    # It looks like you had errors during Geant4 installation
    # (or interrupted installation)!
    # Please check log file:
    # /home/*****/geant4/geant4.9.0/.config/bin/Linux-g++/g4make.log
    ############################################################

    Can you help me? Tank you

    ReplyDelete
  20. Hi Sanjeev,
    I followed your instructions for installing Geant4 on Ubuntu and its seems to be working. When I try to run the A01 example, I dont get a window with the title G4UI, instead I get the following message.

    HadCalScintiPhysical[0] HadCalScintiLogical 0 Scintillator /HadCalorimeter
    Idle> /vis/open OGLI
    parameter value is not listed in the candidate List.
    Parameter is out of candidate list (index 0)
    Candidates : ATree DAWNFILE HepRepXML HepRepFile RayTracer VRML1FILE VRML2FILE gMocrenFile
    Idle>

    I am wondering if I have to change a parameter in env.sh or something. I am running Ubuntu 11.10. I am also wondering if I should try to install an older version of Ubuntu and reinstall Geant4.

    Any suggestions would be appreciated. Thanks

    ReplyDelete
  21. I am attempting to install geant 4.9.5 on Ubuntu 11.10. I get through the "now type in
    make
    make install
    cd ../.."
    portion, but then there is no Configure file to be executed. Any assistance you can give would be greatly appreciated in regard to which configure file I should be finding, and exactly where it is.

    Thanks,
    George

    ReplyDelete
  22. Hey George,

    Geant version 4.9.5 has an entirely different way to install (cmake this, cmake that), and none of these directions are pertinent anymore. Unfortunately, until more bloggers share exactly how to get it running, we're all kind of screwed with nothing but the official installation documentation, which is as abhorrent as ever :-(

    Good luck, and please post your success anywhere on the internet for us to find!

    ReplyDelete
  23. Yup, think they thought the installation was getting a touch too easy.

    ReplyDelete
  24. I tried Ubuntu 12.10 and Ubuntu 11.10, both got errors (installation interrupted). How come? Which Ubuntu version are you guts using. It almost a week of installing this software. Cry!!

    ReplyDelete
  25. In 12.10 Geant4 is available in ubuntu repositories. One can search and get it from "Ubuntu software center"

    ReplyDelete
    Replies
    1. Hi Sanjeev,
      sorry for asking a bad question. So, I installed GEANT4 from Ubuntu software center. Then what do i do? I am very new to anything not XP.
      Sincerely
      Faizman

      Delete
  26. Hi, how can i do to link root with geant4.

    ReplyDelete
  27. "bloggers share exactly how to get it running, we're all kind of screwed"

    It seems that there are provisions for CMake in the CLHEP and GEANT source dists, but the exact process to a solution is mystifying.

    I can see the contents: 2.1.3.1 cmake CMakeLists.txt config environments examples LICENSE ReleaseNotes source

    just inside the source dir...so close and yet so far!

    ReplyDelete
  28. Okay, this if for everyone as of June 27th 2013

    I installed exactly as stated here: http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/InstallationGuide/html/ch02.html#sect.UnixBuildAndInstall

    and it worked!

    I wondered where the "-install" came from but it didn't matter.

    ReplyDelete
  29. Hi thanks a lot;;
    but I have a problem with this command:

    root@WarVaio:~/geant4.10.00.p01/2.1.4.1/CLHEP# ./configure --prefix /home/adminlab/geant4.10.00.p01/2.1.4.1/
    bash: ./configure: File o directory non esistente

    [file or directory dows not exist]

    ????
    Thanks

    ReplyDelete
  30. Haben Sie schon für eine Reihe von Jahren die gleiche ältere Fernseher mit?Vielleicht sind Sie ein wenig mit der Leistung Ihrer aktuellen Fernseher zufrieden, aber man kann nicht helfen, aber all die neuen High-Tech-Fernseher mit eindrucksvollen Bildern auf dem Markt feststellen
    Visit http://filmundunterhaltung.magnoto.de

    ReplyDelete
  31. NATIONAL INSTITUTE OF DIGITAL EDUCATION established in 2010 with the mission of delivering training to professionals in Computer Training. We offer a wide range of quality computer training.

    All our training courses are taught by professionals in the field, allowing you the chance to learn from experts within their respected industry, which provides you with a quality computer training that will help you take your knowledge and career to new heights. We have different courses to shoot-up the requirement of the general youths of West Bengal. The duration of the courses are segregated in Six Months, One Year & 18 Months. Students are awarded by CERTIFICATE which will accept all over India.
    -----------------------------------------------------------------------------------------------------
    Email: info@nideindia.in / nidedirector@gmail.com

    Website : http://www.nideindia.in , Facebook : https://www.facebook.com/NIDEofficial/

    Twitter : https://twitter.com/nideindia , YouTube : https://www.youtube.com/channel/UCDvV-Fhx9Tz3jDmeZu4EOUw

    Android App : https://play.google.com/store/apps/details?id=com.ntss.nide

    ReplyDelete