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

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

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

#
Ejemplo n.º 2
0
spin = spinModule.fraction('base', spinModule.fraction.toValueType('1'),
                           quantityModule.stringToPhysicalUnit('hbar'))
photon.spin.add(spin)

parity = parityModule.integer('base', 1,
                              quantityModule.stringToPhysicalUnit(''))
photon.parity.add(parity)

database.add(photon)

leptons = [['e-', 5.48579909070e-4, -1, 'stable', '1/2', 1, 'electronic'],
           ['e-_anti', 5.48579909070e-4, 1, 'stable', '1/2', -1, 'electronic'],
           ['mu', 0.1134289267, -1, 2.1969811e-6, '1/2', 1, 'muonic']]

for id, mass, charge, halflife, spin, parity, generation in leptons:
    lepton = leptonModule.particle(id, generation=generation)

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

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

    if (halflife == 'stable'):
        halflife = halflifeModule.string(
            'base', halflife, quantityModule.stringToPhysicalUnit('s'))
    else:
        halflife = halflifeModule.double(
            'base', halflife, quantityModule.stringToPhysicalUnit('s'))
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 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 lepton as leptonModule

electron = leptonModule.particle('e-', generation='electronic')

mass = massModule.double('base', 5.48579909070e-4,
                         quantityModule.stringToPhysicalUnit('amu'))
electron.mass.add(mass)

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

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

spin = spinModule.fraction('base', spinModule.fraction.toValueType('1/2'),
                           quantityModule.stringToPhysicalUnit('hbar'))
Ejemplo n.º 4
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)