Molassembler  3.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 SitePositionsPair& sitePositions,
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  void propagateVertexRemoval(AtomIndex removedIndex);
117 
118 /* Information */
119  Alignment alignment() const;
120 
121  boost::optional<unsigned> assigned() const;
122 
123  const Stereopermutations::Composite& composite() const;
124 
125  double dihedral(
126  const AtomStereopermutator& stereopermutatorA,
127  SiteIndex siteIndexA,
128  const AtomStereopermutator& stereopermutatorB,
129  SiteIndex siteIndexB
130  ) const;
131 
132  bool hasSameCompositeOrientation(const BondStereopermutator::Impl& other) const;
133 
134  boost::optional<unsigned> indexOfPermutation() const;
135 
136  unsigned numAssignments() const;
137 
138  unsigned numStereopermutations() const;
139 
140  std::string info() const;
141 
142  std::string rankInfo() const;
143 
144  BondIndex placement() const;
145 
146 /* Operators */
147  inline auto tie() const {
148  return std::make_tuple(std::ref(composite_), assigned());
149  }
150 
151 private:
160  std::vector<unsigned> feasiblePermutations_;
162  boost::optional<unsigned> assignment_;
163 
166  const RankingInformation::RankedSitesType& sitesRanking,
167  const AtomStereopermutator::ShapeMap& shapeVertexMap
168  );
169 
170  static Stereopermutations::Composite constructComposite_(
171  const StereopermutatorList& stereopermutators,
172  BondIndex edge,
173  Alignment alignment
174  );
175 
176  static Stereopermutations::Composite::OrientationState makeOrientationState_(
177  const AtomStereopermutator& focalStereopermutator,
178  const AtomStereopermutator::ShapeMap& focalShapeMap,
179  const AtomStereopermutator& attachedStereopermutator
180  );
181 };
182 
183 } // namespace Molassembler
184 } // namespace Scine
185 
186 #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:160
std::pair< SitePositions, SitePositions > SitePositionsPair
Spatial centroids of two atom stereopermutators&#39; site atoms.
Definition: BondStereopermutator.h:77
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:78
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.
std::tuple< RankingInformation, ShapeMap > PropagatedState
Old state dumped upon propagation.
Definition: AtomStereopermutator.h:102
Encompasses the orientation of a shape along a fused bond.
Definition: Composites.h:56
Handles the steric permutation of substituents of a non-terminal central atom.
Definition: AtomStereopermutator.h:79
At least two shape vertices eclipse one another along the axis.
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
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:26
Handle rotational arrangements of adjacent atom-centered shapes.
boost::optional< unsigned > assignment_
Index optional into feasiblePermutations_ of the current assignment.
Definition: BondStereopermutatorImpl.h:162
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:158
static Stereopermutations::Stereopermutation::Occupation makeOccupation_(const RankingInformation::RankedSitesType &sitesRanking, const AtomStereopermutator::ShapeMap &shapeVertexMap)
Yields abstract site characters at their shape positions.
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:156
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:34
NestedList< SiteIndex > RankedSitesType
Ascending ordered list of binding site indices (sub-list site indices equal)
Definition: RankingInformation.h:40