idaholab / MontePy

MontePy is a Python library (API) to read, edit, and write MCNP input files.
https://www.montepy.org/
MIT License
25 stars 6 forks source link
api mcnp mcnp6 monte-carlo neutronics radiation-transport

MontePy

MontePY: a cute snek on a red over white circle

license JOSS article status Coverage Status PyPI version

MontePy is a python library to read, edit, and write MCNP input files.

Installing

Simply run:

pip install montepy

For more complicated setups see the Installing section in the user guide.

User Documentation

MontePy has a sphinx website. This has a getting started guide for users, as well as API documentation. There is also a developer's guide covering the design and approach of MontePy, and how to contribute.

Features

Quick example for renumbering all of the cells in a problem:

import montepy
foo = montepy.read_input("foo.imcnp")
i = 9500
for cell in foo.cells:
  cell.number = i
  i = i + 5

foo.write_to_file("foo_update.imcnp")

Limitations

Here a few of the known bugs and limitations:

Bugs, Requests and Development

So MontePy doesn't do what you want? Right now development is done with a Just-In-Time development approach, as in features are added JIT for a developer to use them on my current projects. If there's a feature you want add an issue here with the feature request tag. If you want to add a feature on your own talk to Micah Gale (but still add the issue). The system is very modular and you should be able to develop it pretty quickly. Also read the developer's guide.

Finally: make objects not regexes!