source: src/Element/element.hpp@ 1ca493a

Candidate_v1.7.0 stable
Last change on this file since 1ca493a was 912a6f, checked in by Frederik Heber <frederik.heber@…>, 5 years ago

Adapted to boost 1.64.

  • need array_wrapper.hpp when using make_array. Otherwise make_array cannot be found.
  • unit_test has an issue with ::get.
  • Property mode set to 100644
File size: 3.5 KB
Line 
1/*
2 * element.hpp
3 *
4 * Created on: Aug 3, 2009
5 * Author: heber
6 */
7
8#ifndef ELEMENT_HPP_
9#define ELEMENT_HPP_
10
11/*********************************************** includes ***********************************/
12
13// include config.h
14#ifdef HAVE_CONFIG_H
15#include <config.h>
16#endif
17
18#include <iosfwd>
19#include <string>
20
21#include "types.hpp"
22
23#include <boost/version.hpp>
24#if BOOST_VERSION > 106300
25#include <boost/serialization/array_wrapper.hpp>
26#endif
27#include "boost/serialization/array.hpp"
28#include "boost/serialization/string.hpp"
29
30class periodentafel;
31class IonTest;
32
33/********************************************** declarations *******************************/
34
35/** Chemical element.
36 * Class incorporates data for a certain chemical element to be referenced from atom class.
37 */
38class element {
39 friend class periodentafel;
40 friend class IonTest;
41 public:
42 element();
43 element(const element&);
44 virtual ~element();
45
46 element &operator=(const element&);
47
48 // accessor functions
49 double getMass() const;
50 const unsigned char *getColor() const;
51 double getCovalentRadius() const;
52 double getElectronegativity() const;
53 double getVanDerWaalsRadius() const;
54 atomicNumber_t getAtomicNumber() const;
55 virtual double getCharge() const
56 { return 0.; }
57 virtual double getValence() const;
58 virtual int getNoValenceOrbitals() const;
59 double getHBondDistance(const size_t i) const;
60 double getHBondAngle(const size_t i) const;
61
62 const std::string &getSymbol() const;
63 void setSymbol(const std::string &temp);
64
65 const std::string &getName() const;
66 void setName(const std::string &temp);
67
68 bool operator==(const element &other) const;
69
70 bool operator!=(const element &other) const {
71 return !(*this == other);
72 }
73
74 private:
75 friend class boost::serialization::access;
76 // serialization
77 template<class Archive>
78 void serialize(Archive & ar, const unsigned int version)
79 {
80 ar & mass;
81 ar & CovalentRadius;
82 ar & Electronegativity;
83 ar & VanDerWaalsRadius;
84 ar & Z;
85 ar & period;
86 ar & group;
87 ar & block;
88 ar & Valence;
89 ar & NoValenceOrbitals;
90 ar & boost::serialization::make_array<double>(HBondDistance, 3);
91 ar & boost::serialization::make_array<double>(HBondAngle, 3);
92 ar & boost::serialization::make_array<unsigned char>(color, 3);
93 ar & name;
94 ar & symbol;
95 }
96
97 protected:
98
99 double mass; //!< mass in g/mol
100 double CovalentRadius; //!< covalent radius
101 double Electronegativity; //!< electronegativity in Pauling units
102 double VanDerWaalsRadius; //!< van-der-Waals radius
103 atomicNumber_t Z; //!< atomic number
104 std::string period; //!< period: n quantum number
105 std::string group; //!< group: l quantum number
106 std::string block; //!< block: l quantum number
107 double Valence; //!< number of valence electrons for this element
108 int NoValenceOrbitals; //!< number of valence orbitals, used for determining bond degree in molecule::CreateConnectmatrix()
109 double HBondDistance[3]; //!< distance in Angstrom of this element to hydrogen (for single, double and triple bonds)
110 double HBondAngle[3]; //!< typical angle for one, two, three bonded hydrogen (in degrees)
111 unsigned char color[3]; //!< typical color for this element (from Jmol)
112
113 std::string name; //!< atom name, i.e. "Hydrogen"
114 std::string symbol; //!< short form of the atom, i.e. "H"
115};
116
117std::ostream &operator<<(std::ostream&,const element&);
118
119#endif /* ELEMENT_HPP_ */
Note: See TracBrowser for help on using the repository browser.