Molassembler  3.0.1
Molecule graph and conformer library
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 
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 
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 
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 
249 
256  boost::optional<unsigned> assigned() const;
257 
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 
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 
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
Handle arrangements of substituents at corners of an atom-centered shape.
A wrapper class around Utils' PositionCollection to emphasize that the positions stored therein are i...
Definition: AngstromPositions.h:25
Handles the steric permutation of substituents of a non-terminal central atom.
Definition: AtomStereopermutator.h:79
std::tuple< RankingInformation, ShapeMap > PropagatedState
Old state dumped upon propagation.
Definition: AtomStereopermutator.h:102
Handles specific relative arrangements of two atom stereopermutators joined by a bond.
Definition: BondStereopermutator.h:46
void fit(const SitePositionsPair &sitePositions, std::pair< FittingReferences, FittingReferences > fittingReferences, FittingMode mode=FittingMode::Thresholded)
Determines the assignment the permutator is in from positional information.
unsigned numAssignments() const
Returns the number of possible assignments.
void assign(boost::optional< unsigned > assignment)
Changes the assignment of the stereopermutator.
FittingMode
Differentiates how viable assignments are chosen during fitting.
Definition: BondStereopermutator.h:67
bool hasSameCompositeOrientation(const BondStereopermutator &other) const
Returns whether this stereopermutator has the same relative orientation as another stereopermutator.
boost::optional< unsigned > assigned() const
Returns the permutation index within the set of possible permutations, if set.
std::pair< SitePositions, SitePositions > SitePositionsPair
Spatial centroids of two atom stereopermutators' site atoms.
Definition: BondStereopermutator.h:77
BondStereopermutator()=delete
Constructs a bond stereopermutator on two atom stereopermutators without checking whether stereopermu...
double dihedral(const AtomStereopermutator &stereopermutatorA, SiteIndex siteIndexA, const AtomStereopermutator &stereopermutatorB, SiteIndex siteIndexB) const
Angle between sites at stereopermutators in the current assignment.
void propagateGraphChange(const AtomStereopermutator::PropagatedState &oldPermutator, const AtomStereopermutator &newPermutator, const PrivateGraph &inner, const StereopermutatorList &permutators)
Propagates the bond stereocenter's state through a possible ranking change on one of its constituting...
BondStereopermutator(const PrivateGraph &graph, const StereopermutatorList &stereopermutators, const BondIndex &edge, Alignment alignment=Alignment::Eclipsed)
Constructs a bond stereopermutator on two atom stereopermutators, removing obviously infeasible stere...
const Stereopermutations::Composite & composite() const
Gives read-only access to the underlying Composite object.
boost::optional< unsigned > indexOfPermutation() const
Returns the index of permutation.
BondIndex placement() const
Returns which bond this stereopermutator is placed on in the molecule.
unsigned numStereopermutations() const
Returns the number of possible stereopermutations.
std::pair< AtomIndex, AtomIndex > compositeAlignment() const
The atom identifier alignment of the permutational composite.
static std::vector< unsigned > notObviouslyInfeasibleStereopermutations(const PrivateGraph &graph, const AtomStereopermutator &stereopermutatorA, const AtomStereopermutator &stereopermutatorB, const Stereopermutations::Composite &composite)
Determine which stereopermutations aren't obviously infeasible.
Eigen::Matrix< double, 3, Eigen::Dynamic > SitePositions
Spatial centroids of atom stereopermutator site atoms.
Definition: BondStereopermutator.h:75
Alignment alignment() const
Returns alignment parameter this was constructed with.
std::string rankInfo() const
Returns an information for ranking equality checking purposes.
void fit(const AngstromPositions &angstromWrapper, std::pair< FittingReferences, FittingReferences > fittingReferences, FittingMode mode=FittingMode::Thresholded)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void propagateVertexRemoval(AtomIndex removedIndex)
Propagates invalidated atom indices through the removal of an index.
void assignRandom(Random::Engine &engine)
Assign the Stereopermutator at random.
std::string info() const
Returns an information string for diagnostic purposes.
Alignment
How dihedrals are aligned in the generation of stereopermutations.
Definition: BondStereopermutator.h:53
BondStereopermutator(const AtomStereopermutator &stereopermutatorA, const AtomStereopermutator &stereopermutatorB, const BondIndex &edge, Alignment alignment=Alignment::Eclipsed)
Constructs a bond stereopermutator on two atom stereopermutators without checking whether stereopermu...
void applyPermutation(const std::vector< AtomIndex > &permutation)
Applies an atom index permutation.
Library internal graph class wrapping BGL types.
Definition: PrivateGraph.h:26
Drives a PRNG.
Definition: Prng.h:24
Represents the composite of two shapes joined by a bond at arbitrary shape vertices.
Definition: Composites.h:34
Manages all stereopermutators that are part of a Molecule.
Definition: StereopermutatorList.h:30
Type helper for creating strong index types that are type-level distinct from their fundamental types...
Definition: StrongIndex.h:37
std::size_t AtomIndex
Unsigned integer atom index type. Used to refer to particular atoms.
Definition: Types.h:51
Type used to refer to particular bonds. Orders first < second.
Definition: Types.h:54
Definition: BondStereopermutatorImpl.h:23