Skip to content

NCrystalInstall

Andrey Morozov edited this page Sep 24, 2025 · 6 revisions

Installation of NCrystal library

Ants3 gives access to NCrystal library which enables simulations of thermal neutrons in crystals and other materials. The access is provided using the NCrystal-Geant4 interface.

NCrystal support in Ants3 is optional (not enabled by default). In order to enable it, the following steps have to be taken:

Install NCrystal library

  • mkdir $HOME/NCrystal

  • cd $HOME/NCrystal

  • wget https://github.com/mctools/ncrystal/archive/refs/heads/main.tar.gz

  • tar xf main.tar.gz

  • rm -f main.tar.gz

  • optionally, to speed up compilation using more cores: export CMAKE_BUILD_PARALLEL_LEVEL=12

  • cd $HOME/NCrystal/ncrystal-main

  • cmake -S ./ncrystal_core -B ncrystal_build -DCMAKE_INSTALL_PREFIX=./ncrystal_install -DNCRYSTAL_ENABLE_DATA=EMBED

  • cmake --build ./ncrystal_build --target install --config Release

Modify .bashrc file in home directory

  • add the following two lines:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/NCrystal/ncrystal-main/ncrystal_install/lib

export PATH=$PATH:$HOME/NCrystal/ncrystal-main/ncrystal_install/bin

Enable NCrystal in Ants3

  • In g4ants3.pro and g4inspector.pro files, uncomment the following line by removing the starting '#' character:

CONFIG += ants3_NCrystal

Recompile Ants3

  • In QtCreator, using the "Build" menu, start "Run qmake" and then "Rebuild" for the g4ants3 and g4inspector sub-projects (if in doubts, recompile the entire project)

Enabling NCrystal in a particle simulation

  • Define at least one NCrystal material (Material window --> "Standard NCrystal material" composition option)
  • Activate NCrystal physics (Particle simulation window --> Settings tab --> "Additional model for neutrons" box --> "NCrystal" option)

Clone this wiki locally