Deck
The over-arching structure of the MCNP model that contains all other cards. In MCNPy, each card becomes a Python object that can be added to (or removed from) an instance of mcnpy.Deck. This is simplified with operators.
Operator |
Syntax |
Function |
|---|---|---|
Add card to deck |
|
|
Remove card from deck |
|
|
Operator |
Syntax |
Function |
|---|---|---|
Add card to deck |
|
|
Remove card from deck |
|
|
Note
card is any MCNPy object that is a standalone MCNP card. list is a list of cards.
- class mcnpy.Deck(cells=None, surfaces=None, materials=None, geom_settings=None, mat_settings=None, out_settings=None, misc_settings=None, src_settings=None, phys_settings=None, vr_settings=None, tally_settings=None, tallies=None, term_settings=None, settings=None, transformations=None, universes=None, continue_run=None)[source]
Bases:
objectAn object containing dicts for cells, surfaces, and materials. Most other data cards are stored as lists.
- Parameters
cells (dict, optional) – Dictionary mapping mcnpy.Cell objects by ID.
surfaces (dict, optional) – Dictionary mapping mcnpy.Surface objects by ID.
materials (dict, optional) – Dictionary mapping mcnpy.Material objects by ID.
- get_all_surfaces()[source]
Return all surfaces used in the geometry
- Returns
Dictionary mapping surface IDs to
mcnpy.Surfaceinstances- Return type
collections.OrderedDict
- get_redundant_surfaces()[source]
Return all of the topologically redundant surface IDs
- Returns
Dictionary whose keys are the ID of a redundant surface and whose values are the topologically equivalent
mcnpy.Surfacethat should replace it.- Return type
dict
- serialize(title=None, renumber=False)[source]
Serialize the MCNP deck to a string.
- Parameters
title (str, optional) – User specified title for the deck.
renumber (boolean, optional) – Use sequential numbering for named objects.
- Returns
deck_string – A textual representation of the MCNP deck.
- Return type
str
- property universes
- write(filename='deck.mcnp', title=None, renumber=False, direct=False)[source]
Write the deck to file.
- Parameters
filename (str) – The name of the file to be written.
title (str, optional) – Title line added to the MCNP deck.
renumber (boolean, optional) – Use sequential numbering for named objects.
direct (boolean, optional) – Serialize without extra formatting from Python.
- mcnpy.deck.run_mcnp(input, exe='mcnp6', exe_op='IXR', inp=True, mcnp_path=None, data_path=None, ics_path=None, options=[], lineout=True, **kwargs)[source]
Initiate MCNP simulation. Also supports calling the plotter.
- Parameters
input (str) – Name of the MCNP textual input file.
exe (str) – Name of the MCNP executable.
exe_op (str) – MCNP executions options.
inp (boolean) – Set to True to run with ‘I=input’. False for ‘N=input’.
mcnp_path (str or None) – The path to the MCNP executable.
data_path (str or None) – The path to the MCNP XS directory file.
ics_path (str or None) – The path to ISC data.
options (iterable of str) – A list of other options that require no arguments.
lineout (bool) – Set to True to print MCNP output to terminal.
**kwargs (str) – Keyword arguments for MCNP.
- mcnpy.deck.run_script(script, exe, *args, lineout=True, **kwargs)[source]
Run a custom script.
- Parameters
script (str) – The run script (e.g. run_mcnp.sh).
exe (str) – The executable which runs the script (e.g. python, bash)
*args (str) – Arguments passed to the script
lineout (bool) – Set to True to print script output to terminal.
**kwargs (str) – Keyword arguments passed to the script.