Convert ACE ENDF format

Hello! I try to convert to hdf ACE and ENDF formats from this library:

But it doesn’t work. Maybe I do something wrong.


@Ilyavitte When OpenMC does not recognize a specific thermal scattering material, you need to supply the table name, list of ZAIDs, and “nmix” parameter (see documentation for NJOY/ACER card 9). This can be done as:

openmc.data.ThermalScattering.from_njoy(
    neutron_endf_file, thermal_endf_file,
    table_name='c_H_in_MgH2',
    zaids=[1001],
    nmix=1
)

The above is just an example, and you should confirm the appropriate parameters for your case.

As for the error you’re seeing when you try from_ace, I believe this is related to the fact that this is a new evaluation that uses mixed elastic scattering (incoherent+coherent). With the arguments above passed to from_njoy, I actually get the same error too. I have a branch I’m working on to support mixed elastic scattering in OpenMC, so stay posted and hopefully I’ll have a fix soon!

Hello, Paul! I try to use it in my jupyter notebook, but it gives me the same mistake as when i’m calling command ‘from_ace’

Ah yes, I forgot that even trying to read the ACE file from the current version won’t work. I’ve recently implemented support for thermal scattering evaluations for mixed coherent/incoherent elastic, which you can find in this pull request. With that branch, you should be able to run either from_njoy or from_ace on these new evaluations.

Okay… I see, that in article: “ NJOY+NCrystal: An open-source tool for creating thermal neutron scattering
libraries with mixed elastic support” authors use OpenMC for their calculations. Maybe you know something about this and can give some examples, how they use specific data for their calculations?

I believe they may have had their own branch of OpenMC that implemented support for mixed elastic (separate from the one that I submitted a pull request).

So, I try to use your pull request. And it works! It makes hdf file, but when i try to use recompiling cross-section file with this data i have error:
HDF5-DIAG: Error detected in HDF5 (1.12.1) MPI-process 0:
#000: H5D.c line 285 in H5Dopen2(): unable to open dataset
major: Dataset
minor: Can’t open object
#001: H5VLcallback.c line 1910 in H5VL_dataset_open(): dataset open failed
major: Virtual Object Layer
minor: Can’t open object
#002: H5VLcallback.c line 1877 in H5VL__dataset_open(): dataset open failed
major: Virtual Object Layer
minor: Can’t open object
#003: H5VLnative_dataset.c line 123 in H5VL__native_dataset_open(): unable to open dataset
major: Dataset
minor: Can’t open object
#004: H5Dint.c line 1490 in H5D__open_name(): not a dataset
major: Dataset
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.12.1) MPI-process 0:
#000: H5A.c line 449 in H5Aopen(): invalid location identifier
major: Invalid arguments to routine
minor: Inappropriate type
#001: H5VLint.c line 1749 in H5VL_vol_object(): invalid identifier type to function
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.12.1) MPI-process 0:
#000: H5A.c line 777 in H5Aget_type(): not an attribute
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.12.1) MPI-process 0:
#000: H5T.c line 2328 in H5Tget_size(): not a datatype
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.12.1) MPI-process 0:
#000: H5T.c line 1977 in H5Tclose(): not a datatype
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.12.1) MPI-process 0:
#000: H5A.c line 1624 in H5Aclose(): not an attribute
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.12.1) MPI-process 0:
#000: H5T.c line 2376 in H5Tset_size(): size must be positive
major: Invalid arguments to routine
minor: Bad value
HDF5-DIAG: Error detected in HDF5 (1.12.1) MPI-process 0:
#000: H5A.c line 449 in H5Aopen(): invalid location identifier
major: Invalid arguments to routine
minor: Inappropriate type
#001: H5VLint.c line 1749 in H5VL_vol_object(): invalid identifier type to function
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.12.1) MPI-process 0:
#000: H5A.c line 698 in H5Aread(): not an attribute
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.12.1) MPI-process 0:
#000: H5A.c line 1624 in H5Aclose(): not an attribute
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.12.1) MPI-process 0:
#000: H5I.c line 902 in H5Iget_name(): invalid identifier
major: Object atom
minor: Inappropriate type
#001: H5VLint.c line 1749 in H5VL_vol_object(): invalid identifier type to function
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.12.1) MPI-process 0:
#000: H5I.c line 902 in H5Iget_name(): invalid identifier
major: Object atom
minor: Inappropriate type
#001: H5VLint.c line 1749 in H5VL_vol_object(): invalid identifier type to function
major: Invalid arguments to routine
minor: Inappropriate type
terminate called after throwing an instance of ‘std::runtime_error’

UnicodeDecodeError Traceback (most recent call last)
Input In [1], in <cell line: 156>()
152 tallies.append(tally)
153 tallies.export_to_xml()
→ 156 openmc.run()

File ~/anaconda3/lib/python3.9/site-packages/openmc/executor.py:276, in run(particles, threads, geometry_debug, restart_file, tracks, output, cwd, openmc_exec, mpi_args, event_based)
232 “”“Run an OpenMC simulation.
233
234 Parameters
(…)
268
269 “””
271 args = _process_CLI_arguments(
272 volume=False, geometry_debug=geometry_debug, particles=particles,
273 restart_file=restart_file, threads=threads, tracks=tracks,
274 event_based=event_based, openmc_exec=openmc_exec, mpi_args=mpi_args)
→ 276 _run(args, output, cwd)

File ~/anaconda3/lib/python3.9/site-packages/openmc/executor.py:95, in _run(args, output, cwd)
92 lines =
93 while True:
94 # If OpenMC is finished, break loop
—> 95 line = p.stdout.readline()
96 if not line and p.poll() is not None:
97 break

File ~/anaconda3/lib/python3.9/codecs.py:322, in BufferedIncrementalDecoder.decode(self, input, final)
319 def decode(self, input, final=False):
320 # decode input (taking the buffer into account)
321 data = self.buffer + input
→ 322 (result, consumed) = self._buffer_decode(data, self.errors, final)
323 # keep undecoded input until the next call
324 self.buffer = data[consumed:]

UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x80 in position 46: invalid start byte

I try to use my script on another computer and have the same problem, but DecodeError was with 0x84.

@Ilyavitte did you recompile the OpenMC executable before trying to run?

I make two environments. One of them with your’s pull request and one with stable version of openmc. I make cross section hdf5 in pull request and try to use this cross sections in both versions. But it doesn’t work with same error. I check version when i make calculation, they’re different