Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]

X:/dropbox/visualizationlibrary/src/vlMolecule/chem_database.hpp

Go to the documentation of this file.
00001 /**************************************************************************************/
00002 /*                                                                                    */
00003 /*  Visualization Library                                                             */
00004 /*  http://www.visualizationlibrary.org                                               */
00005 /*                                                                                    */
00006 /*  Copyright (c) 2005-2010, Michele Bosi                                             */
00007 /*  All rights reserved.                                                              */
00008 /*                                                                                    */
00009 /*  Redistribution and use in source and binary forms, with or without modification,  */
00010 /*  are permitted provided that the following conditions are met:                     */
00011 /*                                                                                    */
00012 /*  - Redistributions of source code must retain the above copyright notice, this     */
00013 /*  list of conditions and the following disclaimer.                                  */
00014 /*                                                                                    */
00015 /*  - Redistributions in binary form must reproduce the above copyright notice, this  */
00016 /*  list of conditions and the following disclaimer in the documentation and/or       */
00017 /*  other materials provided with the distribution.                                   */
00018 /*                                                                                    */
00019 /*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND   */
00020 /*  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED     */
00021 /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE            */
00022 /*  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR  */
00023 /*  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    */
00024 /*  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;      */
00025 /*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON    */
00026 /*  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT           */
00027 /*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS     */
00028 /*  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                      */
00029 /*                                                                                    */
00030 /**************************************************************************************/
00031 
00032 #ifndef ChemDatabase_INCLUDE_ONCE
00033 #define ChemDatabase_INCLUDE_ONCE
00034 
00035 #include <vlMolecule/link_config.hpp>
00036 #include <vlCore/Vector4.hpp>
00037 #include <vlCore/String.hpp>
00038 
00039 namespace vl
00040 {
00042   typedef enum
00043   {
00044     AT_Hydrogen,
00045     AT_Helium,
00046     AT_Lithium,
00047     AT_Beryllium,
00048     AT_Boron,
00049     AT_Carbon,
00050     AT_Nitrogen,
00051     AT_Oxygen,
00052     AT_Fluorine,
00053     AT_Neon,
00054     AT_Sodium,
00055     AT_Magnesium,
00056     AT_Aluminium,
00057     AT_Silicon,
00058     AT_Phosphorus,
00059     AT_Sulfur,
00060     AT_Chlorine,
00061     AT_Argon,
00062     AT_Potassium,
00063     AT_Calcium,
00064     AT_Scandium,
00065     AT_Titanium,
00066     AT_Vanadium,
00067     AT_Chromium,
00068     AT_Manganese,
00069     AT_Iron,
00070     AT_Cobalt,
00071     AT_Nickel,
00072     AT_Copper,
00073     AT_Zinc,
00074     AT_Gallium,
00075     AT_Germanium,
00076     AT_Arsenic,
00077     AT_Selenium,
00078     AT_Bromine,
00079     AT_Krypton,
00080     AT_Rubidium,
00081     AT_Strontium,
00082     AT_Yttrium,
00083     AT_Zirconium,
00084     AT_Niobium,
00085     AT_Molybdenum,
00086     AT_Technetium,
00087     AT_Ruthenium,
00088     AT_Rhodium,
00089     AT_Palladium,
00090     AT_Silver,
00091     AT_Cadmium,
00092     AT_Indium,
00093     AT_Tin,
00094     AT_Antimony,
00095     AT_Tellurium,
00096     AT_Iodine,
00097     AT_Xenon,
00098     AT_Caesium,
00099     AT_Barium,
00100     AT_Lanthanum,
00101     AT_Cerium,
00102     AT_Praseodymium,
00103     AT_Neodymium,
00104     AT_Promethium,
00105     AT_Samarium,
00106     AT_Europium,
00107     AT_Gadolinium,
00108     AT_Terbium,
00109     AT_Dysprosium,
00110     AT_Holmium,
00111     AT_Erbium,
00112     AT_Thulium,
00113     AT_Ytterbium,
00114     AT_Lutetium,
00115     AT_Hafnium,
00116     AT_Tantalum,
00117     AT_Tungsten,
00118     AT_Rhenium,
00119     AT_Osmium,
00120     AT_Iridium,
00121     AT_Platinum,
00122     AT_Gold,
00123     AT_Mercury,
00124     AT_Thallium,
00125     AT_Lead,
00126     AT_Bismuth,
00127     AT_Polonium,
00128     AT_Astatine,
00129     AT_Radon,
00130     AT_Francium,
00131     AT_Radium,
00132     AT_Actinium,
00133     AT_Thorium,
00134     AT_Protactinium,
00135     AT_Uranium,
00136     AT_Neptunium,
00137     AT_Plutonium,
00138     AT_Americium,
00139     AT_Curium,
00140     AT_Berkelium,
00141     AT_Californium,
00142     AT_Einsteinium,
00143     AT_Fermium,
00144     AT_Mendelevium,
00145     AT_Nobelium,
00146     AT_Lawrencium,
00147     AT_Rutherfordium,
00148     AT_Dubnium,
00149     AT_Seaborgium,
00150     AT_Bohrium,
00151     AT_Hassium,
00152     AT_Meitnerium,
00153     AT_Darmstadtium,
00154     AT_Roentgenium,
00155     AT_Ununbium,
00156     AT_Ununtrium,
00157     AT_Ununquadium,
00158     AT_Ununpentium,
00159     AT_Ununhexium,
00160     AT_Ununseptium,
00161     AT_Ununoctium,
00162 
00163     AT_Unknown,
00164     AT_Count,
00165   } EAtomType;
00166 
00168   class AtomInfo
00169   {
00170   public:
00172     AtomInfo(EAtomType type, const char* name, const char* symbol, int atomic_num, double atomic_mass, double melting_pt, double boiling_pt, 
00173              double electroneg, double electron_aff, int valence, double calculated_r, double empirical_r, double covalent_r, double vdw_r,
00174              unsigned int cpk_color, unsigned int rasmol_color)
00175     {
00176       mType              = type;
00177       mName              = name;
00178       mSymbol            = symbol;
00179       mAtomicNumber      = atomic_num;
00180       mAtomicMass        = atomic_mass;
00181       mMeltingPoint      = melting_pt;
00182       mBoilingPoint      = boiling_pt;
00183       mElectronegativity = electroneg;
00184       mElectronAffinity  = electron_aff;
00185       mValence           = valence;
00186       mCalculatedRadius  = calculated_r;
00187       mEmpiricalRadius   = empirical_r;
00188       mCovalentRadius    = covalent_r;
00189       mVanDerWaalsRadius = vdw_r;
00190       mCPKColor = cpk_color;
00191       mRasMolColor = rasmol_color;
00192     }
00193 
00195     EAtomType type() const { return mType; }
00197     const char* name() const { return mName; }
00199     const char* symbol() const { return mSymbol; }
00201     int atomicNumber() const { return mAtomicNumber; }
00203     double atomicMass() const { return mAtomicMass; }
00205     double meltingPoint() const { return mMeltingPoint; }
00207     double boilingPoint() const { return mBoilingPoint; }
00209     double electronegativity() const { return mElectronegativity; }
00211     double electronAffinity() const { return mElectronAffinity; }
00213     int valence() const { return mValence; }
00215     double calculatedRadius() const { return mCalculatedRadius / 100.0; }
00217     double empiricalRadius() const { return mEmpiricalRadius / 100.0; }
00219     double covalentRadius() const { return mCovalentRadius / 100.0; }
00221     double vanDerWaalsRadius() const { return mVanDerWaalsRadius / 100.0; }
00223     fvec4 cpkColor() const 
00224     {
00225       fvec4 c;
00226       c.r() = ((mCPKColor >> 16) & 0xFF) / 255.0f;
00227       c.g() = ((mCPKColor >> 8)  & 0xFF) / 255.0f;
00228       c.b() =  (mCPKColor        & 0xFF) / 255.0f;
00229       c.a() = 1.0f;
00230       return c; 
00231     }
00233     fvec4 rasmolColor() const 
00234     {
00235       fvec4 c;
00236       c.r() = ((mRasMolColor >> 16) & 0xFF) / 255.0f;
00237       c.g() = ((mRasMolColor >> 8)  & 0xFF) / 255.0f;
00238       c.b() =  (mRasMolColor        & 0xFF) / 255.0f;
00239       c.a() = 1.0f;
00240       return c; 
00241     }
00242 
00243   protected:
00244     EAtomType mType;
00245     const char* mName;
00246     const char* mSymbol;
00247     int mAtomicNumber;
00248     int mValence;
00249     unsigned int mCPKColor;
00250     unsigned int mRasMolColor;
00251     double mAtomicMass;
00252     double mMeltingPoint;
00253     double mBoilingPoint;
00254     double mElectronegativity;
00255     double mElectronAffinity;
00256     double mCalculatedRadius;
00257     double mEmpiricalRadius;
00258     double mCovalentRadius;
00259     double mVanDerWaalsRadius;
00260   };
00261 
00263   VLMOLECULE_EXPORT const AtomInfo& atomInfo(EAtomType type);
00264 
00266   VLMOLECULE_EXPORT EAtomType atomType(const char* type);
00267 }
00268 
00269 #endif

Visualization Library 2011.09.1160 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 2 2013 13:40:43.
Permission is granted to use this page to write and publish articles regarding Visualization Library.