Ejemplo n.º 1
0
def readMF1MT451(_MAT,
                 _MTDatas,
                 styleName='eval',
                 logFile=None,
                 verboseWarnings=False,
                 **kwargs):

    # We're going to save everything in the info instance
    info = toGNDMisc.infos(styleName)
    info.doRaise = []
    info.logs = logFile
    info.verboseWarnings = verboseWarnings

    # Line #1
    targetZA, targetMass, LRP, LFI, NLIB, NMOD = \
        endfFileToGNDMisc.sixFunkyFloatStringsToFloats( _MTDatas[451][1][0], logFile=logFile )
    targetZA = int(targetZA)  # Target's ZA
    LRP = int(LRP)  # Resonance parameter data info
    LFI = int(LFI)  # Is fission present
    NLIB = int(NLIB)  # What library (e.g., 0 = ENDF/B
    NMOD = int(NMOD)  # Version modification flag
    isNaturalTarget = (targetZA % 1000) == 0

    # Line #2
    targetExcitationEnergy, STA, LIS, LISO, dummy, NFOR = \
        endfFileToGNDMisc.sixFunkyFloatStringsToFloats( _MTDatas[451][1][1], logFile=logFiles )
    STA = int(STA)  # Is nucleus unstable
    LIS = int(LIS)  # Excitation number
    LISO = int(LISO)  # Isomeric state number
    NFOR = int(NFOR)  # Must be 6 for ENDF-6 format
    if (NFOR != 6):
        print(
            "    WARNING: endfFileToGND only supports ENDF-6 format. This file has unsupported NFOR=%d"
            % NFOR)

    # Line #3
    projectileMass, EMAX, LREL, dummy, NSUB, NVER = \
        endfFileToGNDMisc.sixFunkyFloatStringsToFloats( _MTDatas[451][1][2], logFile=logFiles )
    NSUB = int(NSUB)  # 10 * ZA + iType for projectile
    NVER = int(NVER)  # Evaluation version number
    LREL = int(LREL)  # Evaluation sub-version number
    IPART, ITYPE = NSUB / 10, NSUB % 10
    projectileZA = IPART
    if (projectileZA == 11): projectileZA = 9

    # Line #4
    targetTemperature, dummy, LDRZ, dummy, NWD, NXC = \
        endfFileToGNDMisc.sixFunkyFloatStringsToFloats( _MTDatas[451][1][3], logFile=logFiles )
    LDRZ = int(LDRZ)  # Primary or special evaluation of this material
    NWD = int(NWD)  #
    NXC = int(NXC)  #

    # Save the library name and version
    info.library = {
        0: "ENDF/B",
        1: "ENDF/A",
        2: "JEFF",
        3: "EFF",
        4: "ENDF/B (HE)",
        5: "CENDL",
        6: "JENDL",
        21: "SG-23",
        31: "INDL/V",
        32: "INDL/A",
        33: "FENDL",
        34: "IRDF",
        35: "BROND (IAEA version)",
        36: "INGDB-90",
        37: "FENDL/A",
        41: "BROND",
    }.get(NLIB, 'Unknown')
    info.evaluation = info.library  # why do I need this?
    info.libraryVersion = "%d.%d.%d" % (NVER, LREL, NMOD)

    # Save the evaluation date
    try:
        info.Date = endfFileToGNDMisc.getENDFDate(_MTDatas[451][1][4][22:33])
    except Exception as e:
        if not kwargs.get('ignoreBadDate'):
            info.doRaise.append(str(e))
        import datetime
        info.Date = datetime.datetime.today().strftime("%Y-%m-%d")

    # Save general information
    info.author = _MTDatas[451][1][4][33:66]
    info.documentation = fudge.gnd.documentation.documentation(
        'endfDoc', '\n'.join(_MTDatas[451][1][4:4 + NWD]))
    info.MAT = _MAT
    info.LISO = LISO
    info.LIS = LIS
    info.EMAX = EMAX
    info.levelIndex = LIS
    info.NSUB = NSUB
    info.LFI = LFI
    info.STA = STA
    info.targetTemperature = targetTemperature
    info.materialName = _MTDatas[451][1][4][:11].strip()
    info.targetMass = targetMass
    info.isNaturalTarget = isNaturalTarget
    info.LRP = LRP
    info.NLIB = NLIB
    info.NMOD = NMOD
    info.NVER = NVER
    info.LREL = LREL
    info.NXC = NXC
    info.NWD = NWD
    info.LDRZ = LDRZ
    info.ITYPE = ITYPE

    # All evaluations need a particle database and we fill in a lot of that information from MF1MT451
    info.PoPsLabel = 'default'
    info.PoPs = databasePoPsModule.database('protare_internal', '1.0')

    # Let's tell info about the target
    info.targetZA = targetZA
    info.targetLevel = LIS
    info.level = targetExcitationEnergy
    info.addMassAWR(info.targetZA, targetMass)

    # If there is a projectile, tell info about it too
    if ITYPE in [4, 5]:
        info.projectile = None
        info.projectileZA = None
    else:
        info.projectile = {
            0: 'g',
            1: 'n',
            11: 'e-',
            1001: 'H1',
            1002: 'H2',
            1003: 'H3',
            2003: 'He3',
            2004: 'He4'
        }[IPART]
        info.projectileZA = projectileZA
        info.addMassAWR(projectileZA, projectileMass, asTarget=False)

    return info
Ejemplo n.º 2
0
# <<END-copyright>>

import random

from PoPs import database as databaseModule

from PoPs.families import gaugeBoson as gaugeBosonModule
from PoPs.families import lepton as leptonModule
from PoPs.families import baryon as baryonModule
from PoPs.families import nucleus as nucleusModule
from PoPs.families import nuclearLevel as nuclearLevelModule

from PoPs.groups import isotope as isotopeModule
from PoPs.groups import chemicalElement as chemicalElementModule

database = databaseModule.database( 'test', '1.2.3' )

#
# Test adding an isotope to database.
#
photon = gaugeBosonModule.particle( 'photon' )
database.add( photon )

#
# Test adding leptons to database.
#
lepton = leptonModule.particle( 'e-', generation = 'electronic' )
database.add( lepton )

lepton = leptonModule.particle( 'mu-_anti', generation = 'muonic' )
database.add( lepton )
Ejemplo n.º 3
0
# herein do not necessarily state or reflect those of the United States Government or
# Lawrence Livermore National Security, LLC, and shall not be used for advertising or
# product endorsement purposes.
#
# <<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

pops = databaseModule.database('LLNL', '0.0.1')

element = cElementTree.parse('pops.xml')
element = element.getroot()


def aliases(element):

    for child in element:
        _alias = aliasModule.particle(child.get('id'), child.get('pid'))
        pops.add(_alias)


def gaugeBosons(element):

    for child in element: