From e02a9114897532abd2e247f740719caac4a94cfa Mon Sep 17 00:00:00 2001 From: Sterling Harper Date: Sat, 3 Oct 2015 16:01:37 -0400 Subject: [PATCH] Fix PyAPI summary S(alpha,beta) bug Material needs to be instantiated before trying to add sab to it --- openmc/summary.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/openmc/summary.py b/openmc/summary.py index 2ae7464846..f3952f9b41 100644 --- a/openmc/summary.py +++ b/openmc/summary.py @@ -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