Esempio n. 1
0
def factory():
    """
    Reads data files to instantiate the :py:class:`INuclides <INuclide>`.

    Reads NIST, MC**2 and burn chain data files to instantiate the :py:class:`INuclides <INuclide>`.
    Also clears and fills in the
    :py:data:`~armi.nucDirectory.nuclideBases.instances`,
    :py:data:`byName`, :py:attr:`byLabel`, and
    :py:data:`byMccId` module attributes. This method is automatically run upon
    loading the module, hence it is not usually necessary to re-run it unless there is a
    change to the data files, which should not happen during run time, or a *bad*
    :py:class`INuclide` is created.

    Notes
    -----
    This may cannot be run more than once. NuclideBase instances are used throughout the ARMI
    ecosystem and are even class attributes in some cases. Re-instantiating them would orphan
    any existing ones and break everything.

    Nuclide labels from MC2-2, MC2-3, and MCNP are currently handled directly.
    Moving forward, we plan to implement a more generic labeling system so that
    plugins can provide code-specific nuclide labels in a more extensible fashion.
    """
    # this intentionally clears and reinstantiates all nuclideBases
    global instances  # pylint: disable=global-statement
    if len(instances) == 0:
        # make sure the elements actually exist...
        elements.factory()
        del instances[:]  # there is no .clear() for a list
        byName.clear()
        byDBName.clear()
        byLabel.clear()
        byMccId.clear()
        byMcnpId.clear()
        byAAAZZZSId.clear()
        __readRiplNuclides()
        __readRiplAbundance()
        # load the mc2Nuclide.json file. This will be used to supply nuclide IDs
        __readMc2Nuclides()
        _completeNaturalNuclideBases()
        elements.deriveNaturalWeights()
        __readRiplDecayData()
        # reload the thermal scattering library with the new nuclideBases too
        # pylint: disable=import-outside-toplevel; cyclic import
        from . import thermalScattering

        thermalScattering.factory()
Esempio n. 2
0
def factory(force=False):
    r"""Reads data files to instantiate the :py:class:`INuclides <INuclide>`.

    Reads NIST, MC**2 and burn chain data files to instantiate the :py:class:`INuclides <INuclide>`.
    Also clears and fills in the
    :py:data:`~armi.nucDirectory.nuclideBases.instances`,
    :py:data:`byName`, :py:attr:`byLabel`, and
    :py:data:`byMccId` module attributes. This method is automatically run upon
    loading the module, hence it is not usually necessary to re-run it unless there is a
    change to the data files, which should not happen during run time, or a *bad*
    :py:class`INuclide` is created.

    Notes
    -----
    Nuclide labels from MC2-2, MC2-3, and MCNP are currently handled directly.
    Moving forward, we plan to implement a more generic labeling system so that
    plugins can provide code-specific nuclide labels in a more extensible fashion.

    Attributes
    ----------
    force: bool, optional
        If True, forces the reinstantiation of all :py:class:`INuclides`.
        Any :py:class:`Nuclides <armi.nucDirectory.nuclide.Nuclde>` objects referring to the
        original :py:class:`INuclide` will not update their references, and will probably fail.
    """
    # this intentionally clears and reinstantiates all nuclideBases
    global instances  # pylint: disable=global-statement
    global _burnChainImposed  # pylint: disable=global-statement
    if force or len(instances) == 0:
        _burnChainImposed = False
        # make sure the elements actually exist...
        elements.factory()
        del instances[:]  # there is no .clear() for a list
        byName.clear()
        byDBName.clear()
        byLabel.clear()
        byMccId.clear()
        byMcnpId.clear()
        byAAAZZZSId.clear()
        __readRiplNuclides()
        __readRiplAbundance()
        # load the mc2Nuclide.json file. This will be used to supply nuclide IDs
        __readMc2Nuclides()
        _completeNaturalNuclideBases()
        elements.deriveNaturalWeights()
        __readRiplDecayData()