The Gnome Chemistry Utils: element.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories

# element.h

    00001 // -*- C++ -*-
    00002
    00003 /*
    00004  * Gnome Chemistry Utils
    00005  * element.h
    00006  *
    00007  * Copyright (C) 2002-2007 Jean Bréfort <jean.brefort@normalesup.org>
    00008  *
    00009  * This program is free software; you can redistribute it and/or
    00010  * modify it under the terms of the GNU General Public License as
    00011  * published by the Free Software Foundation; either version 2 of the
    00012  * License, or (at your option) any later version.
    00013  *
    00014  * This program is distributed in the hope that it will be useful,
    00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00017  * GNU General Public License for more details.
    00018  *
    00019  * You should have received a copy of the GNU General Public License
    00020  * along with this program; if not, write to the Free Software
    00021  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
    00022  * USA
    00023  */
    00024
    00025 #ifndef GCU_ELEMENT_H
    00026 #define GCU_ELEMENT_H
    00027
    00028 #include <glib.h>
    00029 #include <map>
    00030 #include <string>
    00031 #include <vector>
    00032 #include "chemistry.h"
    00033 #include "isotope.h"
    00034 #include "value.h"
    00035
    00036 #define GCU_ERROR (1 << (sizeof(int) - 1))
    00037
    00038 using namespace std;
    00039
    00043 namespace gcu
    00044 {
    00045
    00046 class EltTable;
    00047
    00054 class Element
    00055 {
    00056 friend class EltTable;
    00057 private:
    00064         Element (int Z, const char* Symbol);
    00065         virtual ~Element ();
    00066
    00067 public:
    00072         static const gchar* Symbol (gint Z);
    00080         static bool BestSide (gint Z);
    00085         static gint Z (const gchar* symbol);
    00090         static Element* GetElement (gint Z);
    00095         static Element* GetElement (const gchar* symbol);
    00102         double  GetWeight (int Z, int &prec);
    00119         static bool GetRadius (GcuAtomicRadius* radius);
    00135         static bool GetElectronegativity (GcuElectronegativity* en);
    00143         static unsigned GetMaxBonds (gint Z);
    00147         static void LoadRadii ();
    00151         static void LoadElectronicProps ();
    00155         static void LoadIsotopes ();
    00159         static void LoadBODR ();
    00163         static void LoadAllData ();
    00164
    00168         int GetZ () {return m_Z;}
    00172         const char* GetSymbol () {return m_Symbol;}
    00177         char GetDefaultValence () {return m_DefaultValence;}
    00183         unsigned GetMaxBonds () {return m_MaxBonds;}
    00189         bool GetBestSide () {return m_BestSide;}
    00194         double* GetDefaultColor () {return m_DefaultColor;}
    00198         const char* GetName () {return name.c_str();}
    00203         const GcuAtomicRadius** GetRadii ();
    00208         const GcuElectronegativity** GetElectronegativities ();
    00212         unsigned GetValenceElectrons () {return m_nve;}
    00217         unsigned GetTotalValenceElectrons () {return m_tve;}
    00222         unsigned GetMaxValenceElectrons () {return m_maxve;}
    00228         double GetWeight (int& prec) {prec = m_WeightPrec; return m_Weight;}
    00235         IsotopicPattern *GetIsotopicPattern (unsigned natoms);
    00241         string const& GetElectronicConfiguration () {return ElecConfig;}
    00245         map<string, string> const& GetNames () {return names;}
    00251         GcuDimensionalValue const *GetIonizationEnergy (unsigned rank = 1);
    00258         GcuDimensionalValue const *GetElectronAffinity (unsigned rank = 1);
    00265         Value const *GetProperty (char const *property_name) {return props[property_name];}
    00272         string &GetStringProperty (char const *property_name) {return sprops[property_name];}
    00279         int GetIntegerProperty (char const *property_name);
    00280
    00281 private:
    00282         unsigned char m_Z, m_nve, m_tve, m_maxve;
    00283         char m_Symbol[4];
    00284         double m_Weight;
    00285         int m_WeightPrec;
    00286         char m_DefaultValence;
    00287         unsigned char m_MaxBonds;
    00288         bool m_BestSide;
    00289         double m_DefaultColor[3];
    00290         string name;
    00291         vector<GcuAtomicRadius*> m_radii;
    00292         vector<GcuElectronegativity*> m_en;
    00293         vector<Isotope*> m_isotopes;
    00294         vector<IsotopicPattern*> m_patterns;
    00295         vector<GcuDimensionalValue> m_ei;
    00296         vector<GcuDimensionalValue> m_ae;
    00297         map<string, string> names;
    00298         map<string, Value*> props;
    00299         map<string, string> sprops;
    00300         map<string, int> iprops;
    00301         string ElecConfig;
    00302 };
    00303
    00304 } // namespace gcu
    00305
    00306 #endif // GCU_ELEMENT_H