Molassembler  3.0.0
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
BondStereopermutator.h
Go to the documentation of this file.
1 
11 #ifndef INCLUDE_MOLASSEMBLER_BOND_STEREOPERMUTATOR_H
12 #define INCLUDE_MOLASSEMBLER_BOND_STEREOPERMUTATOR_H
13 
15 
16 #include <string>
17 
18 namespace Scine {
19 namespace Molassembler {
20 
21 /* Forward-declarations */
22 namespace Stereopermutations {
23 class Composite;
24 } // namespace Stereopermutations
25 
26 namespace Random {
27 class Engine;
28 } // namespace Random
29 
30 class AngstromPositions;
31 class PrivateGraph;
32 class StereopermutatorList;
33 
34 namespace DistanceGeometry {
35 class SpatialModel;
36 struct ChiralConstraint;
37 } // namespace DistanceGeometry
38 
46 class MASM_EXPORT BondStereopermutator {
47 public:
50 
53  enum class Alignment {
55  Eclipsed,
57  Staggered,
59  EclipsedAndStaggered,
61  BetweenEclipsedAndStaggered
62  };
63 
67  enum class FittingMode {
69  Thresholded,
71  Nearest
72  };
73 
75  using SitePositions = Eigen::Matrix<double, 3, Eigen::Dynamic>;
77  using SitePositionsPair = std::pair<SitePositions, SitePositions>;
79 
82 
92  static constexpr double assignmentAcceptanceParameter = 0.1;
94 
97 
102  static std::vector<unsigned> notObviouslyInfeasibleStereopermutations(
103  const PrivateGraph& graph,
104  const AtomStereopermutator& stereopermutatorA,
105  const AtomStereopermutator& stereopermutatorB,
106  const Stereopermutations::Composite& composite
107  );
109 
112  BondStereopermutator(BondStereopermutator&& other) noexcept;
113  BondStereopermutator& operator = (BondStereopermutator&& other) noexcept;
115  BondStereopermutator& operator = (const BondStereopermutator& other);
118 
121  BondStereopermutator() = delete;
130  const AtomStereopermutator& stereopermutatorA,
131  const AtomStereopermutator& stereopermutatorB,
132  const BondIndex& edge,
133  Alignment alignment = Alignment::Eclipsed
134  );
135 
143  const PrivateGraph& graph,
144  const StereopermutatorList& stereopermutators,
145  const BondIndex& edge,
146  Alignment alignment = Alignment::Eclipsed
147  );
149 
152 
161  void assign(boost::optional<unsigned> assignment);
162 
172  void assignRandom(Random::Engine& engine);
173 
179  void applyPermutation(const std::vector<AtomIndex>& permutation);
180 
182  const AtomStereopermutator& stereopermutator;
183  const AtomStereopermutator::ShapeMap& shapeMap;
184  };
185 
203  void fit(
204  const SitePositionsPair& sitePositions,
205  std::pair<FittingReferences, FittingReferences> fittingReferences,
206  FittingMode mode = FittingMode::Thresholded
207  );
208 
210  void fit(
211  const AngstromPositions& angstromWrapper,
212  std::pair<FittingReferences, FittingReferences> fittingReferences,
213  FittingMode mode = FittingMode::Thresholded
214  );
215 
231  void propagateGraphChange(
232  const AtomStereopermutator::PropagatedState& oldPermutator,
233  const AtomStereopermutator& newPermutator,
234  const PrivateGraph& inner,
235  const StereopermutatorList& permutators
236  );
237 
239  void propagateVertexRemoval(AtomIndex removedIndex);
241 
244 
248  Alignment alignment() const;
249 
256  boost::optional<unsigned> assigned() const;
257 
262  const Stereopermutations::Composite& composite() const;
263 
265  std::pair<AtomIndex, AtomIndex> compositeAlignment() const;
266 
279  double dihedral(
280  const AtomStereopermutator& stereopermutatorA,
281  SiteIndex siteIndexA,
282  const AtomStereopermutator& stereopermutatorB,
283  SiteIndex siteIndexB
284  ) const;
285 
291  bool hasSameCompositeOrientation(const BondStereopermutator& other) const;
292 
297  boost::optional<unsigned> indexOfPermutation() const;
298 
303  unsigned numAssignments() const;
304 
309  unsigned numStereopermutations() const;
310 
315  std::string info() const;
316 
321  std::string rankInfo() const;
322 
327  BondIndex placement() const;
329 
332  bool operator < (const BondStereopermutator& other) const;
337  bool operator == (const BondStereopermutator& other) const;
339  bool operator != (const BondStereopermutator& other) const;
341 
342 private:
343  struct Impl;
344  std::unique_ptr<Impl> pImpl_;
345 };
346 
347 } // namespace Molassembler
348 } // namespace Scine
349 
350 #endif
std::pair< SitePositions, SitePositions > SitePositionsPair
Spatial centroids of two atom stereopermutators&#39; site atoms.
Definition: BondStereopermutator.h:77
Definition: BondStereopermutatorImpl.h:23
Type helper for creating strong index types that are type-level distinct from their fundamental types...
Definition: StrongIndex.h:37
A wrapper class around Utils&#39; PositionCollection to emphasize that the positions stored therein are i...
Definition: AngstromPositions.h:25
std::tuple< RankingInformation, ShapeMap > PropagatedState
Old state dumped upon propagation.
Definition: AtomStereopermutator.h:102
Handles the steric permutation of substituents of a non-terminal central atom.
Definition: AtomStereopermutator.h:79
Handle arrangements of substituents at corners of an atom-centered shape.
Handles specific relative arrangements of two atom stereopermutators joined by a bond.
Definition: BondStereopermutator.h:46
Manages all stereopermutators that are part of a Molecule.
Definition: StereopermutatorList.h:30
std::size_t AtomIndex
Unsigned integer atom index type. Used to refer to particular atoms.
Definition: Types.h:51
Permutation applyPermutation(const Permutation &occupation, const Permutation &permutation)
Rotates a passed list of indices with a specified rotation vector.
Library internal graph class wrapping BGL types.
Definition: PrivateGraph.h:26
Eigen::Matrix< double, 3, Eigen::Dynamic > SitePositions
Spatial centroids of atom stereopermutator site atoms.
Definition: BondStereopermutator.h:75
Type used to refer to particular bonds. Orders first &lt; second.
Definition: Types.h:54
FittingMode
Differentiates how viable assignments are chosen during fitting.
Definition: BondStereopermutator.h:67
Alignment
How dihedrals are aligned in the generation of stereopermutations.
Definition: BondStereopermutator.h:53
Represents the composite of two shapes joined by a bond at arbitrary shape vertices.
Definition: Composites.h:34