搜档网
当前位置:搜档网 › 安装geant4

安装geant4

安装geant4
安装geant4

安装geant4(一)

2009年05月21日星期四下午05:49

安装编译环境和OpenGL图形驱动,为安装geant4做基础准备。

1、安装基本编译环境

sudo apt-get install build-essential

2、安裝OpenGL Library

sudo apt-get install libgl1-mesa-dev

3、安裝OpenGL Utilities

sudo apt-get install libglu1-mesa-dev

OpenGL Utilities 是一組建構於OpenGL Library 之上的工具組,提供許多很方便的函式,使OpenGL 更強大且更容易使用。

4、安装sudo apt-get install libxt-dev

不装这个包在编译geant4时会报error: X11/Intrinsic.h: No such file or directory的错误。

5、打开新立得软件包管理器,查找libxmu。把找到的七项全装上。否则编译geant4时会遇到如下错误:include/G4OpenGLXViewer.hh:46:29: error: X11/Xmu/StdCmap.h: No such file or directory

原因可能是默认安装的libxmu相关包都不是dev版(develop),所以在系统中没有头文件。

三、geant4安装

geant4官方网站安装方法安装:

example:clhep-2.0.3.1.tgz

Put clhep-2.0.3.1.tgz into your directory of choice, such as:

~/CLHEP

Navigate to this directory and unpack the file:

cd ~/CLHEP

tar -zxvf clhep-2.0.3.1.tgz

The unpacking process will begin, starting with:

2.0.

3.1/

2.0.

3.1/CLHEP/

2.0.

3.1/CLHEP/CVS/

2.0.

3.1/CLHEP/CVS/Root

2.0.

3.1/CLHEP/CVS/Repository

And ending with:

2.0.

3.1/CLHEP/install-sh

2.0.

3.1/CLHEP/config.guess

2.0.

3.1/CLHEP/config.sub

2.0.

3.1/CLHEP/Makefile.in

2.0.

3.1/CLHEP/configure

For the following step, note that there are two dashes in a row before the word "prefix". Also note that for this command you should use the absolute path for your CLHEP, such as: /u/ey/perl/CLHEP

rather than a relative path, such as:

~/CLHEP

And be sure to point to your top level CLHEP directory, NOT:

/u/ey/perl/CLHEP/2.0.3.1/CLHEP

Now navigate into the unpacked directory and begin the configuration process.

Of course, substitute your actual CLHEP path here:

cd 2.0.3.1/CLHEP

./configure --prefix /u/ey/perl/CLHEP

Run the build process:

make

Finally, move the build products to their installation area:

make install

You will now have directories such as:

~/CLHEP/include

and

~/CLHEP/lib

You're done setting up CLHEP.

安装geant4(二)

2009年05月21日星期四下午05:56

Getting Geant4

Put it into your directory of choice, such as:

~/geant4

Navigate to this directory and unpack the file:

cd ~/geant4

tar -zxvf geant4.9.0.tar.gz

Depending on the physics of your particular application, you may need to install additional data files. These data files can be downloaded separately from the Geant4 source distribution page (the same place where you got Geant4 itself).

Create a new folder within ~/geant4/geant4.9.0 to hold any of these required data files.

~/geant4/geant4.9.0/data

For now, pick up the "data files for low energy electromagnetic processes":

http://geant4.web.cern.ch/geant4/support/source/G4EMLOW.4.3.tar.gz

The file is about 7.6M.

Put the file into your new data directory.

Navigate to this directory and unpack the file:

cd ~/geant4/geant4.9.0/data

tar -zxvf G4EMLOW.4.3.tar.gz

Doing the Initial Build

Finally, unless you're absolutely sure you are starting from a nice clean system, make sure you don't have any pre-existing Geant4 environment variables. You can use the "printenv" command to show all variables, and filter this with a "grep" for the string G4 as follows:

From a Terminal or xterm window:

printenv | grep G4

If any variables show up, find out what is setting them and remove them. They might be coming from your .login or .cshrc file or from some other script that you invoke upon login for some other project. Take the time now to find the cause and resolve it.

From a Terminal or xterm window:

cd ~/geant4/geant4.9.0

./Configure -build

===============================================

You will be asked a series of questions.

In most cases, you can just take the default response (by hitting carriage return).

But pay close attention so that you do not accept the default for the following questions:

When it says:

Could not find CLHEP installed on this system!

Please, specify where CLHEP is installed:

First, confirm that you have installed your CLHEP to

/u/ey/perl/CLHEP

Or wherever you've decided to keep CLHEP.

Make sure you have lib, bin and include subdirectories in that directory.

If not, recheck your CLHEP installation. If so, proceed.

Note that for this command you should use the absolute path for your CLHEP, such as: /u/ey/perl/CLHEP

rather than a relative path, such as:

~/CLHEP

Of course, substitute your actual CLHEP path here.

Enter: /u/ey/perl/CLHEP

Take the default for everything else except:

When it asks about:

G4VIS_BUILD_OPENGLX_DRIVER

G4VIS_USE_OPENGLX

Enter: y

This tells Geant4 that you want to include the optional OpenGL Visualization driver. When it asks about:

G4VIS_BUILD_RAYTRACERX_DRIVER

G4VIS_USE_RAYTRACERX

Enter: y

This tells Geant4 that you want to include the optional RayTracerX Visualization driver. Take the default for everything else.

Once all of the questions have been answered, you will be told:

WARNING: the generated configuration file

can be edited if necessary!

You can introduce any change to the configuration file

/u/ey/perl/geant4/geant4.9.0/.config/bin/Linux-g++/config.sh before the final installation.

To do so, use a shell escape now (e.g. !vi /u/ey/perl/geant4/geant4.9.0/.config/bin/Linux-g++/config.sh).

Press [Enter] to start installation or use a shell escape to edit config.sh:

At this point, what you have seen in this question and answer session should match what you find in this web directory as:

Geant4Build.txt

You are ready to proceed with the build.

Hit Enter.

===============================================

Once you see any lines like:

Compiling https://www.sodocs.net/doc/3e17761726.html, ...

with no errors,

the compilation is successfully under way.

基本安装上!

相关主题