Fix PyAPI summary S(alpha,beta) bug

Material needs to be instantiated before trying to add sab to it
This commit is contained in:
Sterling Harper 2015-10-03 16:01:37 -04:00
parent ac170d9c91
commit e02a911489

View file

@ -72,6 +72,9 @@ class Summary(object):
nuc_densities = self._f['materials'][key]['nuclide_densities'][...]
nuclides = self._f['materials'][key]['nuclides'].value
# Create the Material
material = openmc.Material(material_id=material_id, name=name)
# Read the names of the S(a,b) tables for this Material and add them
if 'sab_names' in self._f['materials'][key]:
sab_tables = self._f['materials'][key]['sab_names'].value
@ -79,10 +82,8 @@ class Summary(object):
name, xs = sab_table.decode().split('.')
material.add_s_alpha_beta(name, xs)
# Create the Material
material = openmc.Material(material_id=material_id, name=name)
# Set the Material's density to g/cm3 - this is what is used in OpenMC
# Set the Material's density to g/cm3 - this is what is used in
# OpenMC
material.set_density(density=density, units='g/cm3')
# Add all nuclides to the Material