Visualization Library 2.0.0-b3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
chem_database.hpp
Go to the documentation of this file.
1 /**************************************************************************************/
2 /* */
3 /* Visualization Library */
4 /* http://visualizationlibrary.org */
5 /* */
6 /* Copyright (c) 2005-2017, Michele Bosi */
7 /* All rights reserved. */
8 /* */
9 /* Redistribution and use in source and binary forms, with or without modification, */
10 /* are permitted provided that the following conditions are met: */
11 /* */
12 /* - Redistributions of source code must retain the above copyright notice, this */
13 /* list of conditions and the following disclaimer. */
14 /* */
15 /* - Redistributions in binary form must reproduce the above copyright notice, this */
16 /* list of conditions and the following disclaimer in the documentation and/or */
17 /* other materials provided with the distribution. */
18 /* */
19 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */
20 /* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
21 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
22 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */
23 /* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
24 /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
25 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
26 /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
27 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
28 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29 /* */
30 /**************************************************************************************/
31 
32 #ifndef ChemDatabase_INCLUDE_ONCE
33 #define ChemDatabase_INCLUDE_ONCE
34 
36 #include <vlCore/Vector4.hpp>
37 #include <vlCore/String.hpp>
38 
39 namespace vl
40 {
42  typedef enum
43  {
162 
165  } EAtomType;
166 
168  class AtomInfo
169  {
170  public:
172  AtomInfo(EAtomType type, const char* name, const char* symbol, int atomic_num, double atomic_mass, double melting_pt, double boiling_pt,
173  double electroneg, double electron_aff, int valence, double calculated_r, double empirical_r, double covalent_r, double vdw_r,
174  unsigned int cpk_color, unsigned int rasmol_color)
175  {
176  mType = type;
177  mName = name;
178  mSymbol = symbol;
179  mAtomicNumber = atomic_num;
180  mAtomicMass = atomic_mass;
181  mMeltingPoint = melting_pt;
182  mBoilingPoint = boiling_pt;
183  mElectronegativity = electroneg;
184  mElectronAffinity = electron_aff;
185  mValence = valence;
186  mCalculatedRadius = calculated_r;
187  mEmpiricalRadius = empirical_r;
188  mCovalentRadius = covalent_r;
189  mVanDerWaalsRadius = vdw_r;
190  mCPKColor = cpk_color;
191  mRasMolColor = rasmol_color;
192  }
193 
195  EAtomType type() const { return mType; }
197  const char* name() const { return mName; }
199  const char* symbol() const { return mSymbol; }
201  int atomicNumber() const { return mAtomicNumber; }
203  double atomicMass() const { return mAtomicMass; }
205  double meltingPoint() const { return mMeltingPoint; }
207  double boilingPoint() const { return mBoilingPoint; }
209  double electronegativity() const { return mElectronegativity; }
211  double electronAffinity() const { return mElectronAffinity; }
213  int valence() const { return mValence; }
215  double calculatedRadius() const { return mCalculatedRadius / 100.0; }
217  double empiricalRadius() const { return mEmpiricalRadius / 100.0; }
219  double covalentRadius() const { return mCovalentRadius / 100.0; }
221  double vanDerWaalsRadius() const { return mVanDerWaalsRadius / 100.0; }
223  fvec4 cpkColor() const
224  {
225  fvec4 c;
226  c.r() = ((mCPKColor >> 16) & 0xFF) / 255.0f;
227  c.g() = ((mCPKColor >> 8) & 0xFF) / 255.0f;
228  c.b() = (mCPKColor & 0xFF) / 255.0f;
229  c.a() = 1.0f;
230  return c;
231  }
234  {
235  fvec4 c;
236  c.r() = ((mRasMolColor >> 16) & 0xFF) / 255.0f;
237  c.g() = ((mRasMolColor >> 8) & 0xFF) / 255.0f;
238  c.b() = (mRasMolColor & 0xFF) / 255.0f;
239  c.a() = 1.0f;
240  return c;
241  }
242 
243  protected:
244  EAtomType mType;
245  const char* mName;
246  const char* mSymbol;
248  int mValence;
249  unsigned int mCPKColor;
250  unsigned int mRasMolColor;
251  double mAtomicMass;
260  };
261 
263  VLMOLECULE_EXPORT const AtomInfo& atomInfo(EAtomType type);
264 
266  VLMOLECULE_EXPORT EAtomType atomType(const char* type);
267 }
268 
269 #endif
double calculatedRadius() const
Returns the atom&#39;s calculated radius in Angstroms.
EAtomType mType
EAtomType type() const
Returns the type of an atom.
double mVanDerWaalsRadius
double mCalculatedRadius
int valence() const
Returns the valence of the atom.
const T_Scalar & r() const
Definition: Vector4.hpp:111
double empiricalRadius() const
Returns the atom&#39;s empirical radius in Angstroms.
fvec4 rasmolColor() const
Returns the atom&#39;s RasMol color.
const char * name() const
Returns the name of the atom.
const char * mSymbol
double mElectronegativity
double vanDerWaalsRadius() const
Returns the atom&#39;s van der Waals radius in Angstroms.
Visualization Library main namespace.
const char * symbol() const
Returns the symbol of the atom.
double mBoilingPoint
double mElectronAffinity
double covalentRadius() const
Returns the atom&#39;s covalent radius in Angstroms.
const T_Scalar & g() const
Definition: Vector4.hpp:112
double mCovalentRadius
EAtomType atomType(const char *type)
Translates a string containing atom type name, atom symbol or a Sybyl type into an EAtomType...
const char * mName
const T_Scalar & b() const
Definition: Vector4.hpp:113
double meltingPoint() const
Returns the element&#39;s melting point in Kelvin.
unsigned int mRasMolColor
fvec4 cpkColor() const
Returns the atom&#39;s CPK color.
const AtomInfo & atomInfo(EAtomType type)
Returns an AtomInfo representing the properties of the given atom type.
double electronegativity() const
Returns the atom electronegativity.
Encapsulates information regarding an atom type.
double electronAffinity() const
Returns the electron affinity in Kj/mol.
int atomicNumber() const
Returns the atom&#39;s atomic number.
AtomInfo(EAtomType type, const char *name, const char *symbol, int atomic_num, double atomic_mass, double melting_pt, double boiling_pt, double electroneg, double electron_aff, int valence, double calculated_r, double empirical_r, double covalent_r, double vdw_r, unsigned int cpk_color, unsigned int rasmol_color)
Constructor.
double atomicMass() const
Returns the atom mass.
EAtomType
Element types.
double boilingPoint() const
Returns the element&#39;s boiling point in Kelvin.
unsigned int mCPKColor
double mEmpiricalRadius
const T_Scalar & a() const
Definition: Vector4.hpp:114
double mMeltingPoint