MontePy API#

Base Problem#

montepy.MCNP_Problem

A class to represent an entire MCNP problem in a semantic way.

montepy.read_input

Reads the specified MCNP Input file.

Base Objects#

montepy.Cell

Object to represent a single MCNP cell defined in CSG.

montepy.Universe

Class to represent an MCNP universe, but not handle the input directly.

Collections#

montepy.Cells

A collections of multiple montepy.Cell objects.

montepy.Materials

A container of multiple Material instances.

montepy.Surfaces

A collection of multiple montepy.surfaces.surface.Surface instances.

montepy.Transforms

A container of multiple Transform instances.

montepy.Universes

A container of multiple Universe instances.

Surface Objects#

General Surface utilities#

montepy.Surface

Object to hold a single MCNP surface

montepy.HalfSpace

Class representing a geometry half_space.

montepy.UnitHalfSpace

The leaf node for the HalfSpace tree.

Cylinders#

montepy.XCylinder

Represents surface CX: an infinite cylinder whose axis is the X-axis.

montepy.YCylinder

Represents surface CY: an infinite cylinder whose axis is the Y-axis.

montepy.ZCylinder

Represents surface CZ: an infinite cylinder whose axis is the Z-axis.

montepy.CylinderOnAxis

Represents surfaces CX, CY, CZ: an infinite cylinder whose axis lies on a coordinate axis.

montepy.XCylinderParAxis

Represents surface C/X: an infinite cylinder whose axis is parallel to the X-axis, offset to \((y_0, z_0)\).

montepy.YCylinderParAxis

Represents surface C/Y: an infinite cylinder whose axis is parallel to the Y-axis, offset to \((x_0, z_0)\).

montepy.ZCylinderParAxis

Represents surface C/Z: an infinite cylinder whose axis is parallel to the Z-axis, offset to \((x_0, y_0)\).

montepy.CylinderParAxis

Represents surfaces C/X, C/Y, C/Z: an infinite cylinder whose axis is parallel to a coordinate axis but offset from it.

Planes#

montepy.XPlane

Represents surface PX: a plane normal to the X-axis.

montepy.YPlane

Represents surface PY: a plane normal to the Y-axis.

montepy.ZPlane

Represents surface PZ: a plane normal to the Z-axis.

montepy.AxisPlane

Represents surfaces PX, PY, PZ: a plane normal to a coordinate axis.

montepy.GeneralPlane

Represents surface P: a general plane.

Spheres#

montepy.SphereAtOrigin

Represents surface SO: a sphere centered at the origin.

montepy.XSphere

Represents surface SX: a sphere centered on the X-axis.

montepy.YSphere

Represents surface SY: a sphere centered on the Y-axis.

montepy.ZSphere

Represents surface SZ: a sphere centered on the Z-axis.

montepy.SphereOnAxis

Represents surfaces SX, SY, SZ: a sphere centered on a coordinate axis.

montepy.GeneralSphere

Represents surface S: a general sphere.

Cones#

montepy.XCone

Represents surface KX: a cone whose apex lies on the X-axis.

montepy.YCone

Represents surface KY: a cone whose apex lies on the Y-axis.

montepy.ZCone

Represents surface KZ: a cone whose apex lies on the Z-axis.

montepy.ConeOnAxis

Represents surfaces KX, KY, KZ: a cone whose apex lies on a coordinate axis.

montepy.XConeParAxis

Represents surface K/X: a cone whose axis is parallel to the X-axis with its apex at an arbitrary point \((x_0, y_0, z_0)\).

montepy.YConeParAxis

Represents surface K/Y: a cone whose axis is parallel to the Y-axis with its apex at an arbitrary point \((x_0, y_0, z_0)\).

montepy.ZConeParAxis

Represents surface K/Z: a cone whose axis is parallel to the Z-axis with its apex at an arbitrary point \((x_0, y_0, z_0)\).

montepy.ConeParAxis

Represents surfaces K/X, K/Y, K/Z: a cone whose axis is parallel to a coordinate axis with its apex at an arbitrary point.

Quadrics#

montepy.AxisAlignedQuadric

Represents surface SQ: an ellipsoid, hyperboloid, or paraboloid whose axes are parallel to the coordinate axes.

montepy.GeneralQuadric

Represents surface GQ: a general quadric surface (cylinder, cone, ellipsoid, hyperboloid, or paraboloid) at arbitrary orientation.

Tori#

montepy.XTorus

Represents surface TX: a torus whose axis of symmetry is the X-axis.

montepy.YTorus

Represents surface TY: a torus whose axis of symmetry is the Y-axis.

montepy.ZTorus

Represents surface TZ: a torus whose axis of symmetry is the Z-axis.

montepy.Torus

Represents surfaces TX, TY, TZ: an elliptical torus whose axis of symmetry is parallel to a coordinate axis.

Macrobodies#

montepy.Box

Represents macrobody BOX: a general orthogonal box defined by a corner point and three edge vectors.

montepy.RectangularParallelepiped

Represents macrobody RPP: an axis-aligned rectangular parallelepiped defined by min/max extents on each axis.

montepy.SphereMacrobody

Represents macrobody SPH: a sphere defined by center and radius.

montepy.RightCircularCylinder

Represents macrobody RCC: a right circular cylinder defined by a base center, height vector, and radius.

montepy.RightHexagonalPrism

Represents macrobodies RHP and HEX: a right hexagonal prism defined by a base center, height vector, and three facet vectors.

montepy.RightEllipticalCylinder

Represents macrobody REC: a right elliptical cylinder defined by a base center, height vector, and semi-axis vectors.

montepy.TruncatedRightCone

Represents macrobody TRC: a truncated right-angle cone defined by a base center, height vector, and two radii.

montepy.Ellipsoid

Represents macrobody ELL: an ellipsoid defined by two foci and a semi-major axis length.

montepy.Wedge

Represents macrobody WED: a wedge defined by a corner vertex, two base edge vectors, and a height vector.

montepy.ArbitraryPolyhedron

Represents macrobody ARB: an arbitrary convex polyhedron defined by up to 8 vertices and 6 face descriptors.

Data Inputs#

Materials#

montepy.Element

Class to represent an element e.g., Aluminum.

montepy.Library

A class to represent an MCNP nuclear data library, e.g., 80c.

montepy.Material

A class to represent an MCNP material.

montepy.Nucleus

A class to represent a nuclide irrespective of the nuclear data being used.

montepy.Nuclide

A class to represent an MCNP nuclide with nuclear data library information.

montepy.ThermalScatteringLaw

Class to hold MT Inputs

Cell Modifiers#

Note

You will rarely create these directly, rather use the corresponding property in montepy.Cell.

montepy.data_inputs.fill.Fill

Object to handle the FILL input in cell and data blocks.

montepy.data_inputs.importance.Importance

A data input that sets the importance for a cell(s).

montepy.data_inputs.lattice.LatticeType

Represents the options for the lattice LAT.

montepy.data_inputs.lattice_input.LatticeInput

Object to handle the inputs from LAT.

montepy.data_inputs.universe_input.UniverseInput

Object to actually handle the U input in cells and data blocks.

montepy.data_inputs.volume.Volume

Class for the data input that modifies cell volumes; VOL.

Misc.#

montepy.data_inputs.DataInput

Catch-all for all other MCNP data inputs.

montepy.Mode

Class for the particle mode for a problem.

montepy.Transform

Input to represent a transform input (TR).

Developer Focused Objects#

Abstract Classes#

montepy.mcnp_object.MCNP_Object

Abstract class for semantic representations of MCNP inputs.

montepy._singleton.SingletonGroup

A base class for implementing a Singleton-like data structure.

montepy.data_inputs.cell_modifier.CellModifierInput

Abstract Parent class for Data Inputs that modify cells / geometry.

montepy.data_inputs.data_input.DataInputAbstract

Parent class to describe all MCNP data inputs.

montepy.data_inputs.data_input.ForbiddenDataInput

MCNP data input that is not actually parsed and only parroted out.

montepy.numbered_mcnp_object.Numbered_MCNP_Object

An abstract class to represent an mcnp object that has a number.

montepy.numbered_object_collection.NumberedDataObjectCollection

This is a an abstract collection for numbered objects that are also Data Inputs.

montepy.numbered_object_collection.NumberedObjectCollection

A collections of MCNP objects.

montepy.mcnp_object._ExceptionContextAdder

A metaclass for wrapping all class properties and methods in add_line_number_to_exception().

montepy.input_parser.parser_base.MetaBuilder

Custom MetaClass for allowing subclassing of MCNP_Parser.

montepy.input_parser.parser_base.SLY_Supressor

This is a fake logger meant to mostly make warnings disappear.

Enumerations#

montepy.geometry_operators.Operator

Enumeration of the allowed geometry set logic.

montepy.LibraryType

Enum to represent the possible types that a nuclear data library can be.

montepy.particle.Particle

Supported MCNP supported particles.

montepy.SurfaceType

An enumeration of the surface types allowed.

montepy.input_parser.shortcuts.Shortcuts

Enumeration of the possible MCNP shortcuts.

montepy.input_parser.block_type.BlockType

An enumeration for the different blocks in an input file.

Universal Utilities and constants#

Object Builders#

montepy.data_inputs.data_parser.parse_data

Parses the data input as the appropriate object if it is supported.

montepy.input_parser.input_syntax_reader.read_input_syntax

Creates a generator function to return a new MCNP input for every new one that is encountered.

montepy.input_parser.input_syntax_reader.read_data

Reads the bulk of an MCNP file for all of the MCNP data.

montepy.input_parser.input_syntax_reader.read_front_matters

Reads the beginning of an MCNP file for all of the unusual data there.

montepy.surfaces.surface_builder.parse_surface

Builds a Surface object for the type of Surface

Type Aliases#

montepy.mcnp_object.InitInput(*args, **kwargs)#

alias of Input | str

Parser Data Types#

montepy.input_parser.input_file.MCNP_InputFile

A class to represent a distinct input file.

montepy.input_parser.mcnp_input.Input

Represents a single MCNP "Input" e.g. a single cell definition.

montepy.input_parser.mcnp_input.Jump

Class to represent a default entry represented by a "jump".

montepy.input_parser.mcnp_input.Message

Object to represent an MCNP message.

montepy.input_parser.mcnp_input.ParsingNode

Object to represent a single coherent MCNP input, such as an input.

montepy.input_parser.mcnp_input.ReadInput

A input for the read input that reads another input file

montepy.input_parser.mcnp_input.Title

Object to represent the title for an MCNP problem

montepy.input_parser.syntax_node.ClassifierNode

A node to represent the classifier for a DataInput

montepy.input_parser.syntax_node.CommentNode

Object to represent a comment in an MCNP problem.

montepy.input_parser.syntax_node.GeometryTree

A syntax tree that is a binary tree for representing CSG geometry logic.

montepy.input_parser.syntax_node.ListNode

A node to represent a list of values.

montepy.input_parser.syntax_node.MaterialsNode

A node for representing isotopes and their concentration, and the material parameters.

montepy.input_parser.syntax_node.PaddingNode

A syntax tree node to represent a collection of sequential padding elements.

montepy.input_parser.syntax_node.ParametersNode

A node to hold the parameters, key-value pairs, for this input.

montepy.input_parser.syntax_node.ParticleNode

A node to hold particles information in a ClassifierNode.

montepy.input_parser.syntax_node.ShortcutNode

A node that pretends to be a ListNode but is actually representing a shortcut.

montepy.input_parser.syntax_node.SyntaxNode

A general syntax node for handling inner tree nodes.

montepy.input_parser.syntax_node.SyntaxNodeBase

A base class for all syntax nodes.

montepy.input_parser.syntax_node.ValueNode

A syntax node to represent the leaf node.

Parsers#

montepy.input_parser.parser_base.MCNP_Parser

Base class for all MCNP parsers that provides basics.

montepy.input_parser.cell_parser.CellParser

The parser for parsing a Cell input.

montepy.input_parser.data_parser.DataParser

A parser for almost all data inputs.

montepy.input_parser.data_parser.ClassifierParser

A parser for parsing the first word or classifier of a data input.

montepy.input_parser.data_parser.ParamOnlyDataParser

A parser for parsing parameter (key-value pair) only data inputs.

montepy.input_parser.material_parser.MaterialParser

montepy.input_parser.read_parser.ReadParser

A parser for handling "read" inputs.

montepy.input_parser.surface_parser.SurfaceParser

A parser for MCNP surfaces.

montepy.input_parser.tally_parser.TallyParser

A barebone parser for parsing tallies before they are fully implemented.

montepy.input_parser.tally_seg_parser.TallySegmentParser

A barebone parser for parsing tally segment inputs before they are fully implemented.

montepy.input_parser.thermal_parser.ThermalParser

A parser for thermal scattering law inputs.

montepy.input_parser.tokens.MCNP_Lexer

Base lexer for all MCNP lexers.

montepy.input_parser.tokens.ParticleLexer

A lexer for lexing an input that has particles in it.

montepy.input_parser.tokens.CellLexer

A lexer for cell inputs that allows particles.

montepy.input_parser.tokens.DataLexer

A lexer for data inputs.

montepy.input_parser.tokens.SurfaceLexer

A lexer for Surface inputs.

Deprecated Objects#

montepy.data_inputs.isotope.Isotope

A class to represent an MCNP isotope

montepy.data_inputs.material_component.MaterialComponent

A class to represent a single component in a material.