Skip to content
Some Monte Carlo tools
Python C++ Emacs Lisp Shell C Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin [r]fluka.stop scripts added Dec 4, 2019
mctools TGraph and TGraphErrors are converted by different functions Dec 11, 2019
README.md rotate3dshow.gif -> snowman.gif Dec 2, 2019
setup.py comma added Jun 19, 2019

README.md

mc-tools

Some Monte Carlo tools for MCNPX, PHITS and FLUKA

Project homepage: https://github.com/kbat/mc-tools

  • MСNРХ
    • Note: These tools are for MCNPX. MCNP6 is not fully supported since we do not use it for several reasons.
    • Emacs syntax highlighting script for MCNP
    • An implementation of application programming interface (API) to read tallies from mctal files into a Tally object. This API allows to convert mctal files into any format. It should work with any tallies except of the kcode data and tallies with perturbation records.
    • mctal2root script converts a mctal file into the ROOT format. The tallies are saved as THnSparse histograms.
    • mctal2txt script shows an example how to convert a mctal file into an easily parsable ASCII file.
    • WSSA file converters (MCNP6 is not fully supported)
      • ssw2txt converter: it converts WSSA files produced by MCNP(X) into plain text. The comments in the script explain how to derive additional information (like particle type and surface crossed) from the WSSA records.
      • ssw2root converter: it converts WSSA files produced by MСNР(X) into a ROOT ntuple. The list of aliases defined in the tree can be printed by the TTree::GetListOfAliases()::Print() method. In particular, this list shows how to get particle type and surface number. This macro shows several very simple examples how to analyse SSW files with ROOT.
        The WSSA file format depends on the MCNPX version, and currently the script has been tested with versions 2.6.0, 26b and 2.7.0.
    • A Python module to calculate atomic fractions of isotopes in a mixture for the given volume fractions of materials. Some examples can be found in mixtures.py.
  • PHITS
    • Emacs syntax highlighting script for PHITS.
    • ANGEL to ROOT converter (converts the PHITS output to ROOT) - most of the tallies are supported, but there are known bugs and limitations, should be used with care.
    • A script rotate3dshow.py which allows to animate the output of the t-3dshow tally. It runs PHITS to generate many images, so one can get a rotating video of geometry setup. Example: snowman.gif (should be viewed with an image viewer which supports GIF animation). A simplified version of this script with a detailed manual can be downloaded from the PHITS website: http://phits.jaea.go.jp/examples.html
  • FLUKA
    • Emacs syntax highlighting script for FLUKA.
    • usbsuw2root converter: it converts the USRBIN results into a TH3F histogram. Note that this tool does not directly convert the files produced by the USRBIN card, but these files must first be averaged by the $FLUTIL/usbsuw program. The resulting avereged file can be converted into ROOT by usbsuw2root. The $FLUTIL/usbsuw call is done automatically if the fluka2root general converter is used.
    • usxsuw2root converter: it converts the USRBDX results into a TH2F histogram. + see the comments for the previous item.
    • ustsuw2root converter: it converts the USRTRACK results into a TH1F histogram. + see the comments for usbsuw2root.
    • eventdat2root converter: it converts the EVENTDAT results into a TTree object.
    • fluka2root converter. We believe it's convenient to call all the previous converters from the fluka2root script. In order to understand how it works, run $FLUTIL/rfluka -N0 -M3 $FLUPRO/exmixed.inp and then execute fluka2root exmixed.inp. It creates a single ROOT file out of all FLUKA-produced data files converted into the ROOT histograms or trees.
    • plotgeom2root converter. It convertes the PLOTGEOM binary output into a TMultiGraph object.
  • Generic tools
    • A Python module to calculate atomic fractions of isotopes in a mixture for the given volume fractions of materials. Some examples can be found in mixtures.py.
    • ace2root, a converter from ACE to ROOT formats. Loops through all available cross-sections in an ACE file and saves them as TGraph objects. We use this simple script to visualise ENDF cross sections. Requires the PyNE toolkit to be installed.

Requirements

  • If you are going to use the ROOT-related scripts (file names end with *2root), you need to have ROOT to be compiled with Python support. In order to check whether the Python support in ROOT is set up correctly, say
    import ROOT
    in the Python shell. You should not see any error messages. Python 3 can be used, but the fluka2root converter requires ROOT to be compiled with Python 2. These cmake arguments allow to select Python 2 for ROOT:
    cmake -DPYTHON_EXECUTABLE="/usr/bin/python" -Dpython="ON" -Dpython3="OFF" /path/to/root/source
  • If you are going to use the ace2root converter, you also need to have the PyNE toolkit to be installed.
  • If the GNU parallel tool is installed then the FLUKA merge and ROOT converter tools called by the fluka2root script will be executed in parallel which makes it run faster.
  • Linux and MacOS are supported. We have never tried to use these tools on Windows.

Installation

mc-tools can be installed either with the python package installer pip or manually by cloning the code and setting the appropriate variables. The pip-based installation is recommended if you just intend to use the package, while the manual installation is recommended for developers.

Installation with pip

In order to use pip, you need to have git as well as the python-setuptools and python-pip modules installed on your system.

pip install git+https://github.com/kbat/mc-tools.git

You will probably have to add the ~/.local/bin folder into $PATH. Read the output generated by pip.

Uninstall: pip uninstall mc-tools.

Developer installation

  1. Get the source code:
    • either git clone https://github.com/kbat/mc-tools.git
    • or download and uncompress https://github.com/kbat/mc-tools/archive/master.zip
  2. Set the variable MCTOOLS to the folder where you have installed the code:
    export MCTOOLS=/path/to/mc-tools
  3. Add the $MCTOOLS folder into $PYTHONPATH:
    export PYTHONPATH=$MCTOOLS:$PYTHONPATH
  4. Add the $MCTOOLS/bin folder into your $PATH:
    export PATH=$MCTOOLS/bin:$PATH

Contacts

e-mail: batkov [аt] gmail.com

List of authors: Nicolò Borghi, Kazuyoshi Furutaka, Konstantin Batkov

See also

http://pyne.io

https://github.com/SAnsell/CombLayer

You can’t perform that action at this time.