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

Go to the SVN repository for this file.

1 /* $Id: periodic_table.cpp 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 #include <ncbi_pch.hpp>
35 #include <corelib/ncbistd.hpp>
36 
37 #include "periodic_table.hpp"
38 
40 
41 
42 BEGIN_SCOPE(Cn3D)
43 
44 PeriodicTableClass PeriodicTable; // one global copy for now
45 
46 const Element* PeriodicTableClass::GetElement(int Z) const
47 {
48  ZMapType::const_iterator i = ZMap.find(Z);
49  if (i != ZMap.end())
50  return (*i).second;
51  else
52  return NULL;
53 }
54 
55 void PeriodicTableClass::AddElement(int Z, const char * name,
56  const char * symbol,
57  double r, double g, double b,
58  double v)
59 {
60  ZMapType::const_iterator i = ZMap.find(Z);
61  if (i != ZMap.end()) delete const_cast<Element*>((*i).second);
62  ZMap[Z] = new Element(name,symbol,r,g,b,v);
63 }
64 
65 // defaults; can be overridden later on
67 {
68  // atomic number name symbol color (rgb) vdW radius
69  AddElement( 1, "Hydrogen", "H", 0.8, 0.8, 0.8, 1.2 );
70  AddElement( 2, "Helium", "He", 0.8, 0.37, 0.08, 1.22 );
71  AddElement( 3, "Lithium", "Li", 0.7, 0.7, 0.7, 1.52 );
72  AddElement( 4, "Beryllium", "Be", 0.8, 0.37, 0.08, 1.7 );
73  AddElement( 5, "Boron", "B", 0.9, 0.4, 0, 2.08 );
74  AddElement( 6, "Carbon", "C", 0.3, 0.3, 0.3, 1.85 );
75  AddElement( 7, "Nitrogen", "N", 0.2, 0.2, 0.8, 1.54 );
76  AddElement( 8, "Oxygen", "O", 0.8, 0.2, 0.2, 1.4 );
77  AddElement( 9, "Fluorine", "F", 0.7, 0.85, 0.45, 1.35 );
78  AddElement( 10, "Neon", "Ne", 0.8, 0.37, 0.08, 1.6 );
79  AddElement( 11, "Sodium", "Na", 0.6, 0.6, 0.6, 2.31 );
80  AddElement( 12, "Magnesium", "Mg", 0.4, 0.4, 0.4, 1.7 );
81  AddElement( 13, "Aluminum", "Al", 0.4, 0.4, 0.4, 2.05 );
82  AddElement( 14, "Silicon", "Si", 0.7, 0, 0.1, 2 );
83  AddElement( 15, "Phosphorus", "P", 0.1, 0.7, 0.3, 1.4 );
84  AddElement( 16, "Sulfur", "S", 0.95, 0.9, 0.2, 1.85 );
85  AddElement( 17, "Chlorine", "Cl", 0.15, 0.5, 0.1, 1.81 );
86  AddElement( 18, "Argon", "Ar", 0.8, 0.37, 0.08, 1.91 );
87  AddElement( 19, "Potassium", "K", 0.8, 0.5, 0.7, 2.31 );
88  AddElement( 20, "Calcium", "Ca", 0.8, 0.8, 0.7, 1.973 );
89  AddElement( 21, "Scandium", "Sc", 0.5, 0.5, 0.5, 1.7 );
90  AddElement( 22, "Titanium", "Ti", 0.5, 0.5, 0.5, 1.7 );
91  AddElement( 23, "Vanadium", "V", 0.5, 0.5, 0.5, 1.7 );
92  AddElement( 24, "Chromium", "Cr", 0.5, 0.5, 0.5, 1.7 );
93  AddElement( 25, "Manganese", "Mn", 0.5, 0.5, 0.5, 1.7 );
94  AddElement( 26, "Iron", "Fe", 0.7, 0, 0.1, 1.7 );
95  AddElement( 27, "Cobalt", "Co", 0.5, 0.5, 0.5, 1.7 );
96  AddElement( 28, "Nickel", "Ni", 0.5, 0.5, 0.5, 1.7 );
97  AddElement( 29, "Copper", "Cu", 0.5, 0.5, 0.5, 1.7 );
98  AddElement( 30, "Zinc", "Zn", 0.5, 0.5, 0.5, 1.7 );
99  AddElement( 31, "Gallium", "Ga", 0.5, 0.5, 0.5, 1.7 );
100  AddElement( 32, "Germanium", "Ge", 0.5, 0.5, 0.5, 1.7 );
101  AddElement( 33, "Arsenic", "As", 0.4, 0.8, 0.1, 2 );
102  AddElement( 34, "Selenium", "Se", 0.8, 0.8, 0.1, 2 );
103  AddElement( 35, "Bromine", "Br", 0.5, 0.08, 0.12, 2.1 );
104  AddElement( 36, "Krypton", "Kr", 0.8, 0.37, 0.08, 1.7 );
105  AddElement( 37, "Rubidium", "Rb", 0.5, 0.5, 0.5, 1.7 );
106  AddElement( 38, "Strontium", "Sr", 0.5, 0.5, 0.5, 1.7 );
107  AddElement( 39, "Yttrium", "Y", 0.5, 0.5, 0.5, 1.7 );
108  AddElement( 40, "Zirconium", "Zr", 0.5, 0.5, 0.5, 1.7 );
109  AddElement( 41, "Niobium", "Nb", 0.5, 0.5, 0.5, 1.7 );
110  AddElement( 42, "Molybdenum", "Mo", 0.5, 0.5, 0.5, 1.7 );
111  AddElement( 43, "Technetium", "Tc", 0.5, 0.5, 0.5, 1.7 );
112  AddElement( 44, "Ruthenium", "Ru", 0.5, 0.5, 0.5, 1.7 );
113  AddElement( 45, "Rhodium", "Rh", 0.5, 0.5, 0.5, 1.7 );
114  AddElement( 46, "Palladium", "Pd", 0.5, 0.5, 0.5, 1.7 );
115  AddElement( 47, "Silver", "Ag", 0.5, 0.5, 0.5, 1.7 );
116  AddElement( 48, "Cadmium", "Cd", 0.5, 0.5, 0.5, 1.7 );
117  AddElement( 49, "Indium", "In", 0.5, 0.5, 0.5, 1.7 );
118  AddElement( 50, "Tin", "Sn", 0.5, 0.5, 0.5, 1.7 );
119  AddElement( 51, "Antimony", "Sb", 0.5, 0.5, 0.5, 2.2 );
120  AddElement( 52, "Tellurium", "Te", 0.5, 0.5, 0.5, 2.2 );
121  AddElement( 53, "Iodine", "I", 0.5, 0.1, 0.5, 2.15 );
122  AddElement( 54, "Xenon", "Xe", 0.5, 0.5, 0.5, 1.7 );
123  AddElement( 55, "Cesium", "Cs", 0.5, 0.5, 0.5, 1.7 );
124  AddElement( 56, "Barium", "Ba", 0.5, 0.5, 0.5, 1.7 );
125  AddElement( 57, "Lanthanum", "La", 0.5, 0.5, 0.5, 1.7 );
126  AddElement( 58, "Cerium", "Ce", 0.5, 0.5, 0.5, 1.7 );
127  AddElement( 59, "Praseodymium", "Pr", 0.5, 0.5, 0.5, 1.7 );
128  AddElement( 60, "Neodymium", "Nd", 0.5, 0.5, 0.5, 1.7 );
129  AddElement( 61, "Promethium", "Pm", 0.5, 0.5, 0.5, 1.7 );
130  AddElement( 62, "Samarium", "Sm", 0.5, 0.5, 0.5, 1.7 );
131  AddElement( 63, "Europium", "Eu", 0.5, 0.5, 0.5, 1.7 );
132  AddElement( 64, "Gadolinium", "Gd", 0.5, 0.5, 0.5, 1.7 );
133  AddElement( 65, "Terbium", "Tb", 0.5, 0.5, 0.5, 1.7 );
134  AddElement( 66, "Dysprosium", "Dy", 0.5, 0.5, 0.5, 1.7 );
135  AddElement( 67, "Holmium", "Ho", 0.5, 0.5, 0.5, 1.7 );
136  AddElement( 68, "Erbium", "Er", 0.5, 0.5, 0.5, 1.7 );
137  AddElement( 69, "Thulium", "Tm", 0.5, 0.5, 0.5, 1.7 );
138  AddElement( 70, "Ytterbium", "Yb", 0.5, 0.5, 0.5, 1.7 );
139  AddElement( 71, "Lutetium", "Lu", 0.5, 0.5, 0.5, 1.7 );
140  AddElement( 72, "Hafnium", "Hf", 0.5, 0.5, 0.5, 1.7 );
141  AddElement( 73, "Tantalum", "Ta", 0.5, 0.5, 0.5, 1.7 );
142  AddElement( 74, "Tungsten", "W", 0.5, 0.5, 0.5, 1.7 );
143  AddElement( 75, "Rhenium", "Re", 0.5, 0.5, 0.5, 1.7 );
144  AddElement( 76, "Osmium", "Os", 0.5, 0.5, 0.5, 1.7 );
145  AddElement( 77, "Iridium", "Ir", 0.5, 0.5, 0.5, 1.7 );
146  AddElement( 78, "Platinum", "Pt", 0.5, 0.5, 0.5, 1.7 );
147  AddElement( 79, "Gold", "Au", 0.5, 0.5, 0.5, 1.7 );
148  AddElement( 80, "Mercury", "Hg", 0.5, 0.5, 0.5, 1.7 );
149  AddElement( 81, "Thallium", "Tl", 0.5, 0.5, 0.5, 1.7 );
150  AddElement( 82, "Lead", "Pb", 0.5, 0.5, 0.5, 1.7 );
151  AddElement( 83, "Bismuth", "Bi", 0.5, 0.5, 0.5, 1.7 );
152  AddElement( 84, "Polonium", "Po", 0.5, 0.5, 0.5, 1.7 );
153  AddElement( 85, "Astatine", "At", 0.5, 0.5, 0.5, 1.7 );
154  AddElement( 86, "Radon", "Rn", 0.5, 0.5, 0.5, 1.7 );
155  AddElement( 87, "Francium", "Fr", 0.5, 0.5, 0.5, 1.7 );
156  AddElement( 88, "Radium", "Ra", 0.5, 0.5, 0.5, 1.7 );
157  AddElement( 89, "Actinium", "Ac", 0.5, 0.5, 0.5, 1.7 );
158  AddElement( 90, "Thorium", "Th", 0.5, 0.5, 0.5, 1.7 );
159  AddElement( 91, "Protactinium", "Pa", 0.5, 0.5, 0.5, 1.7 );
160  AddElement( 92, "Uranium", "U", 0.5, 0.5, 0.5, 1.7 );
161  AddElement( 93, "Neptunium", "Np", 0.5, 0.5, 0.5, 1.7 );
162  AddElement( 94, "Plutonium", "Pu", 0.5, 0.5, 0.5, 1.7 );
163  AddElement( 95, "Americium", "Am", 0.5, 0.5, 0.5, 1.7 );
164  AddElement( 96, "Curium", "Cm", 0.5, 0.5, 0.5, 1.7 );
165  AddElement( 97, "Berkelium", "Bk", 0.5, 0.5, 0.5, 1.7 );
166  AddElement( 98, "Californium", "Cf", 0.5, 0.5, 0.5, 1.7 );
167  AddElement( 99, "Einsteinium", "Es", 0.5, 0.5, 0.5, 1.7 );
168  AddElement( 100, "Fermium", "Fm", 0.5, 0.5, 0.5, 1.7 );
169  AddElement( 101, "Mendelevium", "Md", 0.5, 0.5, 0.5, 1.7 );
170  AddElement( 102, "Nobelium", "No", 0.5, 0.5, 0.5, 1.7 );
171  AddElement( 103, "Lawrencium", "Lr", 0.5, 0.5, 0.5, 1.7 );
172  AddElement( 254, "other", "?", 0.4, 0.4, 0.4, 1.6 );
173  AddElement( 255, "unknown", "?", 0.4, 0.4, 0.4, 1.6 );
174 }
175 
177 {
178  ZMapType::const_iterator i, ie = ZMap.end();
179  for (i=ZMap.begin(); i!=ie; ++i)
180  if ((*i).second) delete const_cast<Element*>((*i).second);
181 }
182 
183 END_SCOPE(Cn3D)
void AddElement(int Z, const char *name, const char *symbol, double r, double g, double b, double vdW)
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define NULL
Definition: ncbistd.hpp:225
#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
int i
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
PeriodicTableClass PeriodicTable
USING_NCBI_SCOPE
int g(Seg_Gsm *spe, Seq_Mtf *psm, Thd_Gsm *tdg)
Definition: thrddgri.c:44
#define const
Definition: zconf.h:232
Modified on Fri Sep 20 14:57:35 2024 by modify_doxy.py rev. 669887