GithubHelp home page GithubHelp logo

kbat / mc-tools Goto Github PK

View Code? Open in Web Editor NEW
40.0 9.0 16.0 3.83 MB

Some Monte Carlo tools

License: GNU Lesser General Public License v3.0

Python 78.44% Shell 2.73% C 0.91% Emacs Lisp 3.23% Makefile 0.55% C++ 14.13%
monte-carlo fluka phits mcnpx mcnp povray root-cern

mc-tools's Introduction

mc-tools

Some Monte Carlo tools for MCNP, MCNPX, PHITS and FLUKA

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

MСNР

  • Emacs syntax highlighting script for MCNP.
  • An implementation of application programming interface (API) to read data from mctal files. It allows to convert mctal files into any format. Known issue: tallies with perturbation records are not supported.
    • mctal2root script converts mctal to ROOT format. The tallies are saved as THnSparse histograms. The same script can convert mctal to XML format via TXMLFile.
    • mctal2txt script shows an example how to convert an mctal file into an easily parsable ASCII file.
  • WSSA file converters.
    • ssw2txt: converts WSSA phase space files 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: converts WSSA phase space files 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 gives several simple examples how to analyse SSW files with ROOT.
  • vol.py: a tool to facilitate input of volume/importance/probability values for all cells in geometry. To be used with cards like area, vol, imp, pd, dxc etc. For example, in order to set the volume of cell 5 to 3.14, cell 7 to 2.71 in a geometry of 10 cells total, run python $MCTOOLS/mctools/mcnp/vol.py -card vol -ntotal 10 -values "5 3.14 7 2.71" -default j. This generates the required data card: vol 4j 3.1 j 2.7 3j.
  • mcnpview: a wrapper around mcnp ip which allows to return to the selected geometry view in subsequent calls of the viewer. Find a detailed tutorial in the wiki section.

PHITS

  • Emacs syntax highlighting script for PHITS.
  • ANGEL to ROOT converter (converts the PHITS output into ROOT). Most of the tallies are supported with PHITS 2, but it does not really work with PHITS 3.
  • 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.
  • fluka2root tool to convert the FLUKA binary output into a ROOT file. To understand how it works, run the standard example $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.
    • A more detailed tutorial is available in the wiki section.
    • Internally, fluka2root uses the following convertes which can be called individually:
      • usbsuw2root script to convert 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 averaged file can be converted into ROOT by usbsuw2root. The $FLUTIL/usbsuw call is done automatically if the fluka2root general converter is used.
      • usxsuw2root script to convert the USRBDX results into a TH2F histogram. + see the comments for the previous item.
      • usrsuw2root script to convertert the RESNUCLEI results into a TH2F histogram and TGraphError + see the comments for usbsuw2root above. Known bug: isomer data is not saved into the ROOT file.
      • ustsuw2root script to convert the USRTRACK results into a TH1F histogram. + see the comments for usbsuw2root above.
      • eventdat2root script to convert the EVENTDAT results into a TTree object.
  • plotgeom2root script to convert 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 (a compact ENDF) to ROOT formats. It 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.
  • hplot, an advanced TH3 histogram plotter. We use it to visualise data maps and superimpose them with Monte Carlo geometry. A detailed manual can be generted with the -h argument.

Requirements

  • The ROOT-related scripts (file names end with *2root), require ROOT to be compiled with Python 3 support.
    • In order to check whether the Python support in ROOT is set up correctly, say import ROOT in the Python 3 shell. You should not see any error messages.
  • hplot requires the Boost libraries and ROOT to be compiled with at least C++17 standard.
  • ace2root needs the PyNE toolkit.
  • If the GNU parallel tool is installed then the FLUKA merge and ROOT converter tools called by the fluka2root script will use all available cores which makes them run faster.
  • Linux and MacOS are supported. We have never tried to use these tools on Windows.

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 (specify the folder containing README.md)
  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

Konstantin Batkov, batkov [аt] gmail.com

Thanks to

  • Nicolò Borghi, for implementing all my dreams in the mctal2root converter.
  • Kazuyoshi Furutaka, for adding the pip installer and helping with the PHITS tools debugging.
  • Stuart Ansell, for endless discussions and amazing ideas.

See also

https://github.com/lanl/mcnptools

https://github.com/SAnsell/CombLayer

http://pyne.io

https://github.com/Lindt8/DCHAIN-Tools

mc-tools's People

Contributors

egorve avatar furutaka avatar kbat avatar nicoloborghi avatar sansell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mc-tools's Issues

angel2root: 2D histo conversion is wrong

With mesh = xyz and a 2D axis (e.g., yz), the bin contents of TH2 are read in a 
wrong sequence. It seems this is the case only when the x- and y-axes have both 
negative and positive values. An input file example is attached.

Original issue reported on code.google.com by batkov on 20 Jan 2012 at 12:43

Attachments:

Version string for "Download ZIP"

I made the version string taken from the output of git describe --tags --long. It's OK if the tools were downloaded by doing git clone, but when the source was downloaded as a ZIP the version string becomes 0.0.0.
I think we need to add a GitHub hook to set the version string in setup.py for ZIP downloads, thought I know almost nothing about the hooks. (A negative/tempral solution would be to disable "Download ZIP")

Не запускается


Привет, надеюсь вы из России

Заранее прошу прощения за засорение, не 
знал как по другому с вами связаться

Работаю в Windows
С Питоном никогда не работал, но очень 
нужна вот эта программка для облегчения 
работы с MCNP и чуть-чуть 
проконсультироваться насчет нее (как она 
работет и что для ее работы нужно в системе)
http://mc-tools.googlecode.com/svn/trunk/mcnp/mctal2root.py

В системе давно установлен ROOT 5.24.00, MCNP

Скачал и установил Питон 2.7.2

Мои действия
1)Запустил IDLE (Python GUI)
2)File->New Window
3)Скопировал код по вот это ссылке
http://mc-tools.googlecode.com/svn/trunk/mcnp/mctal2root.py
4)Нажал F5 и вышла вот такая ошибка:

Traceback (most recent call last):
  File "C:\Users\еее\Desktop\mctal2root.py", line 5, in <module>
    from ROOT import ROOT, TFile, TH1F, TObjArray
  File "C:\root\bin\ROOT.py", line 86, in <module>
    import libPyROOT as _root
ImportError: DLL load failed: Не найден указанный модуль.

Но DLL лежит по адресу  C:\root\bin\libPyROOT.DLL

Конечно я не знаю толком что мне надо 
делать, так как с Питоном не имел дела 
вообще, так как возможно надо еще что-то 
установить, скачать, так что помоги если не 
трудно.

Мой e-mail : [email protected]

С Уважением Александр


Original issue reported on code.google.com by [email protected] on 19 Sep 2011 at 9:25

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.