Molassembler  1.2.0
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
AtomStereopermutatorImpl.h
Go to the documentation of this file.
1 
8 #ifndef INCLUDE_MOLASSEMBLER_ATOM_STEREOPERMUTATOR_IMPL_H
9 #define INCLUDE_MOLASSEMBLER_ATOM_STEREOPERMUTATOR_IMPL_H
10 
12 
16 
17 #include "boost/optional.hpp"
18 
19 namespace Scine {
20 namespace Molassembler {
21 
22 namespace Shapes {
23 namespace Properties {
24 struct ShapeTransitionGroup;
25 } // namespace Properties
26 } // namespace Shapes
27 
29 public:
32 
39 
46  static Shapes::Shape down(Shapes::Shape shape, Shapes::Vertex removedVertex);
47 
51  static boost::optional<std::vector<Shapes::Vertex>> selectTransitionMapping(
52  const Shapes::Properties::ShapeTransitionGroup& mappingsGroup,
53  const ChiralStatePreservation& preservationOption
54  );
55 
57  static bool thermalized(
58  AtomIndex centerAtom,
59  Shapes::Shape shape,
60  const RankingInformation& ranking,
61  const Graph& graph
62  );
64 
65 /* Constructors */
74  Impl(
75  const Graph& graph,
76  Shapes::Shape shape,
77  AtomIndex centerAtom,
78  RankingInformation ranking
79  );
80 
81  Impl(
82  AtomIndex centerAtom,
83  Shapes::Shape shape,
84  RankingInformation ranking,
85  const FeasiblesGenerator& feasibility,
86  const ThermalizationPredicate& thermalization
87  );
88 
89 /* Modification */
91  void assign(boost::optional<unsigned> assignment);
92 
97  void assign(std::vector<Shapes::Vertex> vertexMapping);
98 
100  void assignRandom(Random::Engine& engine);
101 
107  void applyPermutation(const std::vector<AtomIndex>& permutation);
108 
114  boost::optional<ShapeMap> fit(
115  const SiteCentroids& centroids,
116  const FeasiblesGenerator& feasibility,
117  const ThermalizationPredicate& thermalization
118  );
119 
125  boost::optional<PropagatedState> propagate(
126  RankingInformation newRanking,
127  boost::optional<Shapes::Shape> shapeOption,
128  const FeasiblesGenerator& feasibility,
129  const ThermalizationPredicate& thermalization
130  );
131 
136  void propagateVertexRemoval(AtomIndex removedIndex);
137 
139  void setShape(
140  Shapes::Shape shape,
141  const FeasiblesGenerator& feasibility,
142  const ThermalizationPredicate& thermalization
143  );
144 
146  void thermalize(bool thermalization);
147 
148 /* Information */
150  double angle(SiteIndex i, SiteIndex j) const;
151 
159  boost::optional<unsigned> assigned() const;
160 
162  AtomIndex placement() const;
163 
171  boost::optional<unsigned> indexOfPermutation() const;
172 
186  std::vector<MinimalChiralConstraint> minimalChiralConstraints(bool enforce = false) const;
187 
189  std::string info() const;
190 
192  std::string rankInfo() const;
193 
202  std::vector<std::vector<SiteIndex>> siteGroups() const;
203 
206  const AngstromPositions& wrapper,
207  const std::vector<std::pair<AtomIndex, AtomIndex>>& substitutions = {}
208  ) const;
209 
210  inline bool thermalized() const {
211  return thermalized_;
212  }
213 
219 
221  const std::vector<unsigned>& getFeasible() const;
222 
224  const RankingInformation& getRanking() const;
225 
227  Shapes::Shape getShape() const;
228 
233  const ShapeMap& getShapePositionMap() const;
234 
243  unsigned numAssignments() const;
244 
251  unsigned numStereopermutations() const;
252 
253 /* Operators */
254  inline auto tie() const {
255  return std::make_tuple(shape_, centerAtom_, numStereopermutations(), assigned());
256  }
257 
258 private:
259 /* State */
262 
265 
268 
271 
273  std::vector<unsigned> feasibles_;
274 
276  boost::optional<unsigned> assignmentOption_;
277 
280 
283 };
284 
285 } // namespace Molassembler
286 } // namespace Scine
287 
288 #endif
ShapeMap shapePositionMap_
Derived property of assignmentOption_.
Definition: AtomStereopermutatorImpl.h:279
std::function< bool(AtomIndex, Shapes::Shape, const RankingInformation &)> ThermalizationPredicate
Predicate to decide whether an atom stereopermutator is thermalized.
Definition: AtomStereopermutator.h:88
A grouping of index mappings of equal angular and chiral distortion.
Definition: Properties.h:233
boost::optional< ShapeMap > fit(const SiteCentroids &centroids, const FeasiblesGenerator &feasibility, const ThermalizationPredicate &thermalization)
Compute the set of abstract permutations.
Ranking data of substituents around a central vertex.
Definition: RankingInformation.h:23
AtomIndex placement() const
Returns a single-element vector containing the central atom.
boost::optional< unsigned > indexOfPermutation() const
Returns IOP within the set of symbolic ligand permutations.
Generates all operators using a method returning a tuple.
Definition: OperatorSuppliers.h:78
Drives a PRNG.
Definition: Prng.h:24
static bool thermalized(AtomIndex centerAtom, Shapes::Shape shape, const RankingInformation &ranking, const Graph &graph)
Whether the stereopermutations interconvert rapidly at selected temp.
const std::vector< unsigned > & getFeasible() const
Returns the list of feasible abstract permutations.
A wrapper class around Utils&#39; PositionCollection to emphasize that the positions stored therein are i...
Definition: AngstromPositions.h:25
ShapeResult shape(const PositionCollection &normalizedPositions, Shape shape)
Forwarding function to calculate the continuous shape measure.
unsigned numAssignments() const
Returns the number of possible permutations.
ChiralStatePreservation
Specifies the effects of graph modifications on chiral centers.
Definition: Options.h:129
const RankingInformation & getRanking() const
Returns the underlying ranking.
Eigen::Matrix< double, 3, Eigen::Dynamic > SiteCentroids
Spatial positions of the centroids of sites.
Definition: AtomStereopermutator.h:85
void setShape(Shapes::Shape shape, const FeasiblesGenerator &feasibility, const ThermalizationPredicate &thermalization)
If the shape is changed, we must adapt.
void assignRandom(Random::Engine &engine)
Assigns the Stereopermutator randomly using relative stereopermutation weights.
Represents the connectivity of atoms of a molecule.
Definition: Graph.h:54
static boost::optional< std::vector< Shapes::Vertex > > selectTransitionMapping(const Shapes::Properties::ShapeTransitionGroup &mappingsGroup, const ChiralStatePreservation &preservationOption)
Selects a shape vertex mapping from a shape transition group.
void applyPermutation(const std::vector< AtomIndex > &permutation)
Applies an atom index permutation.
Definition: AtomStereopermutatorImpl.h:28
Decide which stereopermutations are feasible.
const Stereopermutators::Abstract & getAbstract() const
Returns the underlying AbstractStereopermutation.
std::vector< unsigned > feasibles_
List of abstract permutation indices that are feasible in three dimensions.
Definition: AtomStereopermutatorImpl.h:273
Impl(const Graph &graph, Shapes::Shape shape, AtomIndex centerAtom, RankingInformation ranking)
Constructor.
Handle arrangements of substituents at corners of an atom-centered shape.
boost::optional< unsigned > assignmentOption_
The current state of assignment (if or not, and if so, which)
Definition: AtomStereopermutatorImpl.h:276
AtomIndex centerAtom_
Central atom of the Stereopermutator.
Definition: AtomStereopermutatorImpl.h:261
Shapes::Shape getShape() const
Returns the underlying shape.
std::function< std::vector< unsigned >(const Stereopermutators::Abstract &abstract, Shapes::Shape shape, AtomIndex placement, const RankingInformation &ranking) > FeasiblesGenerator
Generator function to list spatially feasible permutation indices.
Definition: AtomStereopermutator.h:98
const ShapeMap & getShapePositionMap() const
Yields the mapping from site indices to shape positions.
void propagateVertexRemoval(AtomIndex removedIndex)
std::size_t AtomIndex
Unsigned integer atom index type. Used to refer to particular atoms.
Definition: Types.h:51
std::vector< MinimalChiralConstraint > minimalChiralConstraints(bool enforce=false) const
Returns a minimal representation of chiral constraints.
void thermalize(bool thermalization)
Unconditionally alter the thermalization of stereopermutations.
SiteCentroids sitePositions(const AngstromPositions &wrapper, const std::vector< std::pair< AtomIndex, AtomIndex >> &substitutions={}) const
Generate site centroid positions from a whole-molecule set of positions.
std::string info() const
Returns an information string for diagnostic purposes.
bool thermalized_
Whether all feasible assignments interconvert thermally.
Definition: AtomStereopermutatorImpl.h:282
boost::optional< PropagatedState > propagate(RankingInformation newRanking, boost::optional< Shapes::Shape > shapeOption, const FeasiblesGenerator &feasibility, const ThermalizationPredicate &thermalization)
Shapes::Shape shape_
The shape the stereopermutator represents.
Definition: AtomStereopermutatorImpl.h:264
unsigned numStereopermutations() const
Returns the number of symbolic ligand permutations.
Class to compute the set of abstract permutations from ranking and shape.
Definition: AbstractPermutations.h:24
double angle(SiteIndex i, SiteIndex j) const
Returns the angle between two site indices in the idealized shape.
static Shapes::Shape down(Shapes::Shape shape, Shapes::Vertex removedVertex)
Picks a shape retaining as much chiral state as possible on a shape size decrease.
Shape
Enumeration of all contained symmetry names.
Definition: Shapes.h:28
Data struct to store chiral constraints for DG.
static Shapes::Shape up(Shapes::Shape shape)
Picks a shape retaining as much chiral state as possible on a shape size increase.
boost::optional< unsigned > assigned() const
Returns the permutation index within the set of possible permutations, if set.
Stereopermutators::Abstract abstract_
Abstract stereopermutations and intermediate state.
Definition: AtomStereopermutatorImpl.h:270
std::string rankInfo() const
Returns an information string for ranking equality checking purposes.
std::vector< std::vector< SiteIndex > > siteGroups() const
Returns site indices grouped by rotational interconversion.
void assign(boost::optional< unsigned > assignment)
Changes the assignment of the stereopermutator.
RankingInformation ranking_
Ranking information of substituents.
Definition: AtomStereopermutatorImpl.h:267