Esempio n. 1
0
def toENDF6( self, MT, endfMFList, flags, targetInfo, verbosityIndent = '' ) :

    def getPromptOrTotalNubar( self ) :

        return( self.multiplicity[targetInfo['style']] )

    targetInfo['product'] = self
    targetInfo['delayedNubarWeight'] = None
    if( 'emissionMode' in self.attributes ) :
        if( self.getAttribute( 'emissionMode' ) == tokensModule.delayedToken ) :
            MT = 455
            if( MT not in endfMFList[5] ) : endfMFList[5][MT] = [ ]
            targetInfo['delayedNubarWeight'] = self.ENDF6_delayedNubarWeights
        elif( self.getAttribute( 'emissionMode' ) == tokensModule.promptToken ) :
            targetInfo['promptNubar'] = getPromptOrTotalNubar( self )
        elif( self.getAttribute( 'emissionMode' ) == 'total' ) :
                targetInfo['totalNubar'] = getPromptOrTotalNubar( self )

    if( flags['verbosity'] >= 10 ) : print '%s%s: label = %s: to ENDF6:' % ( verbosityIndent, self.id, self.label )
    priorMF6flag = targetInfo['doMF4AsMF6']
    if( self.attributes.get( 'ENDFconversionFlag' ) == 'MF6' ) :
        targetInfo['doMF4AsMF6'] = True # flag was set in reaction.py, but may need to be overwritten

    gammasPresent = False
    if( self.outputChannel is not None ) :
        for product in self.outputChannel : gammasPresent = gammasPresent or ( product.id == IDsPoPsModule.photon )
    if( len( self.distribution ) or gammasPresent ) :        # First part should now always be true.
        distribution = self.distribution[targetInfo['style']]
        doDistribution = True
        if( isinstance( distribution, unspecifiedModule.form ) ) :
            if( ( MT not in [ 527, 528 ] ) or ( self.id != IDsPoPsModule.electron ) ) : doDistribution = False
        if( doDistribution ) :
            targetInfo['zapID'] = self.id
            particle = targetInfo['reactionSuite'].PoPs[self.id]
            ZA = miscPoPsModule.ZA( particle )
            try :
                targetInfo['particleMass'] = targetInfo['massTracker'].getMassAWR( ZA, asTarget = False )
            except :
                pass
            targetInfo['multiplicity'] = self.multiplicity
            if not (self.getAttribute('ENDFconversionFlag') == 'implicitProduct'):
                self.distribution.toENDF6( MT, endfMFList, flags, targetInfo )
    if( self.outputChannel is not None ) :
        priorIndex, priorToken, priorLabel = targetInfo['productIndex'], targetInfo['productToken'], targetInfo['productLabel']
        for index, product in enumerate( self.outputChannel ) :
            if( product.id == IDsPoPsModule.photon ) :
                targetInfo['gammas'].append( product )
                continue
            targetInfo['productIndex'] = "%s.%s" % ( priorIndex, index )
            targetInfo['productToken'] = product.id
            targetInfo['productLabel'] = product.label
            product.toENDF6( MT, endfMFList, flags, targetInfo, verbosityIndent = verbosityIndent + '    ' )
        targetInfo['productIndex'], targetInfo['productToken'], targetInfo['productLabel'] = priorIndex, priorToken, priorLabel
    targetInfo['doMF4AsMF6'] = priorMF6flag
Esempio n. 2
0
def toENDF6_MF6(MT, endfMFList, flags, targetInfo, LAW, frame, MF6):

    reactionSuite = targetInfo['reactionSuite']
    MF6or26 = {3: 6, 23: 26}[targetInfo['crossSectionMF']]
    targetInfo['MF6LCTs'].append({
        standardsModule.frames.labToken: 1,
        standardsModule.frames.centerOfMassToken: 2
    }[frame])
    LIP = 0
    if ((targetInfo['product'].id in targetInfo['metastables'])
            and not ((50 <= MT <= 91) or (600 <= MT <= 850))):
        # set LIP to metastable index of product UNLESS excited state of product is encoded in MT number:
        alias = targetInfo['metastables'][targetInfo['product'].id]
        LIP = int(alias.metaStableIndex)
    if (MT not in endfMFList[MF6or26]): endfMFList[MF6or26][MT] = []
    particleID = targetInfo['zapID']  # get ZAP for the outgoing particle
    if (particleID == IDsPoPsModule.electron):
        ZAP = 11
    else:
        ZAP = miscPoPsModule.ZA(reactionSuite.PoPs[particleID])
    productMass = targetInfo['particleMass']
    if ((particleID == IDsPoPsModule.neutron)
            and (MT in [18])):  # Special case when fission has MF = 6 data.
        nPoints = 2
        interpolationFlatData = [nPoints, 2]
        multiplicityList = endfFormatsModule.endfDataList(
            [[targetInfo['EMin'], 1.], [targetInfo['EMax'], 1.]])
    else:
        multiplicity = targetInfo['multiplicity']
        if (isinstance(multiplicity, multiplicityModule.component)):
            multiplicity = multiplicity[targetInfo['style']]
        interpolationFlatData, nPoints, multiplicityList = multiplicity.toENDF6List(
            targetInfo)
    if ((particleID == IDsPoPsModule.photon) and (LAW == 2)):
        projectileMass = reactionSuite.PoPs[reactionSuite.projectile].getMass(
            'eV/c**2')
        targetMass = reactionSuite.PoPs[reactionSuite.projectile].getMass(
            'eV/c**2')
        AWP = targetInfo['Q']
        AWP /= 1. + 0.5 * AWP / (
            projectileMass + targetMass
        )  # Should be divided by residual mass, but this is close.
    else:
        AWP = productMass
    ENDFHeaderList = [
        endfFormatsModule.endfContLine(ZAP, AWP, LIP, LAW,
                                       len(interpolationFlatData) / 2, nPoints)
    ]
    ENDFHeaderList += endfFormatsModule.endfInterpolationList(
        interpolationFlatData)
    ENDFHeaderList += multiplicityList
    endfMFList[MF6or26][MT] += ENDFHeaderList + MF6
Esempio n. 3
0
def toENDF6( self, MT, endfMFList, flags, targetInfo ) :

    if( len( self ) == 0 ) :
        raise Exception( 'This needs to be tested' )     # In particular, the method endfMultiplicityList has been removed.
        if( MT in [ 452, 455, 456 ] ) : return
        targetInfo['MF6LCTs'].append( None )
        particle = targetInfo['reactionSuite'].PoPs[targetInfo['zapID']]
        ZAP = miscPoPsModule.ZA( particle )
        nPoints, multiplicityList = targetInfo['multiplicity'].endfMultiplicityList( targetInfo )
        AWP = targetInfo['massTracker'].getMassAWR(ZAP, asTarget = False)
        endfMFList[6][MT] += [ endfFormatsModule.endfContLine( ZAP, AWP, 0, 0, 1, nPoints ) ]
        endfMFList[6][MT] += multiplicityList
        return
    form = self[targetInfo['style']]
    if( hasattr( form, 'toENDF6' ) ) :
        form.toENDF6( MT, endfMFList, flags, targetInfo )
    elif( isinstance( form, unspecifiedModule.form ) ) :
        if( MT in [ 527, 528 ] ) : energyLoss( self, MT, endfMFList, flags, targetInfo )
    else :
        print 'WARNING: Distribution, no toENDF6 for class = %s' % form.__class__
Esempio n. 4
0
        def particleZA(particleID):

            particle = reactionSuite.PoPs[particleID]
            return (miscPoPsModule.ZA(particle))
Esempio n. 5
0
def toENDF6(self, endfMFList, flags, targetInfo, verbosityIndent=''):
    """Convert to ENDF format."""

    reactionSuite = targetInfo['reactionSuite']

    ZAM, AWT = targetInfo['ZA'], targetInfo['mass']
    NIS, ABN = 1, 1.0;
    ZAI = ZAM  # assuming one isotope/file
    MTL = 0 # mtl=1 sections are handled in lumpedCovariance

    for section_ in self.modelParameterCovariances:
        section_.toENDF6(endfMFList, flags, targetInfo, verbosityIndent)

    sections = self.sections[:]
    # sort covariances by MF/MT:
    mfmts = []
    for section_ in sections:
        mfmts.append(map(int,section_.rowData['ENDF_MFMT'].split(',')))
    if len(mfmts)==0: return

    mfs, mts = zip(*mfmts)
    zipList = zip(mfs,mts,sections)
    idx = 0
    while idx<len(zipList):
        mf,mt,covar = zipList[idx]
        thisMFMT = [a[2] for a in zipList if a[:2]==(mf,mt)]
        idx += len(thisMFMT)

        if mf in (31,33):
            endf = [endfFormatsModule.endfHeadLine( ZAM, AWT, 0, MTL, 0, len(thisMFMT) )]
        elif mf==34:
            if isinstance( thisMFMT[0][ targetInfo['style'] ], distributionsModule.LegendreOrderCovarianceForm ): LTT = 1
            NMT1 = len(thisMFMT)
            endf = [endfFormatsModule.endfHeadLine( ZAM, AWT, 0, LTT, 0, NMT1 )]
        elif mf==35:
            endf = [endfFormatsModule.endfHeadLine( ZAM, AWT, 0, MTL, len(thisMFMT), 0 )]
        elif mf==40:
            endf = [endfFormatsModule.endfHeadLine( ZAM, AWT, 0, 0, len(thisMFMT), 0 )]
        for section_ in thisMFMT:
            MAT1 = 0
            form = section_[ targetInfo['style'] ]
            if section_.columnData and isinstance(section_.columnData.link, sectionModule.externalReaction):
                otherTarget = section_.columnData.link.target
                ZA, MAT1 = endf_endlModule.ZAAndMATFromParticleName( otherTarget )
            if mf==34:
                L1s = [subsec.L1 for subsec in form]
                L2s = [subsec.L2 for subsec in form]
                NL = len( set(L1s) );  NL1 = len( set(L2s) )
                if section_.columnData: raise NotImplemented # cross-reaction or cross-material
                MT1 = mt
                endf += [ endfFormatsModule.endfHeadLine( 0.0, 0.0, MAT1, MT1, NL, NL1 ) ]
            if mf==40:
                rowData = section_.rowData
                if( isinstance( rowData, str ) ) :
                    raise Exception( "Don't string me along!" ) # FIXME
                else:
                    quant = rowData.link
                    product = quant.findAttributeInAncestry('outputChannel')[0]
                    QI = quant.findAttributeInAncestry('getQ')('eV')
                    LFS, level = 0, 0.
                    particle = reactionSuite.PoPs[product.id]
                    if( isinstance( particle, nuclearLevelModule.particle ) ) :
                        LFS = particle.intIndex
                        level = particle.energy[0].float( 'eV' )
                    QM = QI + level
                    IZAP = miscPoPsModule.ZA( reactionSuite.PoPs[product.id] )
                    NL = 1
                    endf += [endfFormatsModule.endfHeadLine( QM, QI, IZAP, LFS, 0, NL ) ]
                    XMF1, XLFS1, NC, NI = 10,LFS, 0,1
                    endf += [endfFormatsModule.endfHeadLine( XMF1,XLFS1,MAT1,mt,NC,NI )]
            targetInfo['MAT1'] = MAT1
            targetInfo['dataPointer'] = [section_.rowData,section_.columnData]
            endf += form.toENDF6(flags, targetInfo)
            targetInfo.pop( 'dataPointer' )
            targetInfo.pop( 'MAT1' )
        endf.append( endfFormatsModule.endfSENDLineNumber() )
        if mt not in endfMFList[mf]:
            endfMFList[mf][mt] = []
        endfMFList[mf][mt] += endf
    # also add ENDF-style pointers for lumped covariance data:
    for reactionSum in targetInfo['reactionSuite'].sums.crossSections:
        MT1 = reactionSum.ENDF_MT
        if MT1 not in xrange(851,872): continue
        for summand in reactionSum.summands:
            mt = summand.link.findAttributeInAncestry('ENDF_MT')
            endfMFList[33][mt] = [endfFormatsModule.endfHeadLine(ZAM,AWT,0,MT1,0,0),
                    endfFormatsModule.endfSENDLineNumber() ]
    return
Esempio n. 6
0
rce = endfFileToGNDModule.endfFileToGND(
    args.inputFile,
    singleMTOnly=args.MT,
    MTs2Skip=args.MT2Skip,
    toStdOut=args.verbose > 2,
    skipBadData=args.skipBadData,
    doCovariances=False,
    verbose=0,
    printBadNK14=False,
    continuumSpectraFix=args.continuumSpectraFix)
reactionSuite = rce['reactionSuite']
reactionSuite.convertUnits({'eV': 'MeV'})

target = reactionSuite.PoPs[reactionSuite.target]
ZA = miscPoPsModule.ZA(target)
suffix = ''
ELevel = 0
if (isinstance(target, nuclearLevelModule.particle)):
    ELevel = target.nucleus.energy[0].float('MeV')
if (ELevel > 0):
    metaStableName = reactionSuite.aliases.getAliasesFor(
        reactionSuite.target)[0]
    suffix = 'm%s' % int(
        reactionSuite.aliases[metaStableName].attributes['nuclearMetaStable'])
yi = endlmiscModule.incidentParticleTags(str(reactionSuite.projectile))[1]

endlZA = endlZAClass(ZA,
                     yi,
                     suffix=suffix,
                     workDir=args.output,
Esempio n. 7
0
def upDateENDF_MT_MF8Data(MT, endfMFList, targetInfo):

    reactionSuite = targetInfo['reactionSuite']
    MF8Channels = targetInfo['MF8'][MT]
    ZA, mass = targetInfo['ZA'], targetInfo['mass']
    LIS, LISO, NO, NS = targetInfo['LIS'], targetInfo['LISO'], 1, len(
        MF8Channels)
    firstReaction = MF8Channels[0]
    residual = firstReaction.outputChannel[0]

    crossSection_ = firstReaction.crossSection[
        targetInfo['style']]  # LMF determines which MF section to write to.
    if (isinstance(crossSection_, crossSectionModule.reference)):
        multiplicity = residual.multiplicity[targetInfo['style']]
        if (isinstance(multiplicity, multiplicityModule.constant1d)):
            LMF = 3
        elif (isinstance(multiplicity, multiplicityModule.reference)):
            LMF = 6
        else:
            LMF = 9
    else:
        LMF = 10

    level = 0
    if (hasattr(residual, 'getLevelAsFloat')):
        level = residual.getLevelAsFloat('eV')
    endfMFList[8][MT] = [
        endfFormatsModule.endfHeadLine(ZA, mass, LIS, LISO, NS, NO)
    ]
    if (LMF not in [3, 6]):
        endfMFList[LMF][MT] = [
            endfFormatsModule.endfHeadLine(ZA, mass, LIS, 0, NS, 0)
        ]

    for reaction in MF8Channels:
        outputChannel = reaction.outputChannel
        if (len(outputChannel) != 1):
            raise Exception(
                'Currently, production channel can only have one product; not %d'
                % len(outputChannel))
        product = outputChannel[0]

        particle = reactionSuite.PoPs[product.id]
        ZAP = miscPoPsModule.ZA(particle)

        QI = outputChannel.getConstantQAs('eV', final=True)
        LFS2, level2 = 0, 0
        if (isinstance(particle, nuclearLevelModule.particle)):
            LFS2 = particle.intIndex
            level2 = particle.energy[0].float('eV')
        QM = QI + level2

        endfMFList[8][MT].append(
            endfFormatsModule.endfHeadLine(ZAP, level2, LMF, LFS2, 0, 0))

        if (
                LMF == 9
        ):  # Currenty, multiplicity.toENDF6List only has one interpolation and its linear.
            multiplicity = product.multiplicity[targetInfo['style']]
            interpolationFlatData, nPoints, multiplicityList = multiplicity.toENDF6List(
                targetInfo)
            endfMFList[LMF][MT].append(
                endfFormatsModule.endfHeadLine(QM, QI, ZAP, LFS2,
                                               len(interpolationFlatData) / 2,
                                               nPoints))
            endfMFList[LMF][MT] += endfFormatsModule.endfInterpolationList(
                interpolationFlatData)
            endfMFList[LMF][MT] += multiplicityList
        elif (LMF == 10):
            interpolationFlatData, flatData = reaction.crossSection[
                targetInfo['style']].toENDF6Data(MT, endfMFList, targetInfo,
                                                 level2)
            endfMFList[LMF][MT].append(
                endfFormatsModule.endfHeadLine(QM, QI, ZAP, LFS2,
                                               len(interpolationFlatData) / 2,
                                               len(flatData) / 2))
            endfMFList[LMF][MT] += endfFormatsModule.endfInterpolationList(
                interpolationFlatData)
            endfMFList[LMF][MT] += endfFormatsModule.endfDataList(flatData)

    endfMFList[8][MT].append(endfFormatsModule.endfSENDLineNumber())
    if (LMF not in [3, 6]):
        endfMFList[LMF][MT].append(endfFormatsModule.endfSENDLineNumber())
Esempio n. 8
0
    def processMultiGroup(self, style, tempInfo, indent):

        from fudge.processing import group as groupModule
        from fudge.processing.deterministic import transferMatrices as transferMatricesModule

        verbosity = tempInfo['verbosity']
        indent2 = indent + tempInfo['incrementalIndent']
        reactionSuite = tempInfo['reactionSuite']

        product = reactionSuite.PoPs[tempInfo['product'].id]
        productLabel = tempInfo['productLabel']

        energyUnit = tempInfo['incidentEnergyUnit']
        massUnit = energyUnit + '/c**2'
        # BRB6 hardwired
        mass2MeVFactor = PQUModule.PQU(1, energyUnit).getValueAs('MeV')

        if (verbosity > 2): print '%sGrouping %s' % (indent, self.moniker)
        projectileZA = tempInfo['projectileZA']
        targetZA = tempInfo['targetZA']
        if (targetZA == 6000):
            targetZA = 6012
            print '    Kludge for C_natural: changing targetZA from 6000 to %d' % targetZA
        productZA = miscPoPsModule.ZA(product)
        compoundZA = projectileZA + targetZA
        residualZA = compoundZA - productZA
        particlesData = {
            'projectile': {
                'ZA': projectileZA
            },
            'target': {
                'ZA': targetZA
            },
            'product': {
                'ZA': productZA
            },
            'residual': {
                'ZA': residualZA
            },
            'compound': {
                'ZA': compoundZA,
                'mass': tempInfo['projectileMass'] + tempInfo['targetMass']
            }
        }

        residualMass = tempInfo['masses']['Residual']  # Save old value. Why?
        residual = None
        compound = None
        residualSymbol = chemicalElementModule.symbolFromZ[residualZA // 1000]
        residualID = isotopeModule.isotopeIDFromElementIDAndA(
            residualSymbol, str(residualZA % 1000))
        if (residualID in reactionSuite.PoPs):
            residual = reactionSuite.PoPs[residualID]

        compoundSymbol = chemicalElementModule.symbolFromZ[compoundZA // 1000]
        compoundID = isotopeModule.isotopeIDFromElementIDAndA(
            compoundSymbol, str(compoundZA % 1000))
        if (compoundID in reactionSuite.PoPs):
            compound = reactionSuite.PoPs[compoundID]

        try:
            residual.getMass(massUnit)
        except:
            residual = None

        try:
            compound.getMass(massUnit)
        except:
            compound = None

        if (residual is None):
            if (compound is None):
                _residualMass = particlesData['compound'][
                    'mass'] - product.getMass(massUnit)
            else:
                _residualMass = compound.getMass(massUnit) - product.getMass(
                    massUnit)
            tempInfo['masses']['Residual'] = _residualMass
            print 'Could not find residual in particle database: ZA = %d, using mass %s %s' % (
                residualZA, _residualMass, massUnit)
        else:
            tempInfo['masses']['Residual'] = residual.getMass(massUnit)

        masses = tempInfo['masses']
        tempInfo['masses'] = {}
        for particle in masses:
            tempInfo['masses'][particle] = masses[particle] * mass2MeVFactor
        particlesData['compound']['mass'] *= mass2MeVFactor
        try:
            TM_1, TM_E = transferMatricesModule.KalbachMann_TransferMatrix(
                style,
                tempInfo,
                tempInfo['crossSection'],
                particlesData,
                self,
                tempInfo['multiplicity'],
                comment=tempInfo['transferMatrixComment'] +
                ' outgoing data for %s' % tempInfo['productLabel'])
        except:
            tempInfo['masses'] = masses
            raise
        tempInfo['masses'] = masses

        tempInfo['masses']['Residual'] = residualMass
        return (groupModule.TMs2Form(style, tempInfo, TM_1, TM_E))
Esempio n. 9
0
# <<END-copyright>>

from xml.etree import cElementTree

from PoPs import database as databaseModule
from PoPs import alias as aliasModule
from PoPs.families import gaugeBoson as gaugeBosonModule
from PoPs.families import baryon as baryonModule
from PoPs.families import nucleus as nucleusModule
from PoPs.groups import chemicalElement as chemicalElementModule

from PoPs import misc as miscModule

pops = databaseModule.database.readFile('p.xml')

ids_ZAs = []
for particle in pops:
    ids_ZAs.append([miscModule.ZA(particle), particle.id])

ids_ZAs.sort()
for ZA, _id in ids_ZAs:
    print "%-8s %s" % (ZA, _id)

ids_ZAs = []
for particle in pops:
    ids_ZAs.append([miscModule.ZAInfo(particle), particle.id])

ids_ZAs.sort()
for ZA, _id in ids_ZAs:
    print "%-8s %s" % (ZA, _id)
Esempio n. 10
0
def toENDF6(self,
            style,
            flags,
            verbosityIndent='',
            covarianceSuite=None,
            useRedsFloatFormat=False,
            lineNumbers=True,
            **kwargs):

    _useRedsFloatFormat = endfFormatsModule.useRedsFloatFormat
    endfFormatsModule.useRedsFloatFormat = useRedsFloatFormat

    evaluatedStyle = self.styles.getEvaluatedStyle()
    if (evaluatedStyle is None): raise ValueError('no evaluation style found')

    if (flags['verbosity'] >= 10):
        print '%s%s' % (verbosityIndent,
                        self.inputParticlesToReactionString(suffix=" -->"))
    verbosityIndent2 = verbosityIndent + ' ' * (
        len(self.inputParticlesToReactionString(suffix=" -->")) + 1)

    projectileZA = miscPoPsModule.ZA(self.PoPs[self.projectile])
    IPART = projectileZA
    if (self.projectile == 'e-'): IPART = 11

    targetZA, MAT = endf_endlModule.ZAAndMATFromParticleName(self.target)
    targetZ, targetA = divmod(targetZA, 1000)

    targetInfo = {}
    targetInfo['massTracker'] = massTrackerModule.massTracker()
    for particle in self.PoPs:
        if (isinstance(particle,
                       (gaugeBosonPoPsModule.particle,
                        leptonPoPsModule.particle, isotopePoPsModule.suite))):
            ZA = miscPoPsModule.ZA(particle)
            if (isinstance(particle, isotopePoPsModule.suite)):
                if (particle[0].intIndex != 0): continue
            if (len(particle.mass) > 0):
                targetInfo['massTracker'].addMassAMU(ZA,
                                                     particle.getMass('amu'))
        elif (isinstance(particle, chemicalElementPoPsModule.suite)):
            ZA = 1000 * particle.Z
            targetInfo['massTracker'].addMassAMU(
                ZA, targetInfo['massTracker'].getElementalMassAMU(ZA))

    targetInfo['style'] = style
    targetInfo['reactionSuite'] = self
    targetInfo['ZA'] = targetZA

    target = self.PoPs[self.target]

    levelIndex = 0
    levelEnergy_eV = 0
    if (isinstance(target, nuclearLevelPoPsModule.particle)):  # isomer target
        levelIndex = target.intIndex
        levelEnergy_eV = target.energy[0].float('eV')
    targetInfo['mass'] = targetInfo['massTracker'].getMassAWR(
        targetZA, levelEnergyInEv=levelEnergy_eV)

    targetInfo['LIS'] = levelIndex
    targetInfo['metastables'] = {}
    targetInfo['LISO'] = 0
    if (levelIndex > 0): targetInfo['LISO'] = 1
    # BRBBRB
    for alias in self.PoPs.aliases:
        if (hasattr(alias, 'metaStableIndex')):
            targetInfo['metastables'][alias.pid] = alias
    MAT += targetInfo['LISO']
    if (self.MAT is not None): MAT = self.MAT

    ITYPE = 0
    for reaction in self.reactions:
        if (500 <= reaction.ENDF_MT < 573): ITYPE = 3
    targetInfo['crossSectionMF'] = {0: 3, 3: 23}[ITYPE]

    targetInfo['delayedRates'] = []
    targetInfo['MTs'], targetInfo['MF8'], targetInfo['LRs'] = {}, {}, {}
    endfMFList = {
        1: {
            451: []
        },
        2: {},
        3: {},
        4: {},
        5: {},
        6: {},
        8: {},
        9: {},
        10: {},
        12: {},
        13: {},
        14: {},
        15: {},
        23: {},
        26: {},
        27: {},
        31: {},
        32: {},
        33: {},
        34: {},
        35: {},
        40: {}
    }
    if (self.resonances
            is not None):  # Add resonances, independent of reaction channels
        self.resonances.toENDF6(endfMFList,
                                flags,
                                targetInfo,
                                verbosityIndent=verbosityIndent2)

    targetInfo['production_gammas'] = {}

    for multiplicitySum in self.sums.multiplicities:
        if multiplicitySum.ENDF_MT == 452:
            targetInfo['totalNubar'] = multiplicitySum.multiplicity.evaluated
        elif multiplicitySum.ENDF_MT == 455:
            targetInfo[
                'totalDelayedNubar'] = multiplicitySum.multiplicity.evaluated

    for reaction in self:
        reaction.toENDF6(endfMFList,
                         flags,
                         targetInfo,
                         verbosityIndent=verbosityIndent2)
    gndToENDF6Module.upDateENDFMF8Data(endfMFList, targetInfo)
    for MT, production_gammas in targetInfo['production_gammas'].items():
        MF, production_gammas = production_gammas[0], production_gammas[1:]
        for productionReaction in production_gammas:
            gammas = [gamma for gamma in productionReaction.outputChannel]
            targetInfo['crossSection'] = productionReaction.crossSection[
                targetInfo['style']]
            gndToENDF6Module.gammasToENDF6_MF12_13(MT, MF, endfMFList, flags,
                                                   targetInfo, gammas)

    for particle in self.PoPs:
        if (isinstance(particle, nucleusPoPsModule.particle)):
            if (len(particle.decayData.decayModes) > 0):
                for baseMT in [50, 600, 650, 700, 750, 800]:
                    residualZA = endf_endlModule.ENDF_MTZAEquation(
                        projectileZA, targetZA, baseMT)[0][-1]
                    atomID = particle.findClassInAncestry(
                        isotopePoPsModule.suite).id
                    if (nuclearModule.nucleusNameFromZA(residualZA) == atomID):
                        break
                addDecayGamma(self.PoPs, particle, baseMT, endfMFList, flags,
                              targetInfo)

    if 'totalNubar' in targetInfo:
        multiplicityModule.fissionNeutronsToENDF6(452,
                                                  targetInfo['totalNubar'],
                                                  endfMFList, flags,
                                                  targetInfo)
    if 'promptNubar' in targetInfo:
        multiplicityModule.fissionNeutronsToENDF6(456,
                                                  targetInfo['promptNubar'],
                                                  endfMFList, flags,
                                                  targetInfo)
    if 'totalDelayedNubar' in targetInfo:
        MF5MT455s = endfMFList[5][455]

        endfMFList[1][455] = [
            endfFormatsModule.endfHeadLine(targetZA, targetInfo['mass'], 0, 2,
                                           0, 0)
        ]  # Currently, only LDG = 0, LNU = 2 is supported.
        endfMFList[1][455] += [
            endfFormatsModule.endfHeadLine(0, 0, 0, 0,
                                           len(targetInfo['delayedRates']), 0)
        ]
        endfMFList[1][455] += endfFormatsModule.endfDataList(
            targetInfo['delayedRates'])

        multiplicityModule.fissionNeutronsToENDF6(
            455, targetInfo['totalDelayedNubar'], endfMFList, flags,
            targetInfo)

        MF5MT455List = [
            endfFormatsModule.endfHeadLine(targetZA, targetInfo['mass'], 0, 0,
                                           len(MF5MT455s), 0)
        ]
        for MF5MT455 in MF5MT455s:
            MF5MT455List += MF5MT455
        if (len(MF5MT455s) == 0):
            del endfMFList[5][455]
        else:
            endfMFList[5][455] = MF5MT455List + [
                endfFormatsModule.endfSENDLineNumber()
            ]

    if (covarianceSuite):
        covarianceSuite.toENDF6(endfMFList, flags, targetInfo)

    endfDoc = self.documentation.get('endfDoc')
    if (endfDoc is None):
        docHeader2 = [
            ' %2d-%-2s-%3d LLNL       EVAL-OCT03 Unknown' %
            (targetZ, nuclearModule.elementSymbolFromZ(targetZ), targetA),
            '                      DIST-DEC99                       19990101   ',
            '----ENDL              MATERIAL %4d' % MAT,
            '-----INCIDENT %s DATA' % {
                1: 'NEUTRON',
                1001: 'PROTON',
                1002: 'DEUTERON',
                1003: 'TRITON',
                2003: 'HELION',
                2004: 'ALPHA'
            }[projectileZA], '------ENDF-6 FORMAT'
        ]
        endfDoc = [
            'LLNL ENDL file translated to ENDF6 by FUDGE.', ''
            ' ************************ C O N T E N T S ***********************'
        ]
        endlDoc = self.documentation.get('ENDL').getLines()
        endlDoc2 = []
        if endlDoc != None:
            for line in endlDoc:
                if 'endep' in line:  # remove text from the line before the ones containing 'endep'
                    del endlDoc2[-1]
                    break
                newline = textwrap.wrap(line,
                                        width=66,
                                        drop_whitespace=False,
                                        subsequent_indent='    ')
                if len(newline) == 0:
                    newline = [' '
                               ]  # do not let blank lines disappear altogether
                endlDoc2 += newline
            endfDoc = endlDoc2 + endfDoc
    else:
        docHeader2 = []
        endfDoc = endfDoc.getLines()

        # update the documentation, including metadata on first 4 lines:
    if self.getReaction('fission') is not None:
        LFI = True
    else:
        LFI = False
    LRP = -1
    if (self.resonances is not None):
        if (self.resonances.scatteringRadius):
            LRP = 0
        elif (self.resonances.reconstructCrossSection):
            LRP = 1
        elif (self.resonances.unresolved
              and not self.resonances.resolved):  # self-shielding only
            LRP = 1
        else:
            LRP = 2

    crossSectionScale = self.reactions[0].domainUnitConversionFactor('eV')
    EMAX = max([
        crossSectionScale * reaction.crossSection.domainMax
        for reaction in self.reactions
    ])

    temperature = self.styles[style].temperature.getValueAs('K')
    library = evaluatedStyle.library
    version = evaluatedStyle.version
    if (
            library == 'ENDL'
    ):  # Additional ENDF meta-data. If the library is unknown, use NLIB = -1
        NVER, LREL, NMOD = 1, 1, 1
        NLIB = -1
    else:
        NVER, LREL, NMOD = map(int,
                               version.split('.'))  # Version stored as '7.2.1'
        NLIB = {
            "ENDF/B": 0,
            "ENDF/A": 1,
            "JEFF": 2,
            "EFF": 3,
            "ENDF/B (HE)": 4,
            "CENDL": 5,
            "JENDL": 6,
            "SG-23": 21,
            "INDL/V": 31,
            "INDL/A": 32,
            "FENDL": 33,
            "IRDF": 34,
            "BROND (IAEA version)": 35,
            "INGDB-90": 36,
            "FENDL/A": 37,
            "BROND": 41
        }.get(library, -1)

    NFOR = 6  # ENDF-6 format
    NSUB = 10 * IPART + ITYPE
    LDRV = 0

    NLIB = kwargs.get('NLIB', NLIB)

    STA = 0
    target = self.PoPs[self.target]
    if (isinstance(target, isotopePoPsModule.suite)):
        target = target[0]
        if (len(target.nucleus.halflife) > 0):
            if (target.nucleus.halflife[0].value == halflifePoPsModule.UNSTABLE
                ):
                STA = 1
    if (levelIndex > 0): STA = 1

    projectileMass = targetInfo['massTracker'].getMassAWR(projectileZA,
                                                          asTarget=False)
    docHeader = [
        endfFormatsModule.endfHeadLine(targetZA, targetInfo['mass'], LRP, LFI,
                                       NLIB, NMOD),
        endfFormatsModule.endfHeadLine(levelEnergy_eV, STA, levelIndex,
                                       targetInfo['LISO'], 0, NFOR),
        endfFormatsModule.endfHeadLine(projectileMass, EMAX, LREL, 0, NSUB,
                                       NVER),
        endfFormatsModule.endfHeadLine(temperature, 0, LDRV, 0,
                                       len(docHeader2 + endfDoc), -1)
    ]
    new_doc = documentationModule.documentation(
        'endf', '\n'.join(docHeader + docHeader2 + endfDoc))
    endfMFList[1][451] += endfFormatsModule.toEndfStringList(new_doc)

    endfFormatsModule.useRedsFloatFormat = _useRedsFloatFormat

    return (endfFormatsModule.endfMFListToFinalFile(endfMFList,
                                                    MAT,
                                                    lineNumbers=lineNumbers))