From 79cf144e505b49b94add6b9cab1be1d8e2267c17 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Tue, 28 Jan 2025 09:36:31 -0600 Subject: [PATCH 01/13] Added testing status badge. --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0ef35cdf..3490be62 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,15 @@ [![license](https://img.shields.io/github/license/idaholab/MontePy.svg)](https://github.com/idaholab/MontePy/blob/develop/LICENSE) [![JOSS article status](https://joss.theoj.org/papers/e5b5dc8cea19605a1507dd4d420d5199/status.svg)](https://joss.theoj.org/papers/e5b5dc8cea19605a1507dd4d420d5199) -[![Coverage Status](https://coveralls.io/repos/github/idaholab/MontePy/badge.svg?branch=develop)](https://coveralls.io/github/idaholab/MontePy?branch=develop) [![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) +[![Coverage Status](https://coveralls.io/repos/github/idaholab/MontePy/badge.svg?branch=develop)](https://coveralls.io/github/idaholab/MontePy?branch=develop) +[![Testing status](https://github.com/idaholab/MontePy/actions/workflows/main.yml/badge.svg?branch=develop)](https://github.com/idaholab/MontePy/actions/workflows/main.yml) +[![Docs Deployment](https://github.com/idaholab/MontePy/actions/workflows/deploy.yml/badge.svg?branch=main)](https://www.montepy.org/) + [![PyPI version](https://badge.fury.io/py/montepy.svg)](https://badge.fury.io/py/montepy) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/montepy.svg)](https://anaconda.org/conda-forge/montepy) -[![Docs Deployment](https://github.com/idaholab/MontePy/actions/workflows/deploy.yml/badge.svg?branch=main)](https://www.montepy.org/) [![PyPI pyversions](https://img.shields.io/pypi/pyversions/montepy.svg)](https://pypi.org/project/montepy/) From f0f392aff6f33e1700d6f12485d8cd8015ea4926 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Tue, 28 Jan 2025 09:38:24 -0600 Subject: [PATCH 02/13] Limit CI action link to develop. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3490be62..cc09c9fb 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![Coverage Status](https://coveralls.io/repos/github/idaholab/MontePy/badge.svg?branch=develop)](https://coveralls.io/github/idaholab/MontePy?branch=develop) -[![Testing status](https://github.com/idaholab/MontePy/actions/workflows/main.yml/badge.svg?branch=develop)](https://github.com/idaholab/MontePy/actions/workflows/main.yml) +[![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) [![Docs Deployment](https://github.com/idaholab/MontePy/actions/workflows/deploy.yml/badge.svg?branch=main)](https://www.montepy.org/) [![PyPI version](https://badge.fury.io/py/montepy.svg)](https://badge.fury.io/py/montepy) From 578dfe7abca10cb13cd593ba9d51d2501bd2df8b Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Tue, 28 Jan 2025 19:42:04 -0600 Subject: [PATCH 03/13] Added demo testing as part of develop --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 81c014c1..c810f393 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,7 +64,7 @@ build = [ "setuptools-scm>=8", ] develop = [ - "montepy[test,doc,format]", + "montepy[test,doc,format,demo-test]", ] demos = ["jupyter"] demo-test = ["montepy[demos]", "papermill"] From 1ce8ccbc3305f72984409bfddbed33de2ba7fd41 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Tue, 28 Jan 2025 19:42:56 -0600 Subject: [PATCH 04/13] Documented optional dependencies. --- doc/source/starting.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/doc/source/starting.rst b/doc/source/starting.rst index 5d0cafbc..a6cd32c5 100644 --- a/doc/source/starting.rst +++ b/doc/source/starting.rst @@ -46,6 +46,31 @@ System Wide (for the current user) #. Install it from `PyPI `_ by running ``pip install montepy``. You may need to run ``pip install --user montepy`` if you are not allowed to install the package. +Installing Optional Dependencies +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +MontePy offers multiple optional dependencies which some users may desire, +though this is mostly intended for developers. +Pip can install these through the following command: + +``pip install montepy[]`` + +Where ```` is one of the following options: + +#. ``demos``: installs the dependencies for running the demo problems in `jupyter `_. + +#. ``doc``: installs the dependencies for building the website using `sphinx `_. + +#. ``build``: installs the dependencies for building the source distribution packages. + +#. ``format``: install the dependencies for formatting the code with `black `_. + +#. ``test``: installs the dependencies for testing the software. + +#. ``demo-test``: installs the dependencies for testing the demos. + +#. ``develop``: installs everything a developer may need, specifically: ``montepy[test,doc,format,demo-test]``. + Install specific version for a project ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The best way maybe to setup a project-specific `conda `_, From 4771a05471f40f74affd4cae5ef7cede3ecc2932 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Wed, 29 Jan 2025 07:51:04 -0600 Subject: [PATCH 05/13] Updated canonical URL for RTD multi-version. --- doc/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 84bc7163..90b9d9f4 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -53,7 +53,7 @@ ] html_logo = "monty.svg" -html_baseurl = "https://www.montepy.org/" +html_baseurl = "https://www.montepy.org/en/stable/" html_extra_path = ["robots.txt", "foo.imcnp"] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. From a573277e1a66738854c5c1dbe1c1155ca0ba206d Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Wed, 29 Jan 2025 11:23:33 -0600 Subject: [PATCH 06/13] Switched to black 25. --- montepy/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/montepy/__init__.py b/montepy/__init__.py index 12f3b791..0e77fbde 100644 --- a/montepy/__init__.py +++ b/montepy/__init__.py @@ -1,5 +1,5 @@ # Copyright 2024, Battelle Energy Alliance, LLC All Rights Reserved. -""" MontePy is a library for reading, editing, and writing MCNP input files. +"""MontePy is a library for reading, editing, and writing MCNP input files. This creates a semantic understanding of the MCNP input file. start by running montepy.read_input(). From ad08bcf4acc2ae365158c9126226909d765ee580 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Wed, 29 Jan 2025 17:13:44 -0600 Subject: [PATCH 07/13] Fake change to make CI happy. --- doc/source/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/changelog.rst b/doc/source/changelog.rst index 010c3879..5e424292 100644 --- a/doc/source/changelog.rst +++ b/doc/source/changelog.rst @@ -5,7 +5,7 @@ MontePy Changelog 0.5 releases ============ -#Next Release# +#Next Release# -------------- **Bug Fixes** From 8fbaf1e46192bdbe1ceb34ccaeee420af5856823 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Sun, 2 Feb 2025 21:44:14 -0600 Subject: [PATCH 08/13] added reference to MCKIT --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cc09c9fb..7b1d54e2 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ 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, +Many of the competitors do not offer the robustness that MontePy does because, they do not utilize context-free parsing (as of 2024). These packages are: @@ -114,12 +114,19 @@ These packages are: * [numjuggler](https://github.com/inr-kit/numjuggler) -The only other library that does utilize context-free parsing that we are aware is -[MCNP™y](https://github.rpi.edu/NuCoMP/mcnpy). MontePy differs by being: +The only other libraries that do utilize context-free parsing that we are aware of are: +* [MCNPy](https://github.rpi.edu/NuCoMP/mcnpy) +* [mckit](https://github.com/MC-kit/mckit) + +MontePy differs from MCNPy by being: * On PyPI, and can be installed via pip. * Only requires a python interpreter, and not a Java virtual machine. * Allowing contributions from anyone with a public GitHub account +MontePy differs from mckit by being: +* thoroughly documented +* Object-Oriented + 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, From bfe7e944016a343d19d2bb974f709cd335c7ca8a Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Fri, 7 Feb 2025 15:59:08 -0600 Subject: [PATCH 09/13] Fixed typo in sphinx syntax. --- doc/source/starting.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/starting.rst b/doc/source/starting.rst index a6cd32c5..97c39b52 100644 --- a/doc/source/starting.rst +++ b/doc/source/starting.rst @@ -875,13 +875,13 @@ If you want to try to troubleshoot errors in python you can do this with the fol This following guide may return an incomplete problem object that may break in very wierd ways. Never use this for actual file editing; only use it for troubleshooting. -1. Setup a new Problem object: +#. Setup a new Problem object: .. testcode:: problem = montepy.MCNP_Problem("foo.imcnp") -1. Next load the input file with the ``check_input`` set to ``True``. +#. Next load the input file with the ``check_input`` set to ``True``. .. testcode:: From 97bf64747fcdeeae92653cd39035918702e73e76 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sat, 8 Feb 2025 18:35:00 -0600 Subject: [PATCH 10/13] Specified surface type in demos. --- doc/source/starting.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/source/starting.rst b/doc/source/starting.rst index 97c39b52..72bec029 100644 --- a/doc/source/starting.rst +++ b/doc/source/starting.rst @@ -617,19 +617,33 @@ Order of precedence and grouping is automatically handled by Python so you can e .. testcode:: + import montepy.surfaces as surfs + import montepy.surfaces.surface_type import SurfaceType + # build blank surfaces bottom_plane = montepy.surfaces.axis_plane.AxisPlane() + bottom_plane.surface_type = SurfaceType.PZ bottom_plane.location = 0.0 + top_plane = montepy.surfaces.axis_plane.AxisPlane() + top_plane.surface_type = SurfaceType.PZ top_plane.location = 10.0 + fuel_cylinder = montepy.surfaces.cylinder_on_axis.CylinderOnAxis() + fuel_cylinder.surface_type = SurfaceType.CZ fuel_cylinder.radius = 1.26 / 2 + clad_cylinder = montepy.surfaces.cylinder_on_axis.CylinderOnAxis() clad_cylinder.radius = (1.26 / 2) + 1e-3 # fuel, gap, cladding + clad_cylinder.surface_type = SurfaceType.CZ + clad_od = montepy.surfaces.cylinder_on_axis.CylinderOnAxis() clad_od.radius = clad_cylinder.radius + 0.1 # add thickness + clad_od.surface_type = SurfaceType.CZ other_fuel = montepy.surfaces.cylinder_on_axis.CylinderOnAxis() other_fuel.radius = 3.0 + other_fuel_region.surface_type = SurfaceType.CZ + bottom_plane.number = 1 top_plane.number = 2 fuel_cylinder.number = 3 From acb31ae30bbcf134ccb1c4c93a707b268e60705a Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sat, 8 Feb 2025 19:50:00 -0600 Subject: [PATCH 11/13] Added guide to setting boundary conditions. --- doc/source/starting.rst | 57 ++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 12 deletions(-) diff --git a/doc/source/starting.rst b/doc/source/starting.rst index 72bec029..44687b28 100644 --- a/doc/source/starting.rst +++ b/doc/source/starting.rst @@ -426,18 +426,6 @@ So there is a convenient way to update a surface, but how do you easily get the For instance what if you want to shift a cell up in Z by 10 cm? It would be horrible to have to get each surface by their number, and hoping you don't change the numbers along the way. -One way you might think of is: oh let's just filter the surfaces by their type?: - -.. testcode:: - - for surface in cell.surfaces: - if surface.surface_type == montepy.surfaces.surface_type.SurfaceType.PZ: - surface.location += 10 - -Wow that's rather verbose. -This was the only way to do this with the API for awhile. -But MontePy 0.0.5 fixed this with: you guessed it: generators. - The :class:`~montepy.surface_collection.Surfaces` collection has a generator for every type of surface in MCNP. These are very easy to find: they are just the lower case version of the MCNP surface mnemonic. @@ -448,6 +436,51 @@ This previous code is much simpler now: for surface in cell.surfaces.pz: surface.location += 10 +Setting Boundary Conditions +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +As discussed in :manual63:`5.3.1` surfaces can have three boundary conditions: + +* Reflective boundary +* White boundary +* periodic boundary + +.. note:: + + Vacuum boundary conditions are the fourth type. + They are defined by cells with 0 importance though. + +The reflective and white boundary conditions are easiest to set as they are Boolean conditions. +These are controlled by :func:`~montepy.surfaces.surface.Surface.is_reflecting` and +:func:`~montepy.surfaces.surface.Surface.is_white_boundary` respectively. +For Example: + +.. testcode:: + + bottom = montepy.surfaces.axis_plane.AxisPlane() + bottom.surface_type = SurfaceType.PZ + bottom.is_reflecting = True + + cyl = montepy.surfaces.cylinder_on_axis.CylinderOnAxis() + cyl.surface_type = SurfaceType.CZ + cyl.is_white_boundary = True + + +Setting a periodic boundary is slightly more difficult. +In this case the boundary condition must be set to the other periodic surface with :func:`~montepy.surfaces.surface.Surface.periodic_surface`. +So to continue with the previous example: + +.. testcode:: + + bottom.location = 0.0 + bottom.is_reflecting = False + + top = montepy.surfaces.axis_plane.AxisPlane() + top.surface_type = SurfaceType.PZ + top.location = 1.26 + + bottom.periodic_surface = top + Cells ----- From 329937b02864192953f1a5c3446a0b6fbcdb824f Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sat, 8 Feb 2025 21:13:12 -0600 Subject: [PATCH 12/13] Fixed bugs in getting started. --- doc/source/starting.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/source/starting.rst b/doc/source/starting.rst index 44687b28..8ffc69d0 100644 --- a/doc/source/starting.rst +++ b/doc/source/starting.rst @@ -457,6 +457,8 @@ For Example: .. testcode:: + from montepy.surfaces.surface_type import SurfaceType + bottom = montepy.surfaces.axis_plane.AxisPlane() bottom.surface_type = SurfaceType.PZ bottom.is_reflecting = True @@ -651,7 +653,7 @@ Order of precedence and grouping is automatically handled by Python so you can e .. testcode:: import montepy.surfaces as surfs - import montepy.surfaces.surface_type import SurfaceType + from montepy.surfaces.surface_type import SurfaceType # build blank surfaces bottom_plane = montepy.surfaces.axis_plane.AxisPlane() @@ -675,7 +677,7 @@ Order of precedence and grouping is automatically handled by Python so you can e clad_od.surface_type = SurfaceType.CZ other_fuel = montepy.surfaces.cylinder_on_axis.CylinderOnAxis() other_fuel.radius = 3.0 - other_fuel_region.surface_type = SurfaceType.CZ + other_fuel.surface_type = SurfaceType.CZ bottom_plane.number = 1 top_plane.number = 2 From 8c93ecb25ed1639b2d7bb804d58e5af9a5670c83 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Sat, 8 Feb 2025 21:16:29 -0600 Subject: [PATCH 13/13] Added info about demos and development priorities. --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 7b1d54e2..3726aad5 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,8 @@ for surface in problem.surfaces: problem.write_problem("foo_update.imcnp") ``` +For more examples see the [getting started guide](https://www.montepy.org/en/stable/starting.html). + ## Limitations Here a few of the known bugs and limitations: @@ -98,6 +100,16 @@ 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. +## Current Development Priorities + +Here are the rough development priorities for adding new features to MontePy: + +#. Redesign the `Material` interface to be more user friendly. +#. Implement support for tallies. +#. Implement support for source definitions. + +If 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). + ## Alternatives There are some python packages that offer some of the same features as MontePy,