Molassembler  1.0.0
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
BondStereopermutatorImpl.h
Go to the documentation of this file.
1 
8 #ifndef INCLUDE_MOLASSEMBLER_BOND_STEREOPERMUTATOR_IMPL_H
9 #define INCLUDE_MOLASSEMBLER_BOND_STEREOPERMUTATOR_IMPL_H
10 
12 
13 #include "boost/optional.hpp"
14 
17 
18 namespace Scine {
19 namespace Molassembler {
20 
21 class StereopermutatorList;
22 
24  /* Make sure static_cast-ing our Alignment enum to Composite's Alignment is
25  * safe and correct:
26  */
27  static_assert(
28  std::is_same<
29  std::underlying_type_t<Stereopermutations::Composite::Alignment>,
30  std::underlying_type_t<BondStereopermutator::Alignment>
31  >::value,
32  "Underlying type of stereopermutation's Alignment and BondStereopermutator's must match"
33  );
34  static_assert(
35  static_cast<Stereopermutations::Composite::Alignment>(BondStereopermutator::Alignment::Staggered) == Stereopermutations::Composite::Alignment::Staggered,
36  "Staggered Alignment values do not match across Alignment types"
37  );
38  static_assert(
39  static_cast<Stereopermutations::Composite::Alignment>(BondStereopermutator::Alignment::Eclipsed) == Stereopermutations::Composite::Alignment::Eclipsed,
40  "Eclipsed Alignment values do not match across Alignment types"
41  );
42  static_assert(
44  "EclipsedAndStaggered Alignment values do not match across Alignment types"
45  );
46  static_assert(
48  "BetweenEclipsedAndStaggered Alignment values do not match across Alignment types"
49  );
50 
53 
57  static bool cycleObviouslyInfeasible(
58  const PrivateGraph& graph,
59  const StereopermutatorList& stereopermutators,
60  const AtomStereopermutator& firstStereopermutator,
61  const AtomStereopermutator& secondStereopermutator,
62  std::tuple<AtomIndex, AtomIndex, double> dihedral,
63  const RankingInformation::Link& link
64  );
65 
66  static std::vector<unsigned> notObviouslyInfeasibleStereopermutations(
67  const PrivateGraph& graph,
68  const StereopermutatorList& stereopermutators,
69  const Stereopermutations::Composite& composite
70  );
72 
78  Impl(
79  const AtomStereopermutator& stereopermutatorA,
80  const AtomStereopermutator& stereopermutatorB,
81  BondIndex edge,
82  Alignment alignment
83  );
84 
90  Impl(
91  const PrivateGraph& graph,
92  const StereopermutatorList& stereopermutators,
93  BondIndex edge,
94  Alignment alignment
95  );
96 
97  void assign(boost::optional<unsigned> assignment);
98 
99  void assignRandom(Random::Engine& engine);
100 
101  void applyPermutation(const std::vector<AtomIndex>& permutation);
102 
103  void fit(
104  const AngstromPositions& angstromWrapper,
105  std::pair<FittingReferences, FittingReferences> fittingReferences,
106  FittingMode mode
107  );
108 
109  void propagateGraphChange(
110  const AtomStereopermutator::PropagatedState& oldPermutatorState,
111  const AtomStereopermutator& newPermutator,
112  const PrivateGraph& graph,
113  const StereopermutatorList& permutators
114  );
115 
116 /* Information */
117  Alignment alignment() const;
118 
119  boost::optional<unsigned> assigned() const;
120 
121  const Stereopermutations::Composite& composite() const;
122 
123  double dihedral(
124  const AtomStereopermutator& stereopermutatorA,
125  SiteIndex siteIndexA,
126  const AtomStereopermutator& stereopermutatorB,
127  SiteIndex siteIndexB
128  ) const;
129 
130  bool hasSameCompositeOrientation(const BondStereopermutator::Impl& other) const;
131 
132  boost::optional<unsigned> indexOfPermutation() const;
133 
134  unsigned numAssignments() const;
135 
136  unsigned numStereopermutations() const;
137 
138  std::string info() const;
139 
140  std::string rankInfo() const;
141 
142  BondIndex placement() const;
143 
144 /* Operators */
145  inline auto tie() const {
146  return std::make_tuple(std::ref(composite_), assigned());
147  }
148 
149 private:
158  std::vector<unsigned> feasiblePermutations_;
160  boost::optional<unsigned> assignment_;
161 
163  static std::vector<char> charifyRankedSites_(
164  const RankingInformation::RankedSitesType& sitesRanking,
165  const AtomStereopermutator::ShapeMap& shapeVertexMap
166  );
167 
168  static Stereopermutations::Composite constructComposite_(
169  const StereopermutatorList& stereopermutators,
170  BondIndex edge,
171  Alignment alignment
172  );
173 
174  static Stereopermutations::Composite::OrientationState makeOrientationState_(
175  const AtomStereopermutator& focalStereopermutator,
176  const AtomStereopermutator::ShapeMap& focalShapeMap,
177  const AtomStereopermutator& attachedStereopermutator
178  );
179 };
180 
181 } // namespace Molassembler
182 } // namespace Scine
183 
184 #endif
At least one pair of substituents are staggered along the axis.
std::vector< unsigned > feasiblePermutations_
List of indices into allPermutations of composite_ that are not obviously infeasible.
Definition: BondStereopermutatorImpl.h:158
Impl(const AtomStereopermutator &stereopermutatorA, const AtomStereopermutator &stereopermutatorB, BondIndex edge, Alignment alignment)
Constructor for use of BondStereopermutator in isolation.
Definition: BondStereopermutatorImpl.h:23
Generates all operators using a method returning a tuple.
Definition: OperatorSuppliers.h:84
Type helper for creating strong index types that are type-level distinct from their fundamental types...
Definition: StrongIndex.h:37
Drives a PRNG.
Definition: Prng.h:24
At least one pair of substituents are staggered along the axis.
static std::vector< char > charifyRankedSites_(const RankingInformation::RankedSitesType &sitesRanking, const AtomStereopermutator::ShapeMap &shapeVertexMap)
Yields abstract site characters at their shape positions.
A wrapper class around Utils&#39; PositionCollection to emphasize that the positions stored therein are i...
Definition: AngstromPositions.h:25
Encompasses the orientation of a shape along a fused bond.
Definition: Composites.h:55
Handles the steric permutation of substituents of a non-terminal central atom.
Definition: AtomStereopermutator.h:79
std::tuple< RankingInformation, Stereopermutators::Abstract, Stereopermutators::Feasible, ShapeMap > PropagatedState
Old state dumped upon propagation.
Definition: AtomStereopermutator.h:89
At least two shape vertices eclipse one another along the axis.
Manages all stereopermutators that are part of a Molecule.
Definition: StereopermutatorList.h:30
static std::vector< unsigned > notObviouslyInfeasibleStereopermutations(const PrivateGraph &graph, const StereopermutatorList &stereopermutators, const Stereopermutations::Composite &composite)
Check whether a cycle is obviously infeasible.
Library internal graph class wrapping BGL types.
Definition: PrivateGraph.h:24
Handle rotational arrangements of adjacent atom-centered shapes.
boost::optional< unsigned > assignment_
Index optional into feasiblePermutations_ of the current assignment.
Definition: BondStereopermutatorImpl.h:160
At least two substituents eclipse one another along the axis.
Type used to refer to particular bonds. Orders first &lt; second.
Definition: Types.h:54
BondIndex edge_
Edge this stereopermutator is placed on.
Definition: BondStereopermutatorImpl.h:156
Data struct to store chiral constraints for DG.
static bool cycleObviouslyInfeasible(const PrivateGraph &graph, const StereopermutatorList &stereopermutators, const AtomStereopermutator &firstStereopermutator, const AtomStereopermutator &secondStereopermutator, std::tuple< AtomIndex, AtomIndex, double > dihedral, const RankingInformation::Link &link)
Check whether a cycle is obviously infeasible.
Offset exactly halfway between eclipsed and staggered alignments.
Stereopermutations::Composite composite_
Definition: BondStereopermutatorImpl.h:154
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
Generate rotational orientations of two shapes fused over a bond.
Offset exactly halfway between eclipsed and staggered alignments.
Represents the composite of two shapes joined by a bond at arbitrary shape vertices.
Definition: Composites.h:33
NestedList< SiteIndex > RankedSitesType
Ascending ordered list of binding site indices (sub-list site indices equal)
Definition: RankingInformation.h:40