indigoX
atom.hpp
Go to the documentation of this file.
1 
3 #ifndef INDIGOX_CLASSES_ATOM_HPP
4 #define INDIGOX_CLASSES_ATOM_HPP
5 
6 #include "../utils/fwd_declares.hpp"
7 
8 #include <Eigen/Dense>
9 #include <memory>
10 #include <vector>
11 
12 namespace indigox {
13  class Atom {
15  friend class indigox::Molecule;
17  friend class cereal::access;
18 
19  public:
21  using AtomBonds = std::vector<Bond>;
23  using AtomAngles = std::vector<Angle>;
25  using AtomDihedrals = std::vector<Dihedral>;
26 
27  public:
29  enum class Stereo {
30  UNDEFINED,
31  ACHIRAL,
32  R,
33  S,
34  };
35 
36  private:
37  template <typename Archive>
38  void serialise(Archive &archive, const uint32_t version);
39 
40  public:
43 
44  private:
48  Atom(const Molecule &molecule, const Element &element, double x, double y,
49  double z, std::string name);
50 
51  public:
54  int64_t NumBonds() const;
55 
58  int64_t NumAngles() const;
59 
62  int64_t NumDihedrals() const;
63 
64  bool HasType() const;
65 
68  const Element &GetElement() const;
69 
72  int32_t GetFormalCharge() const;
73 
76  double GetPartialCharge() const;
77 
82  int64_t GetTag() const;
83 
84  int64_t GetID() const;
85 
86  int32_t GetResidueID();
87 
88  std::string GetResidueName();
89 
90  int32_t GetChargeGroupID() const;
91 
94  int32_t GetImplicitCount() const;
95 
96  int32_t NumHydrogenBonds() const;
97  int32_t NumHeavyAtomBonds() const;
98 
103  const Molecule &GetMolecule() const;
104 
107  const std::string &GetName() const;
108 
111  double GetX() const;
112 
115  double GetY() const;
116 
119  double GetZ() const;
120 
123  Stereo GetStereochemistry() const;
124 
127  const Eigen::Vector3d &GetPosition() const;
128 
131  int32_t AddImplicitHydrogen();
132 
136  int32_t RemoveImplicitHydrogen();
137 
140  void SetElement(const Element &e);
141 
144  void SetElement(std::string e);
145 
148  void SetElement(int32_t e);
149 
152  void SetFormalCharge(int32_t q);
153 
154  void SetChargeGroupID(int32_t id);
155 
158  void SetPartialCharge(double q);
159 
162  void SetImplicitCount(int32_t h);
163 
168  void SetTag(int32_t i);
169 
172  void SetName(std::string n);
173 
176  void SetPosition(double x, double y, double z);
177 
180  void SetStereochemistry(Stereo s);
181 
182  private:
187  void AddBond(const Bond &b);
188 
193  void AddAngle(const Angle &a);
194 
199  void AddDihedral(const Dihedral &d);
200 
205  void RemoveBond(const Bond &b);
206 
211  void RemoveAngle(const Angle &a);
212 
217  void RemoveDihedral(const Dihedral &d);
218 
219  public:
220  const AtomBonds &GetBonds() const;
221  const AtomAngles &GetAngles() const;
222  const AtomDihedrals &GetDihedrals() const;
223 
229  int64_t GetIndex() const;
230 
233  const FFAtom &GetType() const;
234 
237  void SetType(const FFAtom &type);
238 
239  private:
240  void Reset();
241 
242  private:
243  struct Impl;
244  std::shared_ptr<Impl> m_data;
245  };
246 
249 } // namespace indigox
250 
251 #endif /* INDIGOX_CLASSES_ATOM_HPP */
Definition: forcefield.hpp:18
double GetZ() const
Atom z position.
int32_t NumHydrogenBonds() const
Atom()=default
#define INDIGOX_GENERIC_PIMPL_CLASS_DEFAULTS(class_name)
Definition: fwd_declares.hpp:18
int64_t NumAngles() const
Number of valid angles this atom is a part of.
void SetType(const FFAtom &type)
Set the FF type of the atom.
void SetPosition(double x, double y, double z)
Set the x, y and z positions.
Definition: bond.hpp:11
int32_t GetFormalCharge() const
Formal charge on the atom.
std::vector< Angle > AtomAngles
Container for storing IXAngle references.
Definition: atom.hpp:23
Definition: atom.hpp:13
std::vector< Dihedral > AtomDihedrals
Container for storing IXDihedral references.
Definition: atom.hpp:25
bool HasType() const
int64_t GetTag() const
Tag of the atom.
Has R stereochemistry.
friend class cereal::access
Friendship allows IXAtom to be serialised.
Definition: atom.hpp:17
int64_t NumDihedrals() const
Number of valid dihedrals this atom is a part of.
const Element & GetElement() const
Element of the atom.
No defined stereochemistry.
void SetName(std::string n)
Set the atom name.
int64_t GetIndex() const
Get the index from the molecule.
void SetPartialCharge(double q)
Set the partial charge of this atom.
int64_t NumBonds() const
Number of valid bonds this atom is part of.
void SetTag(int32_t i)
Set the tag of this atom.
const FFAtom & GetType() const
Get the FF type of the atom.
const Molecule & GetMolecule() const
Molecule this atom is associated with.
int64_t GetID() const
double GetX() const
Atom x position.
std::string GetResidueName()
void SetChargeGroupID(int32_t id)
void SetStereochemistry(Stereo s)
Set the stereochemistry of an atomic center.
Namespace for all graph related functionality.
Definition: access.hpp:7
std::vector< Bond > AtomBonds
Container for storing Bond references.
Definition: atom.hpp:21
const AtomAngles & GetAngles() const
Definition: angle.hpp:12
int32_t RemoveImplicitHydrogen()
Remove an implicit hydrogen.
const Eigen::Vector3d & GetPosition() const
Vector of the atom's position.
Definition: molecule_impl.hpp:42
int32_t AddImplicitHydrogen()
Add an implicit hydrogen.
const AtomBonds & GetBonds() const
int32_t GetResidueID()
Definition: dihedral.hpp:14
int32_t GetChargeGroupID() const
const AtomDihedrals & GetDihedrals() const
Has S stereochemistry.
void SetImplicitCount(int32_t h)
Set the number of implicit hydrogens.
const std::string & GetName() const
Atom name.
Definition: molecule.hpp:15
Read only class for storing elemental information.
Definition: periodictable.hpp:28
void SetFormalCharge(int32_t q)
Set the formal charge of this atom.
double GetPartialCharge() const
Partial atomic charge on the atom.
#define INDIGOX_GENERIC_PIMPL_CLASS_OPERATORS(class_name, short_name)
Definition: fwd_declares.hpp:26
double GetY() const
Atom y position.
int32_t NumHeavyAtomBonds() const
Defined as no stereochemistry.
int32_t GetImplicitCount() const
Get number of implicit hydrogens.
void SetElement(const Element &e)
Set the element of this atom.
Stereo GetStereochemistry() const
Get the stereochemistry of the atom.
Stereo
Enum for the different types of atom stereochemistry.
Definition: atom.hpp:29