NCBI C++ ToolKit
periodic_table.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: periodic_table.hpp 33815 2007-05-04 17:18:18Z kazimird $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * Authors: Paul Thiessen
27 *
28 * File Description:
29 * Classes to information about atomic elements
30 *
31 * ===========================================================================
32 */
33 
34 #ifndef CN3D_PERIODICTABLE__HPP
35 #define CN3D_PERIODICTABLE__HPP
36 
37 #include <corelib/ncbistl.hpp>
38 
39 #include <map>
40 
41 #include "vector_math.hpp"
42 
43 
44 BEGIN_SCOPE(Cn3D)
45 
46 class Element
47 {
48 public:
49  const char *name, *symbol;
50  double vdWRadius;
52 
53  Element(const char *n, const char *s,
54  double r, double g, double b, double v) :
55  name(n), symbol(s), vdWRadius(v), color(r,g,b) { }
56 };
57 
59 {
60 private:
61  typedef std::map < int, const Element * > ZMapType;
63 
64 public:
65  PeriodicTableClass(void);
66  ~PeriodicTableClass(void);
67 
68  const Element * GetElement(int Z) const;
69  void AddElement(int Z, const char * name,
70  const char * symbol,
71  double r, double g, double b,
72  double vdW);
73 };
74 
75 extern PeriodicTableClass PeriodicTable; // one global copy for now
76 
77 
78 // general utility functions
79 
80 inline bool IsMetal(int atomicNumber)
81 {
82  if ((atomicNumber >= 3 && atomicNumber <= 4) || // Li..Be
83  (atomicNumber >= 11 && atomicNumber <= 13) || // Na..Al
84  (atomicNumber >= 19 && atomicNumber <= 32) || // K..Ge
85  (atomicNumber >= 37 && atomicNumber <= 51) || // Rb..Sb
86  (atomicNumber >= 55 && atomicNumber <= 84) || // Cs..Po
87  (atomicNumber >= 87 && atomicNumber <= 109)) // Fr..Mt
88  return true;
89 
90  return false;
91 }
92 
93 END_SCOPE(Cn3D)
94 
95 #endif // CN3D_PERIODICTABLE__HPP
double vdWRadius
Vector color
Element(const char *n, const char *s, double r, double g, double b, double v)
const char * symbol
std::map< int, const Element * > ZMapType
void AddElement(int Z, const char *name, const char *symbol, double r, double g, double b, double vdW)
const Element * GetElement(int Z) const
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
#define Z
printf format modifier for size_t
Definition: mdb.c:334
n background color
yy_size_t n
The NCBI C++/STL use hints.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
PeriodicTableClass PeriodicTable
bool IsMetal(int atomicNumber)
int g(Seg_Gsm *spe, Seq_Mtf *psm, Thd_Gsm *tdg)
Definition: thrddgri.c:44
Modified on Thu Jul 18 15:59:58 2024 by modify_doxy.py rev. 669887