{"id":13574474,"url":"https://github.com/idaholab/montepy","last_synced_at":"2025-04-09T09:09:14.819Z","repository":{"id":217319908,"uuid":"741211308","full_name":"idaholab/MontePy","owner":"idaholab","description":"MontePy is the most user friendly Python library (API) to read, edit, and write MCNP input files.","archived":false,"fork":false,"pushed_at":"2024-10-30T00:47:36.000Z","size":3039,"stargazers_count":32,"open_issues_count":107,"forks_count":6,"subscribers_count":6,"default_branch":"develop","last_synced_at":"2024-10-30T02:44:25.139Z","etag":null,"topics":["api","mcnp","mcnp6","monte-carlo","neutronics","radiation-transport"],"latest_commit_sha":null,"homepage":"https://www.montepy.org/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/idaholab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.rst","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-09T23:30:28.000Z","updated_at":"2024-10-29T23:45:52.000Z","dependencies_parsed_at":"2024-01-18T01:04:09.320Z","dependency_job_id":"1283f6bc-efe3-4fd5-ae5a-23b51c37eef5","html_url":"https://github.com/idaholab/MontePy","commit_stats":{"total_commits":2797,"total_committers":10,"mean_commits":279.7,"dds":0.09259921344297461,"last_synced_commit":"5a12a285e174088f81418a09daa90ab6b4827769"},"previous_names":["idaholab/montepy"],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idaholab%2FMontePy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idaholab%2FMontePy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idaholab%2FMontePy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idaholab%2FMontePy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idaholab","download_url":"https://codeload.github.com/idaholab/MontePy/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248008630,"owners_count":21032556,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","mcnp","mcnp6","monte-carlo","neutronics","radiation-transport"],"created_at":"2024-08-01T15:00:51.924Z","updated_at":"2025-04-09T09:09:14.812Z","avatar_url":"https://github.com/idaholab.png","language":"Python","funding_links":[],"categories":["Particle Transport"],"sub_categories":["Related Tools"],"readme":"# MontePy\n\n\u003cimg src=\"https://raw.githubusercontent.com/idaholab/MontePy/develop/graphics/monty.svg\" width=\"180\" alt=\"MontePY: a cute snek on a red over white circle\"/\u003e\n\n[![license](https://img.shields.io/github/license/idaholab/MontePy.svg)](https://github.com/idaholab/MontePy/blob/develop/LICENSE)\n[![JOSS article status](https://joss.theoj.org/papers/e5b5dc8cea19605a1507dd4d420d5199/status.svg)](https://joss.theoj.org/papers/e5b5dc8cea19605a1507dd4d420d5199)\n[![pyOpenSci Peer-Reviewed](https://pyopensci.org/badges/peer-reviewed.svg)](https://github.com/pyOpenSci/software-review/issues/205)\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n\n\n[![Coverage Status](https://coveralls.io/repos/github/idaholab/MontePy/badge.svg?branch=develop)](https://coveralls.io/github/idaholab/MontePy?branch=develop)\n[![Testing status](https://github.com/idaholab/MontePy/actions/workflows/main.yml/badge.svg?branch=develop)](https://github.com/idaholab/MontePy/actions/workflows/main.yml?query=branch%3Adevelop)\n[![Docs Deployment](https://github.com/idaholab/MontePy/actions/workflows/deploy.yml/badge.svg?branch=main)](https://www.montepy.org/)\n\n[![PyPI version](https://badge.fury.io/py/montepy.svg)](https://badge.fury.io/py/montepy)\n[![Conda Version](https://img.shields.io/conda/vn/conda-forge/montepy.svg)](https://anaconda.org/conda-forge/montepy)\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/montepy.svg)](https://pypi.org/project/montepy/)\n\n[![DOI](https://zenodo.org/badge/DOI/10.11578/dc.20240115.1.svg)](https://zenodo.org/records/15058701)\n\n\nMontePy is the most user-friendly Python library for reading, editing, and writing MCNP input files. \n\n## Installing\n\nSimply run:\n\n```\npip install montepy\n```\n\nFor more complicated setups\nsee the [Installing section in the user guide](https://www.montepy.org/en/stable/starting.html#installing).\n\n\n## User Documentation\n\nMontePy has a website [documenting how to work with MCNP in python with MontePy](https://www.montepy.org/). \nThe website contains a user's guide for getting started, \na developer's guide covering the design and approach of MontePy,\ninstructions for contributing, \nand the Python API documentation.\n\n## Features\n\t\n* Handles almost all MCNP input syntax.\n* Parses Cells, Surfaces, Materials, and Transforms very well.\t\n* Can parse all surface types except macrobody facets ([Issue #354](https://github.com/idaholab/MontePy/issues/354)).\n* Can read and write out all other MCNP inputs, even if it does not understand them\t.\n* Attempts to write out the MCNP problem verbatim, even matching the original user formatting. (See some of the [open issues](https://github.com/idaholab/MontePy/issues).)\n* Can quickly [access cells, surfaces, and materials by their numbers](https://www.montepy.org/en/stable/starting.html#collections-are-accessible-by-number). For example: `cell = problem.cells[105]`.\n* Can quickly update cell parameters, [such as importances](https://www.montepy.org/en/stable/starting.html#setting-cell-importances). For example `cell.importance.neutron = 2.0`.\n* Can easily [create universes, and fill other cells with universes](https://www.montepy.org/en/stable/starting.html#universes).\n* Currently has over 800 test cases.\n\n \nHere is a quick example showing multiple tasks in MontePy:\n\n\n```python\nimport montepy\n# read in file\nproblem = montepy.read_input(\"tests/inputs/test.imcnp\")\n  \n# set photon importance for multiple cells\nimportances = {1: 0.005,\n   2: 0.1,\n   3: 1.0,\n   99: 1.235\n}\nfor cell_num, importance in importances.items():\n   problem.cells[cell_num].importance.photon = importance\n\n#create a universe and fill another cell with it\nuniverse = montepy.Universe(123)\nproblem.universes.append(universe)\n# add all cells with numbers between 1 and 4\nuniverse.claim(problem.cells[1:5])\n# fill cell 99 with universe 123\nproblem.cells[99].fill.universe = universe\n\n# update all surfaces numbers by adding 1000 to them\nfor surface in problem.surfaces:\n   surface.number += 1000\n# all cells using these surfaces will be automatically updated as well\n\n#write out an updated file\nproblem.write_problem(\"foo_update.imcnp\")\n```\n\nFor more examples see the [getting started guide](https://www.montepy.org/en/stable/starting.html).\n\n## Limitations\n\nHere a few of the known bugs and limitations:\n\n\t\n* Cannot handle vertical input mode.\n* Does not support editing tallies in a user-friendly way.\n* Does not support editing source definition in a user-friendly way.\n* Cannot parse all valid material definitions. There is a known bug ([#182](https://github.com/idaholab/MontePy/issues/182)) that MontePy can only parse materials where all\n    keyword-value pairs show up after the nuclide definitions. For example:\n   * `M1 1001.80c 1.0 plib=80p` can be parsed.\n   * `M1 plib=80p 1001.80c 1.0` cannot be parsed; despite it being a valid input.\n\n## Current Development Priorities\n\nHere are the rough development priorities for adding new features to MontePy:\n\n1. Improve performance for the intial loading of models.\n2. Implement support for tallies.\n1. Implement support for source definitions.\n\nIf you have a specific feature priority that you would be willing to collaborate on you can open an issue or email us at [mgale@montepy.org](mailto:mgale@montepy.org). \n\n## Alternatives\n\nThere are some python packages that offer some of the same features as MontePy,\n    but don't offer the same level of robustness, ease of installation, and user friendliness.\n\n\nMany of the competitors do not offer the robustness that MontePy does because,\n    they do not utilize context-free parsing (as of 2024). \nThese packages are:\n\n* [pyMCNP](https://github.com/FSIBT/PyMCNP)\n\n* [MCNP-Input-Reader](https://github.com/ENEA-Fusion-Neutronics/MCNP-Input-Reader)\n\n* [numjuggler](https://github.com/inr-kit/numjuggler)\n\nThe only other libraries that do utilize context-free parsing that we are aware of are:\n* [MCNPy](https://github.rpi.edu/NuCoMP/mcnpy)\n* [mckit](https://github.com/MC-kit/mckit) \n\nMontePy differs from MCNPy by being:\n\n* On PyPI and conda-forge, and able to be installed via `pip` or `conda`\n* Only requiring a Python interpreter and not a Java virtual machine\n* Allowing contributions from anyone with a public GitHub account\n\nMontePy differs from mckit by being:\n* Thoroughly documented\n* Object-oriented \n\n\nFor only writing, or templating an input file there are also some great tools out there. \nThese packages don't provide the same functionality as MontePy inherently,\n    but could be the right tool for the job depending on the user's needs.\n\n* [Workflow and Template Toolkit for Simulation (WATTS)](https://github.com/watts-dev/watts)\n* [Advanced Reactor Modeling Interface (ARMI)](https://github.com/terrapower/armi)\n\nAnother honorable mention that doesn't replicate the features of MontePy,\n    but could be a great supplement to MontePy for defining materials, performing activations, etc.\n    is [PyNE --- the Nuclear Engineering Toolkit](https://pyne.io/).\n\t\n## Bugs, Requests and Development\n\nSo MontePy doesn't do what you want? \nAdd an issue here with the \"feature request\" tag. \nThe system is very modular and you should be able to develop it pretty quickly.\nRead the [developer's guide](https://www.montepy.org/en/stable/developing.html) for more details.\nIf you have any questions feel free to ask [@micahgale](mailto:mgale@montepy.org).\n\n## Citation\n\nFor citing MontePy in a publication a [Journal of Open Source Software](https://joss.readthedocs.io/en/latest/) article is under review. \nIn the meantime there is a DOI for the software from [OSTI](https://osti.gov): [DOI:10.11578/dc.20240115.1](https://doi.org/10.11578/dc.20240115.1).\n\nYou can cite MontePy as:\n\n\u003e M. Gale, T. Labossiere-Hickman, B. Carbno, A. Bascom, and MontePy contributors, \"MontePy\", 2024, [doi: 10.11578/dc.20240115.1](https://doi.org/10.11578/dc.20240115.1).\n\n\n \n# Finally: make objects, not regexes!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidaholab%2Fmontepy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidaholab%2Fmontepy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidaholab%2Fmontepy/lists"}