Skip to content

Installing and running nexus

Paola Ferrario edited this page Nov 30, 2023 · 38 revisions

Getting the source

The NEXUS source can be downloaded from the git repository:

git clone https://github.com/next-exp/nexus.git

This command will create a folder names nexus. To get a particular tag, just enter the nexus folder and type:

git checkout name_of_tag

External dependencies

NEXUS depends on the following third-party libraries:

  • Geant4
  • gsl
  • hdf5

Geant4

NEXUS is based on Geant4. To install it, see the Geant4 page. The recommended version is geant4.11.0.2. A NEXUS tag >= v7_00_00 is needed to run with this Geant4 release. A summary of the installation instructions can be found here.

Once Geant4 is installed, make sure to have the G4INSTALL environment variable pointing to the Geant4 installation directory. This means that you need to execute:

export G4INSTALL=/path/to/geant4/installation

where path/to/geant4/installation is the path of the directory that contains the bin folder with the Geant4 executables.

Download the data files from the Geant4 web page and place them in the $G4INSTALL/share/Geant4-11.X.Y/data directory (you have to create it), if it wasn't done during the compilation step.

Now do

cd $G4INSTALL/bin; source geant4.sh

This script will do the following:

  1. Add G4INSTALL/bin path to the PATH environment variable.

  2. Assign the path of the PhotonEvaporation data file to the G4LEVELGAMMADATA environment variable.

  3. Assign the path of the G4EMLOW data file to the G4LEDATA environment variable.

  4. Assign the path of the RadioactiveDecay data file to the G4RADIOACTIVEDATA environment variable.

  5. Assign the path of the G4ENSDFSTATE data file to the G4ENSDFSTATEDATA environment variable.

  6. Assign the path of the G4SAIDDATA data file to the G4SAIDXSDATA environment variable.

  7. Assign the path of the G4PARTICLEXS data file to the G4PARTICLEXSDATA environment variable.

  8. Assign the path of the G4NDL data file to the G4NEUTRONHPDATA environment variable.

  9. Assign the path of the G4INCL data file to the G4INCLDATA environment variable.

Finally, add the G4INSTALL/lib path to the LD_LIBRARY_PATH (or DYLD_LIBRARY_PATH for macOS) variable.

gsl

Since the v5_00_11 tag, NEXUS depends on the GNU Scientific Library for the simulation of double beta decay events. See the GNU page for the download and installation of gsl.

Once you have gsl installed, make sure you have:

  1. gsl bin directory in your PATH variable.
  2. gsl lib directory in your LD_LIBRARY_PATH (or DYLD_LIBRARY_PATH for macOS) variable.

hdf5

NEXUS has the ability of writing hdf5 output files, therefore depends on the hdf5 library. You can download it from here.

After the installation, you need to have the following environment variables defined:

  1. hdf5 installation directory in your HDF5_DIR variable.
  2. hdf5 lib directory in your HDF5_LIB variable.
  3. hdf5 include directory in your HDF5_INC variable.
  4. hdf5 lib directory added to the LD_LIBRARY_PATH (or DYLD_LIBRARY_PATH for macOS) variable.

Installation

There are two different ways of building NEXUS: SCons and CMake.

SCons

Detailed information on SCons can be found here. To install SCons on your computer:

  1. You must have Python3 installed on your system.
  2. Download the latest stable version of SCons and uncompress the file.
  3. Move to the resulting folder and type (you may need super-user privileges for this to work):
python setup.py install

To build NEXUS just type: scons inside the top-level directory. The building script (SConstruct) tries to locate the headers and libraries of all dependencies using pkg-config scripts, the environment variables previously defined or examining common system-paths (/usr/local, for instance). Alternatively to defining environment variables, it is possible to pass the locations of the third-party libraries via command line, in the following way:

scons GEANT4_BINDIR=/path/to/Geant4/bin-directory ROOT_BINDIR=/path/to/root/bin-directory GSL_BINDIR=path/to/gsl/bin-directory HDF5_DIR=/path/to/hdf5/installation-directory

You can speedup the build using scons -jN where N is the number of available cores.

To silence excessive verbosity you can use scons -s.

CMake

Before running CMake, make sure you have at least version 3.13. The following are the basic building instructions for UNIX systems using the command-line, non-interactive CMake interface. We will assume nexus has been cloned in a directory named /path/to/nexus. Be sure you have run the GEANT4 configuration script.

To configure the build, use the following commands:

cd /path/to/nexus
mkdir build
cmake -DGSL_ROOT_DIR=/path/to/gsl -DHDF5_ROOT=/path/to/hdf5 -DCMAKE_INSTALL_PREFIX=/path/to/nexus -S . -B build
cmake --build build --target install

The --build option tells cmake to invoke the underlying build tool (make, ninja, xcodebuild, msbuild, etc). The underlying build tool can also be invoked directly of course, but the cmake --build command is more portable. On unix systems (with make or ninja) you can speedup the build with cmake --build . --target install -jN where N is the number of available cores.

Running nexus

In order to run nexus, be sure to execute the setup script, placed in the scripts folder.

  • If you use a macOS more recent than Mojave (version >= 10.15), you should execute:
source /path/to/scripts/nexus_setup.zsh
  • For the rest of operative systems:
source /path/to/scripts/nexus_setup.sh

It will set the NEXUSDIR variable to the top level directory of the installation.