Rate This Document
Findability
Accuracy
Completeness
Readability

Compiling and Installing Geant4

Procedure

  1. Use PuTTY to log in to the server as the root user.
  2. Configure OpenGL.
    yum install -y mesa*
    yum install -y freeglut*
    yum install -y *GLEW*
    yum install -y openssl-devel
  3. Switch to the DATA directory.
    cd /path/to/DATA
  4. Create a script for decompression.
    1. Create a script.
      vi run.sh
    2. Press i to enter the insert mode and add the following content to decompress data packages in batches:
      #!/bin/bash
      for wav in ./*.tar.gz; do
            echo "Extracting wav from $wav"
            tar -xvf $wav
      done
    3. Press Esc, type :wq!, and press Enter to save the script and exit.
  5. Add execution permissions for the script.
    chmod +x run.sh
  6. Decompress the data files.
    sh run.sh
  7. Set environment variables for data files.
    1. Open data_source.
      vi data_source
    2. Press i to enter the insert mode and add the following content to set environment variables:
      export G4SAIDXSDATA=/path/to/DATA/G4SAIDDATA2.0
      export G4LEDATA=/path/to/DATA/G4EMLOW7.9.1
      export G4LEVELGAMMADATA=/path/to/DATA/PhotonEvaporation5.5
      export G4INCLDATA=/path/to/DATA/G4INCL1.0
      export G4PARTICLEXSDATA=/path/to/DATA/G4PARTICLEXS2.1
      export G4PIIDATA=/path/to/DATA/G4PII1.3
      export G4RADIOACTIVEDATA=/path/to/DATA/RadioactiveDecay5.4
      export G4REALSURFACEDATA=/path/to/DATA/RealSurface2.1.1
      export G4ABLADATA=/path/to/DATA/G4ABLA3.1
      export G4NEUTRONHPDATA=/path/to/DATA/G4NDL4.6
      export G4ENSDFSTATEDATA=/path/to/DATA/G4ENSDFSTATE2.2
      export G4TENDLDATA=/path/to/DATA/G4TENDL1.3.2
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  8. Run the following command to make the environment variables take effect:
    source data_source
  9. Decompress the Geant4 installation package.
    tar -xvf geant4.10.06.p01.tar.gz
  10. Create a build folder and switch to the folder.
    mkdir geant4.10.06.p01/build
    cd geant4.10.06.p01/build
  11. Compile Geant4.
    CC=mpicc CXX=mpicxx CFLAGS='-O3 -finline-functions -march=armv8.2-a -flto' cmake -DCMAKE_INSTALL_PREFIX=/path/to/GEANT4/geant4.10.06.p01-install -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_BUILD_MULTITHREADED=ON ../
  12. Run the following commands to install Geant4:
    make -j16
    make install
  13. Switch to the parallel module directory.
    cd /path/to/GEANT4/geant4.10.06.p01/examples/extended/parallel/MPI/source
  14. Create a build directory and switch to the directory.
    mkdir build
    cd build
  15. Compile the parallel module.
    CC=mpicc CXX=mpicxx CFLAGS='-O3 -finline-functions -march=armv8.2-a -flto'  cmake -DCMAKE_INSTALL_PREFIX=/path/to/GEANT4/geant4.10.06.p01-install/lib64  ../
  16. Install the parallel module.
    make -j16
    make install