00001 // -*- C++ -*- 00002 00003 /* 00004 * Gnome Chemistry Utils 00005 * element.h 00006 * 00007 * Copyright (C) 2002-2005 00008 * 00009 * Developed by Jean Bréfort <jean.brefort@normalesup.org> 00010 * 00011 * This library is free software; you can redistribute it and/or 00012 * modify it under the terms of the GNU Lesser General Public 00013 * License as published by the Free Software Foundation; either 00014 * version 2.1 of the License, or (at your option) any later version. 00015 * 00016 * This library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this library; if not, write to the 00023 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00024 * Boston, MA 02111-1307, USA. 00025 */ 00026 00027 #ifndef GCU_ELEMENT_H 00028 #define GCU_ELEMENT_H 00029 00030 #include <glib.h> 00031 #include <string> 00032 #include <vector> 00033 #include "chemistry.h" 00034 00035 using namespace std; 00036 00037 class EltTable; 00038 00042 namespace gcu 00043 { 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); 00129 static bool GetElectronegativity (GcuElectronegativity* en); 00137 static unsigned GetMaxBonds (gint Z); 00141 static void LoadRadii (); 00145 static void LoadElectronicProps (); 00149 static void LoadIsotopes (); 00153 static void LoadAllData (); 00154 00158 int GetZ () {return m_Z;} 00162 const char* GetSymbol () {return m_Symbol;} 00167 char GetDefaultValence () {return m_DefaultValence;} 00173 unsigned GetMaxBonds () {return m_MaxBonds;} 00179 bool GetBestSide () {return m_BestSide;} 00184 double* GetDefaultColor () {return m_DefaultColor;} 00188 const char* GetName () {return name.c_str();} 00193 const GcuAtomicRadius** GetRadii (); 00198 const GcuElectronegativity** GetElectronegativities (); 00202 unsigned GetValenceElectrons () {return m_nve;} 00207 unsigned GetTotalValenceElectrons () {return m_tve;} 00212 unsigned GetMaxValenceElectrons () {return m_maxve;} 00218 double GetWeight (int& prec) {prec = m_WeightPrec; return m_Weight;} 00219 00220 private: 00221 unsigned char m_Z, m_nve, m_tve, m_maxve; 00222 char m_Symbol[4]; 00223 double m_Weight; 00224 int m_WeightPrec; 00225 char m_DefaultValence; 00226 unsigned char m_MaxBonds; 00227 bool m_BestSide; 00228 double m_DefaultColor[3]; 00229 string name; 00230 vector<GcuAtomicRadius*> m_radii; 00231 vector<GcuElectronegativity*> m_en; 00232 }; 00233 00234 } // namespace gcu 00235 00236 #endif // GCU_ELEMENT_H