From: Jörg Buchwald Date: Sat, 18 Feb 2006 18:28:47 +0000 (+0000) Subject: readded spin and magnetic moment and halflife X-Git-Tag: v3.80.2~173 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=0c9e6cbb8fc9cdcfbeb6d87caae17734d6dfb578;p=libqmvoc.git readded spin and magnetic moment and halflife svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=511056 --- diff --git a/libscience/chemicaldataobject.cpp b/libscience/chemicaldataobject.cpp index 1a79d65..0a799d7 100644 --- a/libscience/chemicaldataobject.cpp +++ b/libscience/chemicaldataobject.cpp @@ -155,6 +155,15 @@ QString ChemicalDataObject::dictRef() const case exactMass: botype = "exactMass"; break; + case spin: + botype = "spin"; + break; + case magneticMoment: + botype = "magneticMoment"; + break; + case halfLife: + botype = "halfLife"; + break; case ionization: botype = "ionization"; break; @@ -262,6 +271,10 @@ ChemicalDataObject::BlueObeliskUnit ChemicalDataObject::unit( const QString& uni return ChemicalDataObject::nm; else if ( unit == "bo:pm" ) return ChemicalDataObject::pm; + else if ( unit == "bo:y" ) + return ChemicalDataObject::y; + else if ( unit == "bo:s" ) + return ChemicalDataObject::s; else if ( unit == "bo:noUnit" ) return ChemicalDataObject::noUnit; else diff --git a/libscience/chemicaldataobject.h b/libscience/chemicaldataobject.h index 09ecb7b..70b340d 100644 --- a/libscience/chemicaldataobject.h +++ b/libscience/chemicaldataobject.h @@ -69,14 +69,17 @@ class ChemicalDataObject date/**< date of discovery of the element. When 0, the element has been known in ancient times. */, discoverers/** The name of the discoverers, separated by semicolomns */, relativeAbundance/** The abundance, relative to 100 */, + spin/**< The spin */, + magneticMoment/**< The magnetic dipole moment */, + halfLife/**< The halflife */, alphapercentage/**< The percentage of alphadecay */, - alphadecay/**< The decayenergy of alphadecay in MeV */, + alphaDecay/**< The decayenergy of alphadecay in MeV */, betapluspercentage/**< The percentage of betaplusdecay */, - betaplusdecay/**< The decayenergy of betaplusdecay in MeV */, + betaplusDecay/**< The decayenergy of betaplusdecay in MeV */, betaminuspercentage/**< The percentage of betaminusdecay */, - betaminusdecay/**< The decayenergy of betaminusdecay in MeV */, + betaminusDecay/**< The decayenergy of betaminusdecay in MeV */, ecpercentage/**< The percentage of ecdecay */, - ecdecay/**< The decayenergy of ecminusdecay in MeV */, + ecDecay/**< The decayenergy of ecminusdecay in MeV */, }; /** diff --git a/libscience/isotope.cpp b/libscience/isotope.cpp index 9ee1de9..24b5c62 100644 --- a/libscience/isotope.cpp +++ b/libscience/isotope.cpp @@ -51,6 +51,12 @@ void Isotope::addData( ChemicalDataObject* o ) m_identifier = o; else if ( o->type() == ChemicalDataObject::symbol ) m_parentElementSymbol = o; + else if ( o->type() == ChemicalDataObject::spin ) + m_spin = o; + else if ( o->type() == ChemicalDataObject::magneticMoment ) + m_magmoment = o; + else if ( o->type() == ChemicalDataObject::halfLife ) + m_halflife = o; } double Isotope::mass() const @@ -68,6 +74,21 @@ int Isotope::parentElementNumber() const return m_identifier->value().toInt(); } +QString Isotope::spin() const +{ + return m_spin->value().toString(); +} + +QString Isotope::magmoment() const +{ + return m_magmoment->value().toString(); +} + +double Isotope::halflife() const +{ + return m_halflife->value().toDouble(); +} + QString Isotope::parentElementSymbol() const { return m_parentElementSymbol->value().toString(); diff --git a/libscience/isotope.h b/libscience/isotope.h index fe19d1e..bb40df3 100644 --- a/libscience/isotope.h +++ b/libscience/isotope.h @@ -46,6 +46,12 @@ class Isotope QString parentElementSymbol() const; + QString spin() const; + + QString magmoment() const; + + double halflife() const; + void addData( ChemicalDataObject* o ); private: @@ -63,6 +69,22 @@ class Isotope * stores the atomicNumber of the Isotope */ ChemicalDataObject* m_identifier; + + /** + * stores the spin of the Isotope + */ + ChemicalDataObject* m_spin; + + /** + * stores the magneticMoment of the Isotope + */ + ChemicalDataObject* m_magmoment; + + /** + * stores the halfLife of the Isotope + */ + ChemicalDataObject* m_halflife; + }; #endif // ISOTOPE_H diff --git a/libscience/isotopeparser.cpp b/libscience/isotopeparser.cpp index cff2582..c7eb086 100644 --- a/libscience/isotopeparser.cpp +++ b/libscience/isotopeparser.cpp @@ -29,13 +29,16 @@ public: inIsotope(false), inAtomicNumber(false), inExactMass(false), + inSpin(false), + inMagMoment(false), + inHalfLife(false), inAlphaPercentage(false), inAlphaDecay(false), inBetaplusPercentage(false), inBetaplusDecay(false), inBetaminusPercentage(false), inBetaminusDecay(false), - inECPercentage(false), + inECPercentage(false), inECDecay(false), inAbundance(false) { @@ -52,6 +55,9 @@ public: bool inIsotope; bool inAtomicNumber; bool inExactMass; + bool inSpin; + bool inMagMoment; + bool inHalfLife; bool inAlphaPercentage; bool inAlphaDecay; bool inBetaplusPercentage; @@ -86,6 +92,31 @@ bool IsotopeParser::startElement(const QString&, const QString &localName, const if ( attrs.localName( i ) == "elementType" ) d->currentElementSymbol = attrs.value( i ); } + } else if (d->inIsotope && localName == "bo:spin") { + kDebug() << "bo:spin" << endl; + d->inSpin = true; + } else if (d->inIsotope && localName == "bo:magneticMoment") { + kDebug() << "bo:magneticMoment" << endl; + d->inMagMoment = true; + } else if (d->inIsotope && localName == "bo:halfLife") { + kDebug() << "bo:halfLife" << endl; + d->inHalfLife = true; + if ( d->currentUnit != ChemicalDataObject::noUnit ) + d->currentDataObject->setUnit( d->currentUnit ); + + d->currentUnit = ChemicalDataObject::noUnit; + } else if (d->inIsotope && localName == "bo:alphaDecay"){ + kDebug() << "bo:alphaDecay" << endl; + d->inAlphaDecay = true; + } else if (d->inIsotope && localName == "bo:betaplusDecay"){ + kDebug() << "bo:betaplusDecay" << endl; + d->inBetaplusDecay = true; + } else if (d->inIsotope && localName == "bo:betaminusDecay"){ + kDebug() << "bo:betaminusDecay" << endl; + d->inBetaminusDecay = true; + } else if (d->inIsotope && localName == "bo:ecDecay"){ + kDebug() << "bo:ecDecay" << endl; + d->inECDecay = true; } else if (d->inIsotope && localName == "scalar") { for (int i = 0; i < attrs.length(); ++i) @@ -98,22 +129,6 @@ bool IsotopeParser::startElement(const QString&, const QString &localName, const if (attrs.value(i) == "bo:atomicNumber") d->inAtomicNumber = true; - else if (attrs.value(i) == "bo:alphapercentage") - d->inAlphaPercentage = true; - else if (attrs.value(i) == "bo:alphadecay") - d->inAlphaDecay = true; - else if (attrs.value(i) == "bo:betapluspercentage") - d->inBetaplusPercentage = true; - else if (attrs.value(i) == "bo:betaplusdecay") - d->inBetaplusDecay = true; - else if (attrs.value(i) == "bo:betaminuspercentage") - d->inBetaminusPercentage = true; - else if (attrs.value(i) == "bo:betaminusdecay") - d->inBetaminusDecay = true; - else if (attrs.value(i) == "bo:ecpercentage") - d->inECPercentage = true; - else if (attrs.value(i) == "bo:ecdecay") - d->inECDecay = true; else if (attrs.value(i) == "bo:exactMass") d->inExactMass = true; } @@ -161,45 +176,40 @@ bool IsotopeParser::characters(const QString &ch) type = ChemicalDataObject::atomicNumber; d->inAtomicNumber = false; } - else if (d->inAlphaPercentage) { - value = ch.toDouble(); - type = ChemicalDataObject::alphapercentage; - d->inAtomicNumber = false; + else if (d->inSpin) { + value = ch; + type = ChemicalDataObject::spin; + d->inSpin = false; } - else if (d->inAlphaDecay) { - value = ch.toDouble(); - type = ChemicalDataObject::alphadecay; - d->inAtomicNumber = false; + else if (d->inMagMoment) { + value = ch; + type = ChemicalDataObject::magneticMoment; + d->inMagMoment = false; } - else if (d->inBetaplusPercentage) { + else if (d->inHalfLife) { value = ch.toDouble(); - type = ChemicalDataObject::betapluspercentage; - d->inAtomicNumber = false; + type = ChemicalDataObject::halfLife; + d->inHalfLife = false; } - else if (d->inBetaplusDecay) { + else if (d->inAlphaDecay) { value = ch.toDouble(); - type = ChemicalDataObject::betaplusdecay; - d->inAtomicNumber = false; + type = ChemicalDataObject::alphaDecay; + d->inAlphaDecay = false; } - else if (d->inBetaminusPercentage) { + else if (d->inBetaplusDecay) { value = ch.toDouble(); - type = ChemicalDataObject::betaminuspercentage; - d->inAtomicNumber = false; + type = ChemicalDataObject::betaplusDecay; + d->inBetaplusDecay = false; } else if (d->inBetaminusDecay) { value = ch.toDouble(); - type = ChemicalDataObject::betaminusdecay; - d->inAtomicNumber = false; - } - else if (d->inECPercentage) { - value = ch.toDouble(); - type = ChemicalDataObject::ecpercentage; - d->inAtomicNumber = false; + type = ChemicalDataObject::betaminusDecay; + d->inBetaminusDecay = false; } else if (d->inECDecay) { value = ch.toDouble(); - type = ChemicalDataObject::ecdecay; - d->inAtomicNumber = false; + type = ChemicalDataObject::ecDecay; + d->inECDecay = false; } else if (d->inAbundance){ value = ch;