montepy.data_inputs.nuclide module#
Classes:
|
A class to represent an MCNP nuclear data library, e.g., |
|
A class to represent a nuclide irrespective of the nuclear data being used. |
|
A class to represent an MCNP nuclide with nuclear data library information. |
Data:
How many characters wide a nuclide with spacing should be. |
- class montepy.data_inputs.nuclide.Library(library: str)#
Bases:
SingletonGroup
A class to represent an MCNP nuclear data library, e.g.,
80c
.Examples
import montepy library = montepy.Library("710nc") assert library.library == "710nc" assert str(library) == "710nc" assert library.library_type == montepy.LibraryType.NEUTRON assert library.number == 710 assert library.suffix == "c"
Note
This class is immutable, and hashable, meaning it is suitable as a dictionary key.
Added in version 1.0.0.
- Parameters:
library (str) – The name of the library.
- Raises:
TypeErrror – if a string is not provided.
ValueError – if a valid library is not provided.
Attributes:
The full name of the library.
The
LibraryType
of this library.The base number in the library.
The suffix of the library, or the final character of its definition.
- property library: str#
The full name of the library.
- Return type:
str
- property library_type: LibraryType#
The
LibraryType
of this library.This corresponds to the type of library this would specified in a material definition e.g.,
NLIB
,PLIB
, etc.See also
- Returns:
the type of library this library is.
- Return type:
- property number: int#
The base number in the library.
For example: this would be
80
for the library:Library('80c')
.- Returns:
the base number of the library.
- Return type:
int
- property suffix: str#
The suffix of the library, or the final character of its definition.
For example this would be
"c"
for the library:Library('80c')
.- Returns:
the suffix of the library.
- Return type:
str
- class montepy.data_inputs.nuclide.Nucleus(element: Element, A: int = 0, meta_state: int = 0)#
Bases:
SingletonGroup
A class to represent a nuclide irrespective of the nuclear data being used.
This is meant to be an immutable representation of the nuclide, no matter what nuclear data library is used.
U-235
is alwaysU-235
. Generally users don’t need to interact with this much as it is almost always wrapped by:montepy.data_inputs.nuclide.Nuclide
.Note
This class is immutable, and hashable, meaning it is suitable as a dictionary key.
Added in version 1.0.0.
- Parameters:
element (Element) – the element this Nucleus is based on.
A (int) – The A-number (atomic mass) of the nuclide. If this is elemental this should be 0.
meta_state (int) – The metastable state if this nuclide is isomer.
- Raises:
TypeError – if an parameter is the wrong type.
ValueError – if non-sensical values are given.
Attributes:
The A number for this isotope.
The Z number for this isotope.
The ZZZAAA identifier following MCNP convention.
The base element for this isotope.
Whether or not this is a metastable isomer.
If this is a metastable isomer, which state is it?
- property A: int#
The A number for this isotope.
- Returns:
the isotope’s mass.
- Return type:
int
- property Z: int#
The Z number for this isotope.
- Returns:
the atomic number.
- Return type:
int
- property ZAID: int#
The ZZZAAA identifier following MCNP convention.
If this is metastable the MCNP convention for ZAIDs for metastable isomers will be used.
- Return type:
int
- property element: Element#
The base element for this isotope.
- Returns:
The element for this isotope.
- Return type:
- property is_metastable: bool#
Whether or not this is a metastable isomer.
- Returns:
boolean of if this is metastable.
- Return type:
bool
- property meta_state: int#
If this is a metastable isomer, which state is it?
Can return values in the range [0,4]. The exact state number is decided by who made the ACE file for this, and not quantum mechanics. Convention states that the isomers should be numbered from lowest to highest energy. The ground state will be 0.
- Returns:
the metastable isomeric state of this “isotope” in the range [0,4].
- Return type:
int
- class montepy.data_inputs.nuclide.Nuclide(name: str | int | Element | Nucleus = '', element: Element = None, Z: int = None, A: int = 0, meta_state: int = 0, library: str = '', node: ValueNode = None)#
Bases:
object
A class to represent an MCNP nuclide with nuclear data library information.
Nuclide accepts
name
as a way of specifying a nuclide. This is meant to be more ergonomic than ZAIDs while not going insane with possible formats. This accepts ZAID and Atomic_symbol-A format. All cases support metastables as m# and a library specification. Examples include:1001.80c
92235m1.80c
92635.80c
U.80c
U-235.80c
U-235m1.80c
To be specific this must match the regular expression:
import re parser = re.compile(\"\"\" (\d{4,6}) # ZAID | ([a-z]{1,2} # or atomic symbol -?\d*) # optional A-number (m\d+)? # optional metastable (\.\d{{2,}}[a-z]+)? # optional library \"\"\", re.IGNORE_CASE | re.VERBOSE )
Note
As discussed in MCNP 6.3.0 manual § 5.6.1:
To represent a metastable isotope, adjust the AAA value using the following convention: AAA’=(AAA+300)+(m × 100), where m is the metastable level and m=1, 2, 3, or 4.
MontePy attempts to apply these rules to determine the isomeric state of the nuclide. This requires MontePy to determine if a ZAID is a realistic base isomeric state.
This is done simply by manually specifying 6 rectangles of realistic ZAIDs. MontePy checks if a ZAID is inside of these rectangles. These rectangles are defined by their upper right corner as an isotope. The lower left corner is defined by the Z-number of the previous isotope and A=0.
These isotopes are:
Cl-52
Br-101
Xe-150
Os-203
Cm-251
Og-296
Warning
Due to legacy reasons the nuclear data for Am-242 and Am-242m1 have been swapped for the nuclear data provided by LANL. This is documented in section 1.2.2 of the MCNP 6.3.1 manual :
As a historical quirk, 242m1Am and 242Am are swapped in the ZAID and SZAID formats, so that the former is 95242 and the latter is 95642 for ZAID and 1095242 for SZAID. It is important to verify if a data library follows this convention. To date, all LANL-published libraries do. The name format does not swap these isomers. As such, Am-242m1 can load a table labeled 95242.
Due to this MontePy follows the MCNP convention, and swaps these ZAIDs. If you have custom generated ACE data for Am-242, that does not follow this convention you have a few options:
Do nothing. If you do not need to modify a material in an MCNP input file the ZAID will be written out the same as it was in the original file.
Specify the Nucleus by ZAID. This will have the same effect as before. Note that MontePy will display the wrong metastable state, but will preserve the ZAID.
Open an issue. If this approach doesn’t work for you please open an issue so we can develop a better solution.
Added in version 1.0.0: This was added as replacement for
montepy.data_inputs.Isotope
.- Parameters:
name (str) – A fancy name way of specifying a nuclide.
ZAID (str) – The ZAID in MCNP format, the library can be included.
element (Element) – the element this Nucleus is based on.
Z (int) – The Z-number (atomic number) of the nuclide.
A (int) – The A-number (atomic mass) of the nuclide. If this is elemental this should be 0.
meta_state (int) – The metastable state if this nuclide is isomer.
library (str) – the library to use for this nuclide.
node (ValueNode) – The ValueNode to build this off of. Should only be used by MontePy.
- Raises:
TypeError – if a parameter is the wrong type.
ValueError – if non-sensical values are given.
Methods:
Get the ZAID identifier of the base isotope this is an isomer of.
mcnp_str
()Returns an MCNP formatted representation.
Creates a human readable version of this nuclide excluding the data library.
Attributes:
The A number for this isotope.
The Z number for this isotope.
The ZZZAAA identifier following MCNP convention
The base element for this isotope.
Whether or not this is a metastable isomer.
The MCNP library identifier e.g. 80c.
If this is a metastable isomer, which state is it?
The base nuclide of this nuclide without the nuclear data library.
- get_base_zaid() int #
Get the ZAID identifier of the base isotope this is an isomer of.
This is mostly helpful for working with metastable isomers.
- Returns:
the mcnp ZAID of the ground state of this isotope.
- Return type:
int
- mcnp_str() str #
Returns an MCNP formatted representation.
E.g., 1001.80c
- Returns:
a string that can be used in MCNP
- Return type:
str
- nuclide_str() str #
Creates a human readable version of this nuclide excluding the data library.
This is of the form Atomic symbol - A [metastable state]. e.g.,
U-235m1
.- Return type:
str
- property A: int#
The A number for this isotope.
- Returns:
the isotope’s mass.
- Return type:
int
- property Z: int#
The Z number for this isotope.
- Returns:
the atomic number.
- Return type:
int
- property ZAID: int#
The ZZZAAA identifier following MCNP convention
- Return type:
int
- property element: Element#
The base element for this isotope.
- Returns:
The element for this isotope.
- Return type:
- property is_metastable: bool#
Whether or not this is a metastable isomer.
- Returns:
boolean of if this is metastable.
- Return type:
bool
- property meta_state: int#
If this is a metastable isomer, which state is it?
Can return values in the range [0,4]. 0 corresponds to the ground state. The exact state number is decided by who made the ACE file for this, and not quantum mechanics. Convention states that the isomers should be numbered from lowest to highest energy.
- Returns:
the metastable isomeric state of this “isotope” in the range [0,4]l
- Return type:
int
- montepy.data_inputs.nuclide.DEFAULT_NUCLIDE_WIDTH = 11#
How many characters wide a nuclide with spacing should be.