Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
MontePy is the most user friendly Python library for reading, editing, and writing MCNP input files.
Simply run:
pip install montepy
For more complicated setups see the Installing section in the user guide.
MontePy has a website documenting how to work with MCNP in python with MontePy. The website contains a user's guide for getting started, a developer's guide covering the design and approach of MontePy, instructions for contributing, and the Python API documentation.
Handles almost all MCNP input syntax.
Parses Cells, Surfaces, Materials, and Transforms very well.
Can parse all surface types except macrobody facets (Issue #354).
Can read and write out all other MCNP inputs, even if it doesn't not understand them
Attempts to write out the MCNP problem verbatim, even matching the original user formatting. (See some of the open issues.)
Can quickly access cells, surfaces, and materials by their numbers. For example: cell = problem.cells[105]
.
Can quickly update cell parameters, such as importances. For example cell.importance.neutron = 2.0
.
Can easily create universes, and fill other cells with universes.
Currently has over 550 test cases.
Here is a quick example showing multiple tasks in MontePy:
import montepy
# read in file
problem = montepy.read_input("tests/inputs/test.imcnp")
# set photon importance for multiple cells
importances = {1: 0.005,
2: 0.1,
3: 1.0,
99: 1.235
}
for cell_num, importance in importances.items():
problem.cells[cell_num].importance.photon = importance
#create a universe and fill another cell with it
universe = montepy.Universe(123)
problem.universes.append(universe)
# add all cells with numbers between 1 and 4
universe.claim(problem.cells[1:5])
# fill cell 99 with universe 123
problem.cells[99].fill.universe = universe
# update all surfaces numbers by adding 1000 to them
for surface in problem.surfaces:
surface.number += 1000
# all cells using these surfaces will be automatically updated as well
#write out an updated file
problem.write_problem("foo_update.imcnp")
Here a few of the known bugs and limitations:
M1 1001.80c 1.0 plib=80p
can be parsed.M1 plib=80p 1001.80c 1.0
cannot be parsed; despite it being a valid input.There are some python packages that offer some of the same features as MontePy, but don't offer the same level of robustness, ease of installation, and user friendliness.
Many of the competitors do not offer the robustness that MontePy does becuase, they do not utilize context-free parsing (as of 2024). These packages are:
The only other library that does utilize context-free parsing that we are aware is MCNP™y. MontePy differs by being:
For only writing, or templating an input file there are also some great tools out there. These packages don't provide the same functionality as MontePy inherently, but could be the right tool for the job depending on the user's needs.
Another honorable mention that doesn't replicate the features of MontePy, but could be a great supplement to MontePy for defining materials, performing activations, etc. is PyNE --- the Nuclear Engineering Toolkit.
So MontePy doesn't do what you want? Add an issue here with the "feature request" tag. The system is very modular and you should be able to develop it pretty quickly. Read the developer's guide for more details. If you have any questions feel free to ask @micahgale.
For citing MontePy in a publication a Journal of Open Source Software article is under review. In the meantime there is a DOI for the software from OSTI: DOI:10.11578/dc.20240115.1.
You can cite MontePy as:
M. Gale, T. Labossiere-Hickman, B. Carbno, A. Bascom, and MontePy contributors, "MontePy", 2024, doi: 10.11578/dc.20240115.1.
FAQs
A library for reading, editing, and writing MCNP input files
We found that montepy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.