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
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 ();
00156 #ifdef WITH_BODR
00157
00160 static void LoadBODR ();
00161 #endif
00162
00165 static void LoadAllData ();
00166
00170 int GetZ () {return m_Z;}
00174 const char* GetSymbol () {return m_Symbol;}
00179 char GetDefaultValence () {return m_DefaultValence;}
00185 unsigned GetMaxBonds () {return m_MaxBonds;}
00191 bool GetBestSide () {return m_BestSide;}
00196 double* GetDefaultColor () {return m_DefaultColor;}
00200 const char* GetName () {return name.c_str();}
00205 const GcuAtomicRadius** GetRadii ();
00210 const GcuElectronegativity** GetElectronegativities ();
00214 unsigned GetValenceElectrons () {return m_nve;}
00219 unsigned GetTotalValenceElectrons () {return m_tve;}
00224 unsigned GetMaxValenceElectrons () {return m_maxve;}
00230 double GetWeight (int& prec) {prec = m_WeightPrec; return m_Weight;}
00237 IsotopicPattern *GetIsotopicPattern (unsigned natoms);
00243 string const& GetElectronicConfiguration () {return ElecConfig;}
00247 map<string, string> const& GetNames () {return names;}
00253 GcuDimensionalValue const *GetIonizationEnergy (unsigned rank = 1);
00260 GcuDimensionalValue const *GetElectronAffinity (unsigned rank = 1);
00267 Value *const GetProperty (char const *property_name) {return props[property_name];}
00274 string &GetStringProperty (char const *property_name) {return sprops[property_name];}
00281 int GetIntegerProperty (char const *property_name);
00282
00283 private:
00284 unsigned char m_Z, m_nve, m_tve, m_maxve;
00285 char m_Symbol[4];
00286 double m_Weight;
00287 int m_WeightPrec;
00288 char m_DefaultValence;
00289 unsigned char m_MaxBonds;
00290 bool m_BestSide;
00291 double m_DefaultColor[3];
00292 string name;
00293 vector<GcuAtomicRadius*> m_radii;
00294 vector<GcuElectronegativity*> m_en;
00295 vector<Isotope*> m_isotopes;
00296 vector<IsotopicPattern*> m_patterns;
00297 vector<GcuDimensionalValue> m_ei;
00298 vector<GcuDimensionalValue> m_ae;
00299 map<string, string> names;
00300 map<string, Value*> props;
00301 map<string, string> sprops;
00302 map<string, int> iprops;
00303 string ElecConfig;
00304 };
00305
00306 }
00307
00308 #endif // GCU_ELEMENT_H