00001 // -*- C++ -*- 00002 00003 /* 00004 * Gnome Chemistry Utils 00005 * element.h 00006 * 00007 * Copyright (C) 2002-2006 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 00035 using namespace std; 00036 00040 namespace gcu 00041 { 00042 00043 class EltTable; 00044 00051 class Element 00052 { 00053 friend class EltTable; 00054 private: 00061 Element (int Z, const char* Symbol); 00062 virtual ~Element (); 00063 00064 public: 00069 static const gchar* Symbol (gint Z); 00077 static bool BestSide (gint Z); 00082 static gint Z (const gchar* symbol); 00087 static Element* GetElement (gint Z); 00092 static Element* GetElement (const gchar* symbol); 00099 double GetWeight (int Z, int &prec); 00116 static bool GetRadius (GcuAtomicRadius* radius); 00132 static bool GetElectronegativity (GcuElectronegativity* en); 00140 static unsigned GetMaxBonds (gint Z); 00144 static void LoadRadii (); 00148 static void LoadElectronicProps (); 00152 static void LoadIsotopes (); 00156 static void LoadAllData (); 00157 00161 int GetZ () {return m_Z;} 00165 const char* GetSymbol () {return m_Symbol;} 00170 char GetDefaultValence () {return m_DefaultValence;} 00176 unsigned GetMaxBonds () {return m_MaxBonds;} 00182 bool GetBestSide () {return m_BestSide;} 00187 double* GetDefaultColor () {return m_DefaultColor;} 00191 const char* GetName () {return name.c_str();} 00196 const GcuAtomicRadius** GetRadii (); 00201 const GcuElectronegativity** GetElectronegativities (); 00205 unsigned GetValenceElectrons () {return m_nve;} 00210 unsigned GetTotalValenceElectrons () {return m_tve;} 00215 unsigned GetMaxValenceElectrons () {return m_maxve;} 00221 double GetWeight (int& prec) {prec = m_WeightPrec; return m_Weight;} 00228 IsotopicPattern *GetIsotopicPattern (unsigned natoms); 00234 string const& GetElectronicConfiguration () {return ElecConfig;} 00238 map<string, string> const& GetNames () {return names;} 00244 GcuDimensionalValue const *GetIonizationEnergy (unsigned rank = 1); 00251 GcuDimensionalValue const *GetElectronAffinity (unsigned rank = 1); 00252 00253 private: 00254 unsigned char m_Z, m_nve, m_tve, m_maxve; 00255 char m_Symbol[4]; 00256 double m_Weight; 00257 int m_WeightPrec; 00258 char m_DefaultValence; 00259 unsigned char m_MaxBonds; 00260 bool m_BestSide; 00261 double m_DefaultColor[3]; 00262 string name; 00263 vector<GcuAtomicRadius*> m_radii; 00264 vector<GcuElectronegativity*> m_en; 00265 vector<Isotope*> m_isotopes; 00266 vector<IsotopicPattern*> m_patterns; 00267 vector<GcuDimensionalValue> m_ei; 00268 vector<GcuDimensionalValue> m_ae; 00269 map<string, string> names; 00270 string ElecConfig; 00271 }; 00272 00273 } // namespace gcu 00274 00275 #endif // GCU_ELEMENT_H