Esempio n. 1
0
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 )

#
# Test adding baryons to database.
#
baryon = baryonModule.particle( 'p' )
database.add( baryon )

baryon = baryonModule.particle( 'n_anti' )
database.add( baryon )

#
# Test adding a nuclear level to database.
#
nucleus = nucleusModule.particle( 'o16_e12', index = '12' )
level = nuclearLevelModule.particle( 'O16_e12', nucleus )
database.add( level )

#
# Test adding an isotope to database.
#
Esempio n. 2
0
def getPoPsParticle(info,
                    ZA,
                    name=None,
                    levelIndex=None,
                    level=0.,
                    levelUnit='MeV'):

    if (levelIndex not in ['c', 's', None]):
        levelIndex = int(levelIndex)
        if (levelIndex < 0):
            raise Exception('levelIndex = %d must be >= 0' % levelIndex)

    particle = None

    if (ZA in [0, 17]): ZA = 7
    if (name is not None):
        pass
    elif (ZA == 1):
        particle = baryonModule.particle('n')
        addParticleData(particle, info, 1.00866491574, "1/2", 1, 0, 881.5)
        name = particle.id
    elif (ZA == 7):
        particle = gaugeBosonModule.particle(IDsPoPsModule.photon)
        addParticleData(particle, info, 0.0, "1", 1, 0, halflifeModule.STABLE)
        name = particle.id
    elif (ZA == 8):
        particle = leptonModule.particle('e+', generation='electronic')
        # BRB need to make it 'e-_anti' and alias to 'e+'.
        #        particle = leptonModule.particle( 'e-_anti', generation = 'electronic' )
        addParticleData(particle, info, 5.485799090e-4, "1/2", -1, 1,
                        halflifeModule.STABLE)
        name = particle.id
    elif (ZA == 9):
        particle = leptonModule.particle('e-', generation='electronic')
        addParticleData(particle, info, 5.485799090e-4, "1/2", 1, -1,
                        halflifeModule.STABLE)
        name = particle.id
    elif (ZA in [99120, 99125]):
        name = ZAToName(ZA)
        particle = unorthodoxModule.particle(name)
        mass = massModule.double(info.PoPsLabel, 117.5,
                                 quantityModule.stringToPhysicalUnit('amu'))
        particle.mass.add(mass)
    else:
        name = ZAToName(ZA)
        if (levelIndex is None):
            levelIndex = 0
            level = 0.
        if (level < 0.):
            raise Exception(
                'Negative value = %s for continuum is not allowed' % level)
        if (levelIndex in ['c', 's']):  # to continuum or sum of all levels.
            level = PQUModule.PQU(
                PQUModule.pqu_float.surmiseSignificantDigits(level), levelUnit)
            name += "_%s" % levelIndex
        else:
            level = PQUModule.PQU(
                PQUModule.pqu_float.surmiseSignificantDigits(level), levelUnit)
            name += '_e%d' % levelIndex

    nucleus = None
    if ((particle is None) and (name not in info.PoPs)):

        if (level is not None):  # Add a nuclearLevel/isotope.
            baseName = name.split('_')[
                0]  # Always need to add ground state before excited level.
            if ('natural' in name):
                baseName = '_'.join(name.split('_')[:2])
            elif ('FissionProduct' in name):
                baseName = name.split('_')[0]

            index = levelIndex
            if (level.getValueAs('MeV') == 0.): index = 0

            particle = nuclearLevelModule.particle(name)
            charge = chargeModule.integer(info.PoPsLabel, 0,
                                          chargeModule.baseUnit)
            particle.charge.add(charge)

            nucleusName = name[0].lower() + name[1:]
            nucleus = nucleusModule.particle(nucleusName, str(levelIndex))
            energy = nuclearEnergyLevelModule.double(info.PoPsLabel,
                                                     float(level), level.unit)
            nucleus.energy.add(energy)
            charge = chargeModule.integer(info.PoPsLabel, ZA / 1000,
                                          chargeModule.baseUnit)
            nucleus.charge.add(charge)
            particle.nucleus = nucleus
            addNucleusInfoForLightNuclei(ZA, nucleus, info)
        else:
            if (particle is None):
                if ('FissionProduct' in name):
                    particleOrLevel = gnd.xParticle.FissionProduct(
                        name, mass=massUnit, attributes=particleQualifiers)
                elif ('TNSL' in name):
                    particleOrLevel = gnd.xParticle.thermalNeutronScatteringLawIsotope(
                        name, mass=massUnit, attributes=particleQualifiers)
                else:
                    particleOrLevel = gnd.xParticle.isotope(
                        name, mass=massUnit, attributes=particleQualifiers)
    else:
        if (particle is None): particle = info.PoPs[name]

    if (name not in info.PoPs): info.PoPs.add(particle)

    if (isinstance(particle, nuclearLevelModule.particle)):
        if (particle.intIndex == 0): particle = particle.getAncestor()

    return (particle)
Esempio n. 3
0
    database.add(lepton)

database.add(aliasModule.particle('electron', 'e-'))
database.add(aliasModule.particle('e+', 'e-_anti'))
database.add(aliasModule.particle('positron', 'e-_anti'))
database.add(aliasModule.particle('h2', 'h2_e0'))
database.add(aliasModule.particle('d', 'h2'))
database.add(aliasModule.particle('h3', 'h3_e0'))
database.add(aliasModule.particle('t', 'h3'))

baryons = [['n', 1.00866491588, 0, 881.5, '1/2', 1],
           ['p', 1.007276466812, 1, 'stable', '1/2', 1]]

for _id, _mass, _charge, _halflife, _spin, _parity in baryons:
    for anti in ['', '_anti']:
        baryon = baryonModule.particle(_id + anti)

        mass = massModule.double('base', _mass,
                                 quantityModule.stringToPhysicalUnit('amu'))
        baryon.mass.add(mass)

        charge = chargeModule.integer('base', _charge,
                                      quantityModule.stringToPhysicalUnit('e'))
        baryon.charge.add(charge)

        if (_halflife == 'stable'):
            halflife = halflifeModule.string(
                'base', _halflife, quantityModule.stringToPhysicalUnit('s'))
        else:
            halflife = halflifeModule.double(
                'base', _halflife, quantityModule.stringToPhysicalUnit('s'))
Esempio n. 4
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 PoPs.quantities import quantity as quantityModule
from PoPs.quantities import mass as massModule
from PoPs.quantities import spin as spinModule
from PoPs.quantities import parity as parityModule
from PoPs.quantities import charge as chargeModule
from PoPs.quantities import halflife as halflifeModule

from PoPs.families import baryon as baryonModule

proton = baryonModule.particle('p')

mass = massModule.double('base', 1.007276466812,
                         quantityModule.stringToPhysicalUnit('amu'))
proton.mass.add(mass)

charge = chargeModule.integer('base', 1,
                              quantityModule.stringToPhysicalUnit('e'))
proton.charge.add(charge)

halflife = halflifeModule.string('base', 'stable',
                                 quantityModule.stringToPhysicalUnit('s'))
proton.halflife.add(halflife)

spin = spinModule.fraction('base', spinModule.fraction.toValueType('1/2'),
                           quantityModule.stringToPhysicalUnit('hbar'))