| [cd4ccc] | 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 |  | 
|---|
| [f66195] | 11 | /*********************************************** includes ***********************************/ | 
|---|
|  | 12 |  | 
|---|
| [cd4ccc] | 13 | // include config.h | 
|---|
|  | 14 | #ifdef HAVE_CONFIG_H | 
|---|
|  | 15 | #include <config.h> | 
|---|
|  | 16 | #endif | 
|---|
|  | 17 |  | 
|---|
| [986ed3] | 18 | #include <iosfwd> | 
|---|
| [ead4e6] | 19 | #include <string> | 
|---|
| [cd4ccc] | 20 |  | 
|---|
| [ead4e6] | 21 | #include "types.hpp" | 
|---|
| [cd4ccc] | 22 |  | 
|---|
| [912a6f] | 23 | #include <boost/version.hpp> | 
|---|
|  | 24 | #if BOOST_VERSION > 106300 | 
|---|
|  | 25 | #include <boost/serialization/array_wrapper.hpp> | 
|---|
|  | 26 | #endif | 
|---|
| [bae8b0] | 27 | #include "boost/serialization/array.hpp" | 
|---|
|  | 28 | #include "boost/serialization/string.hpp" | 
|---|
|  | 29 |  | 
|---|
| [83f176] | 30 | class periodentafel; | 
|---|
| [31bd9c] | 31 | class IonTest; | 
|---|
| [83f176] | 32 |  | 
|---|
| [f66195] | 33 | /********************************************** declarations *******************************/ | 
|---|
|  | 34 |  | 
|---|
| [cd4ccc] | 35 | /** Chemical element. | 
|---|
|  | 36 | * Class incorporates data for a certain chemical element to be referenced from atom class. | 
|---|
|  | 37 | */ | 
|---|
|  | 38 | class element { | 
|---|
| [83f176] | 39 | friend class periodentafel; | 
|---|
| [31bd9c] | 40 | friend class IonTest; | 
|---|
| [cd4ccc] | 41 | public: | 
|---|
| [2fe971] | 42 | element(); | 
|---|
| [2a76b0] | 43 | element(const element&); | 
|---|
| [31bd9c] | 44 | virtual ~element(); | 
|---|
| [cd4ccc] | 45 |  | 
|---|
| [2a76b0] | 46 | element &operator=(const element&); | 
|---|
|  | 47 |  | 
|---|
| [2fe971] | 48 | // accessor functions | 
|---|
| [83f176] | 49 | double getMass() const; | 
|---|
| [064178] | 50 | const unsigned char *getColor() const; | 
|---|
| [83f176] | 51 | double getCovalentRadius() const; | 
|---|
| [67c92b] | 52 | double getElectronegativity() const; | 
|---|
| [83f176] | 53 | double getVanDerWaalsRadius() const; | 
|---|
| [ed26ae] | 54 | atomicNumber_t getAtomicNumber() const; | 
|---|
| [31bd9c] | 55 | virtual double getCharge() const | 
|---|
|  | 56 | { return 0.; } | 
|---|
|  | 57 | virtual double getValence() const; | 
|---|
|  | 58 | virtual int getNoValenceOrbitals() const; | 
|---|
| [bae8b0] | 59 | double getHBondDistance(const size_t i) const; | 
|---|
|  | 60 | double getHBondAngle(const size_t i) const; | 
|---|
| [83f176] | 61 |  | 
|---|
| [7e3fc94] | 62 | const std::string &getSymbol() const; | 
|---|
| [83f176] | 63 | void setSymbol(const std::string &temp); | 
|---|
|  | 64 |  | 
|---|
| [7e3fc94] | 65 | const std::string &getName() const; | 
|---|
| [83f176] | 66 | void setName(const std::string &temp); | 
|---|
| [ead4e6] | 67 |  | 
|---|
| [d7d022] | 68 | bool operator==(const element &other) const; | 
|---|
|  | 69 |  | 
|---|
|  | 70 | bool operator!=(const element &other) const { | 
|---|
|  | 71 | return !(*this == other); | 
|---|
|  | 72 | } | 
|---|
|  | 73 |  | 
|---|
| [cd4ccc] | 74 | private: | 
|---|
| [d7d022] | 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 |  | 
|---|
| [31bd9c] | 97 | protected: | 
|---|
|  | 98 |  | 
|---|
| [83f176] | 99 | double mass;    //!< mass in g/mol | 
|---|
|  | 100 | double CovalentRadius;  //!< covalent radius | 
|---|
| [67c92b] | 101 | double Electronegativity; //!< electronegativity in Pauling units | 
|---|
| [1ce04b] | 102 | double VanDerWaalsRadius;  //!< van-der-Waals radius | 
|---|
| [ed26ae] | 103 | atomicNumber_t Z;          //!< atomic number | 
|---|
| [83f176] | 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() | 
|---|
| [bae8b0] | 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) | 
|---|
| [064178] | 111 | unsigned char color[3];   //!< typical color for this element (from Jmol) | 
|---|
| [83f176] | 112 |  | 
|---|
|  | 113 | std::string name;  //!< atom name, i.e. "Hydrogen" | 
|---|
| [7e3fc94] | 114 | std::string symbol; //!< short form of the atom, i.e. "H" | 
|---|
| [cd4ccc] | 115 | }; | 
|---|
|  | 116 |  | 
|---|
| [e345e3] | 117 | std::ostream &operator<<(std::ostream&,const element&); | 
|---|
| [cd4ccc] | 118 |  | 
|---|
|  | 119 | #endif /* ELEMENT_HPP_ */ | 
|---|