Material Library

Download the full notebook.

material_library

Material Library

PyNE comes with a pre-built library of materials Most of this data comes from a materials compendium by PNNL, which is gives canonical values for normal materials. This notebook demonstrates how to load and use this data via the MaterialLibrary class. First the imports!

In [1]:
# the path to the nuc_data.h5 database
from pyne import nuc_data

# the material library class itself
from pyne.material_library import MaterialLibrary

The MaterialLibrary class is a dict-like class which maps string names to Material objects. We can instantiate this class directly from the database as follows.

In [2]:
mats = MaterialLibrary(nuc_data, datapath='/material_library/materials')

We can also take a gander at the keys in this dictionary.

In [3]:
# employing a decode from byte literals to unicode str values
# otherwise just use: list(mats.keys())[:10]
[mat.decode('utf-8') for mat in list(mats.keys())[:10]]
Out[3]:
['Au',
 'Ar',
 'As',
 'Zirconium Hydride (Zr5H8)',
 'Bone, Compact (ICRU)',
 'Plutonium Nitrate',
 'Boral (Aluminum 5% boron alloy)',
 'Earth, U.S. Average',
 'Nylon, Type 11 (Rilsan)',
 'Boron']

And the values too!

In [4]:
mats['Steel, Stainless 440']
Out[4]:
pyne.material.Material({60120000: 0.006738245111766667, 60130000: 7.897265541777496e-05, 140280000: 0.0060307851831815865, 140290000: 0.0003173145988016552, 140300000: 0.00021662843826844154, 150310000: 0.0002625891288100673, 160320000: 0.00019131705365087835, 160330000: 1.557774006043863e-06, 160340000: 9.094152481841308e-06, 160360000: 2.2657407442146268e-08, 240500000: 0.007165923113837514, 240520000: 0.14370585573699474, 240530000: 0.016608861078294093, 240540000: 0.004212251985148446, 250550000: 0.006564728220251683, 260540000: 0.04533198404164438, 260560000: 0.7379391848627866, 260570000: 0.017347052631454484, 260580000: 0.0023490356196681664, 420920000: 0.0006858785703804202, 420940000: 0.00044131037576579846, 420950000: 0.0007721150960341245, 420960000: 0.0008211250804812777, 420970000: 0.0004778107505804997, 420980000: 0.0012264572169225815, 421000000: 0.0005038988659627156}, 1.0, 7.8, -1.0, {"name":"Steel, Stainless 440"})

You can do everything you normaly would with these materials, like print them out in MCNP form!

In [5]:
print(mats['Steel, Stainless 440'].mcnp())
C name: Steel, Stainless 440
C density = 7.80000
m?
     6012 -5.2558e-02
     6013 -6.1599e-04
     14028 -4.7040e-02
     14029 -2.4751e-03
     14030 -1.6897e-03
     15031 -2.0482e-03
     16032 -1.4923e-03
     16033 -1.2151e-05
     16034 -7.0934e-05
     16036 -1.7673e-07
     24050 -5.5894e-02
     24052 -1.1209e+00
     24053 -1.2955e-01
     24054 -3.2856e-02
     25055 -5.1205e-02
     26054 -3.5359e-01
     26056 -5.7559e+00
     26057 -1.3531e-01
     26058 -1.8322e-02
     42092 -5.3499e-03
     42094 -3.4422e-03
     42095 -6.0225e-03
     42096 -6.4048e-03
     42097 -3.7269e-03
     42098 -9.5664e-03
     42100 -3.9304e-03