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 
00041 namespace gcu
00042 {
00043 
00044 class EltTable;
00045 
00052 class Element
00053 {
00054 friend class EltTable;
00055 private:
00062         Element (int Z, const char* Symbol);
00063         virtual ~Element ();
00064 
00065 public:
00070         static const gchar* Symbol (gint Z);
00078         static bool BestSide (gint Z);
00083         static gint Z (const gchar* symbol);
00088         static Element* GetElement (gint Z);
00093         static Element* GetElement (const gchar* symbol);
00110         static bool GetRadius (GcuAtomicRadius* radius);
00126         static bool GetElectronegativity (GcuElectronegativity* en);
00134         static unsigned GetMaxBonds (gint Z);
00138         static void LoadRadii ();
00142         static void LoadElectronicProps ();
00146         static void LoadIsotopes ();
00150         static void LoadBODR ();
00154         static void LoadAllData ();
00155 
00159         int GetZ () {return m_Z;}
00163         const char* GetSymbol () {return m_Symbol;}
00168         char GetDefaultValence () {return m_DefaultValence;}
00174         unsigned GetMaxBonds () {return m_MaxBonds;}
00180         bool GetBestSide () {return m_BestSide;}
00185         double* GetDefaultColor () {return m_DefaultColor;}
00189         const char* GetName () {return name.c_str();}
00194         const GcuAtomicRadius** GetRadii ();
00199         const GcuElectronegativity** GetElectronegativities ();
00203         unsigned GetValenceElectrons () {return m_nve;}
00208         unsigned GetTotalValenceElectrons () {return m_tve;}
00213         unsigned GetMaxValenceElectrons () {return m_maxve;}
00217         DimensionalValue const *GetWeight ();
00224         IsotopicPattern *GetIsotopicPattern (unsigned natoms);
00230         std::string const& GetElectronicConfiguration () {return ElecConfig;}
00234         std::map<std::string, std::string> const& GetNames () {return names;}
00240         GcuDimensionalValue const *GetIonizationEnergy (unsigned rank = 1);
00247         GcuDimensionalValue const *GetElectronAffinity (unsigned rank = 1);
00254         Value const *GetProperty (char const *property_name);
00261         std::string &GetStringProperty (char const *property_name);
00268         int GetIntegerProperty (char const *property_name);
00269 
00273         bool IsMetallic ();
00274 
00275 private:
00276         unsigned char m_Z, m_nve, m_tve, m_maxve;
00277         char m_Symbol[4];
00278         DimensionalValue const *m_AtomicWeight;
00279         char m_DefaultValence;
00280         unsigned char m_MaxBonds;
00281         bool m_BestSide, m_Metallic, m_MetallicCached;
00282         double m_DefaultColor[3];
00283         std::string name;
00284         std::vector<GcuAtomicRadius*> m_radii;
00285         std::vector<GcuElectronegativity*> m_en;
00286         std::vector<Isotope*> m_isotopes;
00287         std::vector<IsotopicPattern*> m_patterns;
00288         std::vector<GcuDimensionalValue> m_ei;
00289         std::vector<GcuDimensionalValue> m_ae;
00290         std::map<std::string, std::string> names;
00291         std::map<std::string, Value*> props;
00292         std::map<std::string, std::string> sprops;
00293         std::map<std::string, int> iprops;
00294         std::string ElecConfig;
00295 };
00296 
00297 } // namespace gcu
00298 
00299 #endif // GCU_ELEMENT_H

Generated on Sun Jun 22 13:26:05 2008 for The Gnome Chemistry Utils by  doxygen 1.5.6