openmc.data.DataLibrary

class openmc.data.DataLibrary[source]

Collection of cross section data libraries.

Variables:libraries (list of dict) – List in which each item is a dictionary summarizing cross section data from a single file. The dictionary has keys ‘path’, ‘type’, and ‘materials’.
export_to_xml(path='cross_sections.xml')[source]

Export cross section data library to an XML file.

Parameters:path (str) – Path to file to write. Defaults to ‘cross_sections.xml’.
classmethod from_xml(path=None)[source]

Read cross section data library from an XML file.

Parameters:path (str, optional) – Path to XML file to read. If not provided, the OPENMC_CROSS_SECTIONS environment variable will be used.
Returns:data – Data library object initialized from the provided XML
Return type:openmc.data.DataLibrary
get_by_material(name, data_type='neutron')[source]

Return the library dictionary containing a given material.

Parameters:
  • name (str) – Name of material, e.g. ‘Am241’
  • data_type (str) –

    Name of data type, e.g. ‘neutron’, ‘photon’, ‘wmp’, or ‘thermal’

    New in version 0.12.

Returns:

library – Dictionary summarizing cross section data from a single file; the dictionary has keys ‘path’, ‘type’, and ‘materials’.

Return type:

dict or None

register_file(filename)[source]

Register a file with the data library.

Parameters:filename (str or Path) – Path to the file to be registered. If an xml file, treat as the depletion chain file without materials.