00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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);
00100 double GetWeight (int Z, int &prec);
00117 static bool GetRadius (GcuAtomicRadius* radius);
00133 static bool GetElectronegativity (GcuElectronegativity* en);
00141 static unsigned GetMaxBonds (gint Z);
00145 static void LoadRadii ();
00149 static void LoadElectronicProps ();
00153 static void LoadIsotopes ();
00157 static void LoadBODR ();
00161 static void LoadAllData ();
00162
00166 int GetZ () {return m_Z;}
00170 const char* GetSymbol () {return m_Symbol;}
00175 char GetDefaultValence () {return m_DefaultValence;}
00181 unsigned GetMaxBonds () {return m_MaxBonds;}
00187 bool GetBestSide () {return m_BestSide;}
00192 double* GetDefaultColor () {return m_DefaultColor;}
00196 const char* GetName () {return name.c_str();}
00201 const GcuAtomicRadius** GetRadii ();
00206 const GcuElectronegativity** GetElectronegativities ();
00210 unsigned GetValenceElectrons () {return m_nve;}
00215 unsigned GetTotalValenceElectrons () {return m_tve;}
00220 unsigned GetMaxValenceElectrons () {return m_maxve;}
00226 double GetWeight (int& prec) {prec = m_WeightPrec; return m_Weight;}
00233 IsotopicPattern *GetIsotopicPattern (unsigned natoms);
00239 std::string const& GetElectronicConfiguration () {return ElecConfig;}
00243 std::map<std::string, std::string> const& GetNames () {return names;}
00249 GcuDimensionalValue const *GetIonizationEnergy (unsigned rank = 1);
00256 GcuDimensionalValue const *GetElectronAffinity (unsigned rank = 1);
00263 Value const *GetProperty (char const *property_name) {return props[property_name];}
00270 std::string &GetStringProperty (char const *property_name) {return sprops[property_name];}
00277 int GetIntegerProperty (char const *property_name);
00278
00279 private:
00280 unsigned char m_Z, m_nve, m_tve, m_maxve;
00281 char m_Symbol[4];
00282 double m_Weight;
00283 int m_WeightPrec;
00284 char m_DefaultValence;
00285 unsigned char m_MaxBonds;
00286 bool m_BestSide;
00287 double m_DefaultColor[3];
00288 std::string name;
00289 std::vector<GcuAtomicRadius*> m_radii;
00290 std::vector<GcuElectronegativity*> m_en;
00291 std::vector<Isotope*> m_isotopes;
00292 std::vector<IsotopicPattern*> m_patterns;
00293 std::vector<GcuDimensionalValue> m_ei;
00294 std::vector<GcuDimensionalValue> m_ae;
00295 std::map<std::string, std::string> names;
00296 std::map<std::string, Value*> props;
00297 std::map<std::string, std::string> sprops;
00298 std::map<std::string, int> iprops;
00299 std::string ElecConfig;
00300 };
00301
00302 }
00303
00304 #endif // GCU_ELEMENT_H