Install DAG-Geant4

This document explains how to install DAG-Geant4, assuming you have already installed the required dependencies.

Get DAGMC

As before, this guide assumes that you are building DAGMC in the subdirectory dagmc_bld of your home directory.

The first step is to clone the DAGMC repository.

$ cd $HOME/dagmc_bld
$ mkdir DAGMC
$ cd DAGMC
$ git clone https://github.com/svalinn/DAGMC
$ cd DAGMC
$ git checkout develop
$ git submodule update --init

Install Geant4

DAG-Geant4 uses Geant4 from CERN. It is open-source software so you do not need to register an account.

Refer to the getting started page for information about downloading and installing Geant4. The following commands can be used to download the Geant4 source code and set it up for building:

$ cd $HOME/dagmc_bld
$ mkdir -p Geant4/bld
$ cd Geant4
$ wget http://geant4.cern.ch/support/source/geant4.10.04.p02.tar.gz
$ tar -xzvf geant4.10.04.p02.tar.gz
$ ln -s geant4.10.04.p02 src

Geant4 uses a CMake build, and we recommend using the following flags when installing it with the purpose of coupling with DAGMC:

$ cd bld
$ cmake ../src -DGEANT4_INSTALL_DATA=ON \
               -DGEANT4_USE_QT=ON \  # or -DGEANT4_USE_OPENGL_X11=ON
               -DGEANT4_USE_SYSTEM_EXPAT=OFF
$ make
$ make install

Configure DAG-Geant4

First, create and enter the build directory.

$ cd $HOME/dagmc_bld/DAGMC
$ ln -s DAGMC src
$ mkdir bld
$ cd bld

Then, choose where you want to install DAGMC. This is where the binaries, libraries, header files, etc. will be placed. This guide uses $INSTALL_PATH to represent this location.

$ INSTALL_PATH=$HOME/dagmc_bld/DAGMC

CMake variables are used to configure DAGMC with your desired build options. A few examples will be shown here, but you can see a list of all possible options here.

The following CMake command will build DAG-Geant4, assuming you built Geant4 as specified in the Geant4 build instructions above.

$ cmake ../src -DMOAB_DIR=$HOME/dagmc_bld/MOAB \
               -DBUILD_GEANT4=ON \
               -DGEANT4_DIR=$HOME/dagmc_bld/Geant4 \
               -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH

If the CMake configuration proceeded successfully, you are now ready to install DAGMC.

Build DAG-Geant4

Use Make to install DAG-Geant4.

$ make
$ make install

If the build was successful, the binaries, libraries, header files, and tests will be installed to the bin, lib, include, and tests subdirectories of $INSTALL_PATH respectively.

To use DagGeant4, you first must make add the Geant4 library directory to your $LD_LIBRARY_PATH.

$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/dagmc_bld/Geant4/lib

Test DAG-Geant4

Configure DAG-Geant4

First, create and enter the build directory.

$ cd $HOME/dagmc_bld/DAGMC
$ ln -s DAGMC src
$ mkdir bld
$ cd bld

Then, choose where you want to install DAGMC. This is where the binaries, libraries, header files, etc. will be placed. This guide uses $INSTALL_PATH to represent this location.

$ INSTALL_PATH=$HOME/dagmc_bld/DAGMC

CMake variables are used to configure DAGMC with your desired build options. A few examples will be shown here, but you can see a list of all possible options here.

To run the DagSolid unit tests, use the following command. Make sure that the Geant4 library directory is in your $LD_LIBRARY_PATH as specified above.

$ cd $INSTALL_PATH/tests
$ ./dagsolid_unit_tests

If the tests ran successfully, the last few lines of the screen output will look like this:

[       OK ] DagSolidTest.surface_area_test (5 ms)
[----------] 16 tests from DagSolidTest (228 ms total)

[----------] Global test environment tear-down
[==========] 16 tests from 1 test case ran. (228 ms total)
[  PASSED  ] 16 tests.

Test DAGMC

We regularly run the DAGMC test suite on CircleCI as part of our continuous integration system. You may however wish to run the tests yourself in order to verify you have installed DAGMC correctly.

If the tests have completed successfully, you are now ready to run your first DAGMC problem. See the DAGMC user’s guide for more information.