Skip to content
Some Monte Carlo tools
Branch: master
Clone or download
Konstantin Batkov
Konstantin Batkov BF: no-footer stores true
Latest commit f4c136e May 16, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
mctools BF: no-footer stores true May 16, 2019
README.md README updated Apr 26, 2019
setup.py Merge branch 'master' of https://github.com/furutaka/mc-tools into fu… Apr 26, 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.
    • The mctal2root script shows an example how to save a mctal file in the ROOT format.
    • 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: rotate3dshow.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 be processed by the $FLUTIL/usbsuw program which averages results and calculates statistical errors. The resulting 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 the first item.
    • 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.
  • 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 (*2root), you need to have ROOT to be compiled with Python support. Follow this manual for more details. To check whether the Python support is set up correctly, say
    import ROOT
    in the Python shell. You should not see any error messages. The fluka2root converter requires ROOT to be compiled with Python 2. These cmake arguments allow to select Python 2 for ROOT: -DPYTHON_EXECUTABLE=/usr/bin/python2 -Dpython=ON
  • If you are going to use the ace2root converter, you also need to have the PyNE toolkit to be installed.

Installation

Linux and MacOS are supported. We have never tried to use these tools on Windows.

mc-tools can be installed either with the python package installer pip or by clonning with git. The pip-based installation is recommended if you just intend to use the package, while the git-based installation is recommended if you are going to contribute in the mc-tools development.

Installation with pip

In order to use pip, you need to have 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 with git

  1. Get the source code:
    git clone https://github.com/kbat/mc-tools.git

  2. Set the variable MCTOOLS to the folder where you have installed the code. For instance:
    export MCTOOLS=/path/to/mc-tools

  3. Update your PYTHONPATH (add this line in ~/.bashrc in order to save this setting for your future sessions):
    export PYTHONPATH=$MCTOOLS:$PYTHONPATH

    Now you need to make your system to be aware where the scrips you are going to use are located. You can do it as you like. The following steps describe an example how to do it.

  4. Add symbolic links to the scrips which you need to use into a folder in your $PATH, i.e. ln -s $MCTOOLS/mctools/mcnp/mctal2root.py ~/bin/mctal2root

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.