indigoX
periodictable.hpp
Go to the documentation of this file.
1 
4 #ifndef INDIGOX_CLASSES_PERIODIC_TABLE_HPP
5 #define INDIGOX_CLASSES_PERIODIC_TABLE_HPP
6 
7 #include "../utils/common.hpp"
8 #include "../utils/fwd_declares.hpp"
9 
10 #include <EASTL/vector_map.h>
11 #include <array>
12 #include <cstdint>
13 #include <iostream>
14 
15 namespace indigox {
16 
28  class Element {
30  friend class PeriodicTable;
31 
34 
35  public:
36  Element();
37  Element(const Element &);
38  Element(Element &&);
39  Element &operator=(const Element &);
41 
42  private:
57  Element(uint8_t Z, std::string name, std::string sym, double mass,
58  uint8_t grp, uint8_t prd, uint8_t val, uint8_t oct, uint8_t hyp,
59  double rad, double cov, double vdw, double chi);
60 
61  public:
64  double GetAtomicMass() const;
65 
68  int32_t GetAtomicNumber() const;
69 
73  double GetAtomicRadius() const;
74 
78  double GetCovalentRadius() const;
79 
83  double GetVanDerWaalsRadius() const;
84 
87  std::string GetName() const;
88 
91  std::string GetSymbol() const;
92 
95  int32_t GetGroup() const;
96 
99  int32_t GetPeriod() const;
100 
103  int32_t GetValenceElectronCount() const;
104 
107  int32_t GetOctet() const;
108 
112  int32_t GetHypervalentOctet() const;
113 
116  double GetElectronegativity() const;
117 
118  public:
119  operator bool();
120  bool operator==(int32_t Z) const;
121  bool operator==(const std::string &name) const;
122  bool operator==(const Element &element) const;
123  bool operator!=(int32_t Z) const;
124  bool operator!=(const std::string &name) const;
125  bool operator!=(const Element &element) const;
126  bool operator<(const Element &element) const;
127  bool operator>(const Element &element) const;
128  bool operator<=(const Element &element) const;
129  bool operator>=(const Element &element) const;
130 
131  private:
132  struct ElementImpl;
133  std::shared_ptr<ElementImpl> m_elemdat;
134  };
135 
136  std::ostream &operator<<(std::ostream &, const Element &);
137 
138 #define INDIGOX_NUMBER_ELEMENTS 119
139 
147  friend const PeriodicTable &GetPeriodicTable();
148 
151 
152  public:
158  Element GetElement(const int32_t z) const;
159 
167  Element GetElement(const std::string name) const;
168 
173  Element operator[](const int32_t z) const { return GetElement(z); }
174 
179  Element operator[](const std::string name) const {
180  return GetElement(name);
181  }
182 
187  Element GetUndefined() const { return _elems.at(0); }
188 
191  inline size_t NumElements() const { return _elems.size() - 1; }
192 
193  private:
194  PeriodicTable();
195 
200  void GeneratePeriodicTable();
201 
202  private:
204  std::array<Element, INDIGOX_NUMBER_ELEMENTS> _elems;
206  eastl::vector_map<std::string, size_t> _name_to_idx;
207  };
208 
214  std::ostream &operator<<(std::ostream &os, const PeriodicTable &pt);
215 
216  const PeriodicTable &GetPeriodicTable();
217 
218 } // namespace indigox
219 
220 #endif /* INDIGOX_CLASSES_PERIODIC_TABLE_HPP */
bool operator<=(const Element &element) const
double GetCovalentRadius() const
Get covalent radius.
bool operator!=(int32_t Z) const
double GetAtomicMass() const
Get atomic mass.
Element operator[](const int32_t z) const
Get the element with the given atomic number.
Definition: periodictable.hpp:173
friend struct indigox::test::TestElement
Friendship allows testing.
Definition: periodictable.hpp:33
double GetElectronegativity() const
Get electronegativity.
Element GetElement(const int32_t z) const
Get the element with the given atomic number.
int32_t GetOctet() const
Get full outer shell octet.
const PeriodicTable & GetPeriodicTable()
Element operator[](const std::string name) const
Get the element with the given name or symbol.
Definition: periodictable.hpp:179
std::string GetSymbol() const
Get element symbol.
double GetAtomicRadius() const
Get atomic radius.
Namespace for all graph related functionality.
Definition: access.hpp:7
Element & operator=(const Element &)
Element GetUndefined() const
Get the element for use when an element is not defined.
Definition: periodictable.hpp:187
std::string GetName() const
Get element name.
size_t NumElements() const
Number of elements in the PeriodicTable.
Definition: periodictable.hpp:191
bool operator>(const Element &element) const
int32_t GetValenceElectronCount() const
Get number of valence electrons.
Read only class for storing elemental information.
Definition: periodictable.hpp:28
int32_t GetHypervalentOctet() const
Get full outer shell octet whne allowing for hypervalency.
bool operator>=(const Element &element) const
int32_t GetAtomicNumber() const
Get atomic number.
std::ostream & operator<<(std::ostream &os, const Dihedral &dhd)
int32_t GetGroup() const
Get element group number.
bool operator==(int32_t Z) const
friend struct indigox::test::TestPeriodicTable
Friendship allws for testing implementation.
Definition: periodictable.hpp:150
bool operator<(const Element &element) const
double GetVanDerWaalsRadius() const
Get van der Waals radius.
Singleton class for storing and access elemental information.
Definition: periodictable.hpp:145
friend const PeriodicTable & GetPeriodicTable()
Friendship allows for access to a single PeriodicTable instance.
int32_t GetPeriod() const
Get element period.