indigoX
athenaeum.hpp
Go to the documentation of this file.
1 #include "../utils/fwd_declares.hpp"
2 #include "../utils/quad.hpp"
3 #include "../utils/triple.hpp"
4 #include <boost/dynamic_bitset_fwd.hpp>
5 
6 #include <algorithm>
7 #include <map>
8 #include <vector>
9 
10 #ifndef INDIGOX_CLASSES_ATHENAEUM_HPP
11 #define INDIGOX_CLASSES_ATHENAEUM_HPP
12 
13 namespace indigox {
14 
17  class Fragment {
18  friend class cereal::access;
19  friend class Athenaeum;
20 
21  public:
25  enum class OverlapType { GenericOverlap };
26 
28  using OverlapVertex = std::pair<OverlapType, graph::CMGVertex>;
31  using BndType = std::pair<AtmType, AtmType>;
34 
35  private:
36  template <class Archive>
37  void serialise(Archive &archive, const uint32_t version);
38 
39  public:
44 
51  Fragment(const graph::MolecularGraph &G, std::vector<graph::MGVertex> &frag,
52  std::vector<graph::MGVertex> &overlap);
53 
54  Fragment(const Molecule &mol, std::vector<Atom> &frag,
55  std::vector<Atom> &overlap);
56 
58  const std::vector<graph::CMGVertex> &GetFragment() const;
59  const boost::dynamic_bitset<> &GetSupersets() const;
60  size_t Size() const;
61  const std::vector<OverlapVertex> &GetOverlap() const;
62  bool IsFragmentVertex(const graph::CMGVertex &v) const;
63  bool IsOverlapVertex(const graph::CMGVertex &v) const;
64  const std::vector<AtmType> &GetAtoms() const;
65  const std::vector<BndType> &GetBonds() const;
66  const std::vector<AngType> &GetAngles() const;
67  const std::vector<DhdType> &GetDihedrals() const;
68 
69  private:
70  struct FragmentData;
71  std::shared_ptr<FragmentData> m_data;
72  };
73 
76  class Athenaeum {
77  friend class cereal::access;
78 
79  public:
80  enum class Settings : uint8_t {
83  BoolCount,
88  CycleSize,
89  IntCount
90  };
91 
92  // Settings
93  bool GetBool(Settings param);
94  void SetBool(Settings param);
95  void UnsetBool(Settings param);
96 
97  int32_t GetInt(Settings param);
98  void SetInt(Settings param, int32_t value);
99 
100  void DefaultSettings();
101  // End Settings
102 
103  using FragContain = std::vector<Fragment>;
104  using MoleculeFragments = std::map<Molecule, FragContain>;
105 
106  private:
107  template <class Archive>
108  void serialise(Archive &archive, const uint32_t version);
109 
110  public:
115 
116  Athenaeum(const Forcefield &ff);
117  Athenaeum(const Forcefield &ff, int32_t overlap);
118  Athenaeum(const Forcefield &ff, int32_t overlap, int32_t ring_overlap);
119 
120  size_t NumFragments() const;
121  size_t NumFragments(const Molecule &mol) const;
122 
123  const MoleculeFragments &GetFragments() const;
124  const FragContain &GetFragments(const Molecule &mol) const;
125  bool HasFragments(const Molecule &mol) const;
126 
127  const Forcefield &GetForcefield() const;
128  // bool CheckSelfConsistent();
129 
132  bool AddFragment(const Fragment &frag);
133 
136  size_t AddAllFragments(const Molecule &mol);
137 
138  private:
139  void SortAndMask(const Molecule &mol);
140 
141  private:
142  struct Impl;
143  std::shared_ptr<Impl> m_data;
144  };
145 
146  void SaveAthenaeum(const Athenaeum &ath, std::string path);
147  Athenaeum LoadAthenaeum(std::string path);
148 
149 } // namespace indigox
150 
151 #endif /* INDIGOX_CLASSES_ATHENAEUM_HPP */
Athenaeum LoadAthenaeum(std::string path)
Fragment(const graph::MolecularGraph &G, std::vector< graph::MGVertex > &frag, std::vector< graph::MGVertex > &overlap)
Normal constructor.
const std::vector< DhdType > & GetDihedrals() const
void SaveAthenaeum(const Athenaeum &ath, std::string path)
bool IsOverlapVertex(const graph::CMGVertex &v) const
#define INDIGOX_GENERIC_PIMPL_CLASS_DEFAULTS(class_name)
Definition: fwd_declares.hpp:18
int32_t GetInt(Settings param)
size_t Size() const
void SetInt(Settings param, int32_t value)
const std::vector< graph::CMGVertex > & GetFragment() const
Athenaeum class for fragment storage in CherryPicker algorithm.
Definition: athenaeum.hpp:76
Definition: condensed.hpp:131
void UnsetBool(Settings param)
Settings
Definition: athenaeum.hpp:80
std::map< Molecule, FragContain > MoleculeFragments
Definition: athenaeum.hpp:104
Class for the vertices of an IXCondensedMolecularGraph.
Definition: condensed.hpp:21
std::pair< AtmType, AtmType > BndType
Definition: athenaeum.hpp:31
Athenaeum(const Forcefield &ff)
bool HasFragments(const Molecule &mol) const
Class containing a graph representation of a molecule.
Definition: molecular.hpp:95
Namespace for all graph related functionality.
Definition: access.hpp:7
Class for the vertices of a IXMolecularGraph.
Definition: molecular.hpp:20
const std::vector< AtmType > & GetAtoms() const
std::vector< Fragment > FragContain
Definition: athenaeum.hpp:103
OverlapType
Type of overlapping vertex.
Definition: athenaeum.hpp:25
size_t NumFragments() const
friend class cereal::access
Definition: athenaeum.hpp:77
const std::vector< OverlapVertex > & GetOverlap() const
const std::vector< BndType > & GetBonds() const
const Forcefield & GetForcefield() const
Definition: triple.hpp:11
const graph::CondensedMolecularGraph & GetGraph() const
bool AddFragment(const Fragment &frag)
Adds the given fragment.
Definition: molecule.hpp:15
#define INDIGOX_GENERIC_PIMPL_CLASS_OPERATORS(class_name, short_name)
Definition: fwd_declares.hpp:26
Definition: forcefield.hpp:333
void SetBool(Settings param)
Fragment class for CherryPicker parameterisation algorithm.
Definition: athenaeum.hpp:17
friend class cereal::access
Definition: athenaeum.hpp:18
size_t AddAllFragments(const Molecule &mol)
Determines all the fragments of a molecule and adds them.
const std::vector< AngType > & GetAngles() const
bool GetBool(Settings param)
const MoleculeFragments & GetFragments() const
bool IsFragmentVertex(const graph::CMGVertex &v) const
std::pair< OverlapType, graph::CMGVertex > OverlapVertex
Type used to match an overlap vertex to its type of overlap.
Definition: athenaeum.hpp:28
Definition: quad.hpp:12
const boost::dynamic_bitset & GetSupersets() const