The Gnome Chemistry Utils 0.13.3
|
00001 // -*- C++ -*- 00002 00003 /* 00004 * Gnome Chemistry Utils 00005 * element.h 00006 * 00007 * Copyright (C) 2002-2011 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 <map> 00029 #include <string> 00030 #include <vector> 00031 #include "chemistry.h" 00032 #include "isotope.h" 00033 #include "value.h" 00034 00039 #define GCU_ERROR (1 << (sizeof(int) - 1)) 00040 00046 namespace gcu 00047 { 00048 00049 class EltTable; 00050 00059 class Element 00060 { 00061 friend class EltTable; 00062 private: 00069 Element (int Z, const char* Symbol); 00073 virtual ~Element (); 00074 00075 public: 00080 static const char* Symbol (int Z); 00088 static bool BestSide (int Z); 00093 static int Z (const char* symbol); 00098 static Element* GetElement (int Z); 00103 static Element* GetElement (const char* symbol); 00120 static bool GetRadius (GcuAtomicRadius* radius); 00136 static bool GetElectronegativity (GcuElectronegativity* en); 00144 static unsigned GetMaxBonds (int Z); 00148 static void LoadRadii (); 00152 static void LoadElectronicProps (); 00156 static void LoadIsotopes (); 00160 static void LoadBODR (); 00164 static void LoadAllData (); 00165 00169 int GetZ () {return m_Z;} 00173 const char* GetSymbol () {return m_Symbol;} 00178 char GetDefaultValence () {return m_DefaultValence;} 00184 unsigned GetMaxBonds () {return m_MaxBonds;} 00190 bool GetBestSide () {return m_BestSide;} 00195 double* GetDefaultColor () {return m_DefaultColor;} 00199 const char* GetName () {return name.c_str();} 00204 const GcuAtomicRadius** GetRadii (); 00209 const GcuElectronegativity** GetElectronegativities (); 00213 unsigned GetValenceElectrons () {return m_nve;} 00218 unsigned GetTotalValenceElectrons () {return m_tve;} 00223 unsigned GetMaxValenceElectrons () {return m_maxve;} 00227 DimensionalValue const *GetWeight (); 00234 IsotopicPattern *GetIsotopicPattern (unsigned natoms); 00240 std::string const& GetElectronicConfiguration () {return ElecConfig;} 00244 std::map<std::string, std::string> const& GetNames () {return names;} 00250 GcuDimensionalValue const *GetIonizationEnergy (unsigned rank = 1); 00257 GcuDimensionalValue const *GetElectronAffinity (unsigned rank = 1); 00264 Value const *GetProperty (char const *property_name); 00271 std::string &GetStringProperty (char const *property_name); 00278 int GetIntegerProperty (char const *property_name); 00279 00283 bool IsMetallic (); 00284 00285 private: 00286 unsigned char m_Z, m_nve, m_tve, m_maxve; 00287 char m_Symbol[4]; 00288 DimensionalValue const *m_AtomicWeight; 00289 char m_DefaultValence; 00290 unsigned char m_MaxBonds; 00291 bool m_BestSide, m_Metallic, m_MetallicCached; 00292 double m_DefaultColor[3]; 00293 std::string name; 00294 std::vector<GcuAtomicRadius*> m_radii; 00295 std::vector<GcuElectronegativity*> m_en; 00296 std::vector<Isotope*> m_isotopes; 00297 std::vector<IsotopicPattern*> m_patterns; 00298 std::vector<GcuDimensionalValue> m_ei; 00299 std::vector<GcuDimensionalValue> m_ae; 00300 std::map<std::string, std::string> names; 00301 std::map<std::string, Value*> props; 00302 std::map<std::string, std::string> sprops; 00303 std::map<std::string, int> iprops; 00304 std::string ElecConfig; 00305 }; 00306 00307 } // namespace gcu 00308 00309 #endif // GCU_ELEMENT_H