Elements

mcnpy.elements provides a series of singleton classes that are useful for defining mcnpy.Nuclide objects when defining an mcnpy.Material. For example,

import mcnpy
from mcnpy.elements import U, O

   uo2 = U[235] + O@2
   fuel = mcnpy.Material(uo2)

will produce a UO2 material composed of uranium-235 and natural oxygen. The operators permit users to choose atomic or weight fractions or weight percentages.

Element Operators

Operation

Symbol (Python)

Symbol (MCNP)

Atomic Fraction

@

+

Weight Fraction

*

-

Weight Percent

%

N/A

MCNPy supports mixing of fraction types that cannot be done in native MCNP syntax. For example, we can use a combination of fraction types to define a UO2 material using uranium enriched to 3% U-235 by weight. The uranium composition will be defined using weight percentages, while atomic fractions will be used for the ratio of uranium and oxygen atoms. This combination enables readable and intuitive definitions.

enr = 3 # Enrichment by weight percentage
u_enr = U[238]%(100-enr) + U[235]%enr # Enriched uranium
fuel = mp.Material(u_enr + O[16]@2) # UO2 using atomic fractions
M1
     92238  0.9696278737791809
     92235  0.030372126220819046
     8016  2.0

Elements also support additional information beyond their mass number. Library extensions can also be specified.

uo2 = U[235, '70c'] + O[0, '70c']@2

Note

All element objects use capital letters. E.g. iron (Fe) becomes FE.