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.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.

Cylinders#

montepy.CylinderParAxis

Represents surfaces: C/X, C/Y, C/Z

montepy.CylinderOnAxis

Represents surfaces: CX, CY, CZ

Planes#

montepy.GeneralPlane

Represents P

montepy.AxisPlane

Represents PX, PY, PZ

Data Inputs#

Materials#

montepy.Element

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

montepy.Material

A class to represent an MCNP material.

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.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.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 dissapear.

Enumerations#

montepy.geometry_operators.Operator

Enumeration of the allowed geometry set logic.

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

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 montepy.data_input.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.