Logo Search packages:      
Sourcecode: kalzium version File versions  Download package

isotope.cpp

/***************************************************************************
 *   Copyright (C) 2005 by Carsten Niehaus <cniehaus@kde.org>              *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.          *
 ***************************************************************************/
#include "isotope.h"
#include "chemicaldataobject.h"

#include <kdebug.h>

00024 Isotope::Isotope()
{ 
}

00028 Isotope::~Isotope()
{
}

00032 void Isotope::addData( ChemicalDataObject o )
{
      if ( o.type() == ChemicalDataObject::exactMass )
            m_mass = o;
      else if ( o.type() == ChemicalDataObject::atomicNumber )
            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::relativeAbundance )
            m_abundance = o;
      else if ( o.type() == ChemicalDataObject::halfLife )
            m_halflife = o;
      else if ( o.type() == ChemicalDataObject::ecDecay )
            m_ecdecay = o;
      else if ( o.type() == ChemicalDataObject::ecDecayLikeliness )
            m_eclikeliness = o;
      else if ( o.type() == ChemicalDataObject::betaplusDecay )
            m_betaplusdecay = o;
      else if ( o.type() == ChemicalDataObject::betaplusDecayLikeliness )
            m_betapluslikeliness = o;
      else if (  o.type() == ChemicalDataObject::betaminusDecay )
            m_betaminusdecay = o;
      else if (  o.type() == ChemicalDataObject::betaminusDecayLikeliness )
            m_betaminuslikeliness = o;
      else if ( o.type() == ChemicalDataObject::alphaDecay )
            m_alphadecay = o;
      else if ( o.type() == ChemicalDataObject::alphaDecayLikeliness )
            m_alphalikeliness = o;
      
}

00067 double Isotope::mass() const
{
      return  m_mass.value().toDouble();
}

00072 QString Isotope::errorMargin() const
{
      return m_mass.errorValue().toString();
}

00077 int Isotope::parentElementNumber() const
{
      return  m_identifier.value().toInt();
}

QString Isotope::spin() const
{
    return m_spin.value().toString();
}

00087 QString Isotope::magmoment() const
{
      return m_magmoment.value().toString();
}

QString Isotope::abundance() const
{
      return m_abundance.value().toString();
      return QString();
}

00098 double Isotope::halflife() const
{
      return m_halflife.value().toDouble();
}

00103 QString Isotope::halflifeUnit() const
{
      return m_halflife.unitAsString();
}

00108 double Isotope::ecdecay() const
{
      return m_ecdecay.value().toDouble();
}
00112 double Isotope::eclikeliness() const
{
      return m_eclikeliness.value().toDouble();
}
00116 double Isotope::betaplusdecay() const
{
      return m_betaplusdecay.value().toDouble();
}

00121 double Isotope::betapluslikeliness() const
{
      return m_betapluslikeliness.value().toDouble();
}

00126 double Isotope::betaminusdecay() const
{
      return m_betaminusdecay.value().toDouble();
}

00131 double Isotope::betaminuslikeliness() const
{
      return m_betaminuslikeliness.value().toDouble();
}

00136 double Isotope::alphadecay() const
{
      return m_alphadecay.value().toDouble();
}

00141 double Isotope::alphalikeliness() const
{
      return m_alphalikeliness.value().toDouble();
}

00146 QString Isotope::parentElementSymbol() const
{
      return m_parentElementSymbol.value().toString();
}

00151 void Isotope::setNucleons( int number )
{
      m_numberOfNucleons = number;
}

00156 int Isotope::nucleons() const
{
      return m_numberOfNucleons;
}

00161 Isotope::Nucleons Isotope::nucleonsAfterDecay( Decay kind )
{
      Isotope::Nucleons n;
      int protons = m_identifier.value().toInt();
      int neutrons = m_numberOfNucleons - protons;
      n.protons = protons;
      n.neutrons = neutrons;

      switch ( kind )
      {
            case ALPHA:
                  n.protons-=2;
                  break;
            case BETAMINUS:
                  n.protons+=1;
                  n.neutrons-=1;
                  break;
            case BETAPLUS:
                  n.protons-=1;
                  break;
            case EC:
                  n.protons-=1;
                  n.neutrons+=1;
                  break;
      }

      return n;
}

Generated by  Doxygen 1.6.0   Back to index