MontePy is a python library to read, edit, and write MCNP input files.
Simply run:
pip install montepy
For more complicated setups see the Installing section in the user guide.
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.
cell = problem.cells[105]
.cell.importance.neutron = 2.0
.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")
Here a few of the known bugs and limitations:
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.