indigoX
bond.hpp
Go to the documentation of this file.
1 
2 #include "../utils/fwd_declares.hpp"
3 
4 #include <array>
5 #include <memory>
6 
7 #ifndef INDIGOX_CLASSES_BOND_HPP
8 #define INDIGOX_CLASSES_BOND_HPP
9 
10 namespace indigox {
11  class Bond {
13  friend class indigox::Molecule;
15  friend class cereal::access;
16 
17  public:
19  using BondAtoms = std::array<Atom, 2>;
20 
21  public:
23  enum class Stereo {
24  UNDEFINED,
25  NONE,
26  E,
27  Z,
28  };
29 
31  enum class Order {
32  UNDEFINED,
33  SINGLE,
34  DOUBLE,
35  TRIPLE,
36  QUADRUPLE,
37  AROMATIC,
38  ONEANDAHALF,
39  TWOANDAHALF,
40  };
41 
42  private:
43  template <typename Archive>
44  void serialise(Archive &archive, const uint32_t version);
45 
46  public:
49 
50  private:
56  Bond(const Atom &a, const Atom &b, const Molecule &m, Order o);
57 
58  public:
63  int64_t GetTag() const;
64  int64_t GetID() const;
65 
70  const Molecule &GetMolecule() const;
71 
75  Order GetOrder() const;
76 
80  Stereo GetStereochemistry() const;
81 
86  void SetTag(int64_t tag);
87 
90  void SetOrder(Order order);
91 
94  void SetStereochemistry(Stereo stereo);
95 
98  const BondAtoms &GetAtoms() const;
99 
100  public:
103  constexpr int64_t NumAtoms() const { return 2; }
104 
110  int64_t GetIndex() const;
111 
114  const FFBond &GetType() const;
115 
118  void SetType(const FFBond &type);
119 
120  bool HasType() const;
121 
122  bool IsAmideBond() const;
123  bool IsCarbonylBond() const;
124 
125  private:
126  void Reset();
127 
128  private:
129  struct Impl;
130  std::shared_ptr<Impl> m_data;
131  };
132 
137 
138 } // namespace indigox
139 
140 #endif /* INDIGOX_CLASSES_BOND_HPP */
Definition: forcefield.hpp:58
No defined stereochemistry.
#define INDIGOX_GENERIC_PIMPL_CLASS_DEFAULTS(class_name)
Definition: fwd_declares.hpp:18
Definition: bond.hpp:11
void SetStereochemistry(Stereo stereo)
Set the stereochemistry of the bond.
Definition: atom.hpp:13
const Molecule & GetMolecule() const
Molecule this bond is associated with.
int64_t GetIndex() const
Get the index from the molecule.
Stereo GetStereochemistry() const
Get the stereochemistry of the bond.
constexpr int64_t NumAtoms() const
Number of atoms this bond is between.
Definition: bond.hpp:103
bool HasType() const
Namespace for all graph related functionality.
Definition: access.hpp:7
Defined as no stereochemistry.
Order
Enum for the different possible bond orders.
Definition: bond.hpp:31
No defined bond order.
friend class cereal::access
Friendship allows serialisation.
Definition: bond.hpp:15
void SetTag(int64_t tag)
Set the tag of this bond.
Bond()=default
int64_t GetTag() const
Tag of the bond.
const BondAtoms & GetAtoms() const
Get the atoms of the bond.
Definition: molecule.hpp:15
void SetOrder(Order order)
Set the bond order.
#define INDIGOX_GENERIC_PIMPL_CLASS_OPERATORS(class_name, short_name)
Definition: fwd_declares.hpp:26
bool IsCarbonylBond() const
const FFBond & GetType() const
Get the type of the bond.
void SetType(const FFBond &type)
Set the type of the bond.
Order GetOrder() const
Get the bond order of the bond.
int64_t GetID() const
std::array< Atom, 2 > BondAtoms
Container for storing Atom references assigned to an Bond.
Definition: bond.hpp:19
bool IsAmideBond() const
Stereo
Enum for the different possible bond stereochemistry states.
Definition: bond.hpp:23
Non-aromatic bond order of 1.5.