diff --git a/openmc/data/ace.py b/openmc/data/ace.py index 03052bcab..4085b4222 100644 --- a/openmc/data/ace.py +++ b/openmc/data/ace.py @@ -282,7 +282,7 @@ class Library(object): lines = [ace_file.readline() for i in range(13)] - while len(lines) != 0 and lines[0] != '': + while len(lines) != 0 and lines[0].strip() != '': # Read name of table, atomic mass ratio, and temperature. If first # line is empty, we are at end of file diff --git a/openmc/data/function.py b/openmc/data/function.py index bea6f5e9a..56a3d4a45 100644 --- a/openmc/data/function.py +++ b/openmc/data/function.py @@ -97,7 +97,7 @@ class Tabulated1D(object): if self.interpolation[k] == 1: # Histogram - y[contined] = yi + y[contained] = yi elif self.interpolation[k] == 2: # Linear-linear diff --git a/openmc/data/neutron.py b/openmc/data/neutron.py index 75c38e823..450cf81ec 100644 --- a/openmc/data/neutron.py +++ b/openmc/data/neutron.py @@ -178,7 +178,7 @@ class IncidentNeutron(object): @temperature.setter def temperature(self, temperature): cv.check_type('temperature', temperature, Real) - cv.check_greater_than('temperature', temperature, 0.0) + cv.check_greater_than('temperature', temperature, 0.0, True) self._temperature = temperature @energy.setter @@ -448,6 +448,10 @@ class IncidentNeutron(object): # Create summed reaction with appropriate cross section rx = Reaction(mt) mts = data.get_reaction_components(mt) + if len(mts) == 0: + warn('Photon production is present for MT={} but no ' + 'reaction components exist.'.format(mt)) + continue rx.xs = Sum([data.reactions[mt_i].xs for mt_i in mts]) # Determine summed cross section diff --git a/openmc/data/thermal.py b/openmc/data/thermal.py index 6e3f6d452..9de39f518 100644 --- a/openmc/data/thermal.py +++ b/openmc/data/thermal.py @@ -16,6 +16,7 @@ from openmc.stats import Discrete, Tabular _THERMAL_NAMES = {'al': 'c_Al27', 'al27': 'c_Al27', 'be': 'c_Be', + 'beo': 'c_BeO', 'bebeo': 'c_Be_in_BeO', 'be-o': 'c_Be_in_BeO', 'be/o': 'c_Be_in_BeO', 'benz': 'c_Benzine', 'cah': 'c_Ca_in_CaH2', diff --git a/scripts/openmc-ace-to-hdf5 b/scripts/openmc-ace-to-hdf5 index 21a2718a5..c2198ec4f 100755 --- a/scripts/openmc-ace-to-hdf5 +++ b/scripts/openmc-ace-to-hdf5 @@ -64,7 +64,9 @@ if args.xml is not None: directory = os.path.dirname(args.xml) for ace_table in root.findall('ace_table'): - ace_libraries.append(os.path.join(directory, ace_table.attrib['path'])) + path = os.path.join(directory, ace_table.attrib['path']) + if path not in ace_libraries: + ace_libraries.append(path) elif args.xsdir is not None: # Find 'directory' section @@ -116,8 +118,12 @@ for filename in ace_libraries: for table in lib.tables: if table.name.endswith('c'): # Continuous-energy neutron data - neutron = openmc.data.IncidentNeutron.from_ace( - table, args.metastable) + try: + neutron = openmc.data.IncidentNeutron.from_ace( + table, args.metastable) + except Exception as e: + print('Failed to convert {}: {}'.format(table.name, e)) + continue print('Converting {} (ACE) to {} (HDF5)'.format(table.name, neutron.name)) # Determine filename