Molassembler  3.0.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  const std::vector<std::vector<SiteIndex>>& siteGroups = {});
88 
89 /* Modification */
91  void assign(boost::optional<unsigned> assignment,
92  const std::vector<std::vector<SiteIndex>>& siteGroups = {});
93 
98  void assign(std::vector<Shapes::Vertex> vertexMapping);
99 
101  void assignRandom(Random::Engine& engine);
102 
108  void applyPermutation(const std::vector<AtomIndex>& permutation);
109 
115  boost::optional<ShapeMap> fit(
116  const SiteCentroids& centroids,
117  const FeasiblesGenerator& feasibility,
118  const ThermalizationPredicate& thermalization
119  );
120 
126  boost::optional<PropagatedState> propagate(
127  RankingInformation newRanking,
128  boost::optional<Shapes::Shape> shapeOption,
129  const FeasiblesGenerator& feasibility,
130  const ThermalizationPredicate& thermalization
131  );
132 
137  void propagateVertexRemoval(AtomIndex removedIndex);
138 
140  void setShape(
141  Shapes::Shape shape,
142  const FeasiblesGenerator& feasibility,
143  const ThermalizationPredicate& thermalization,
144  const std::vector<std::vector<SiteIndex>>& siteGroups = {}
145  );
146 
148  void thermalize(bool thermalization);
149 
150 /* Information */
152  double angle(SiteIndex i, SiteIndex j) const;
153 
161  boost::optional<unsigned> assigned() const;
162 
164  AtomIndex placement() const;
165 
173  boost::optional<unsigned> indexOfPermutation() const;
174 
188  std::vector<MinimalChiralConstraint> minimalChiralConstraints(bool enforce = false) const;
189 
191  std::string info() const;
192 
194  std::string rankInfo() const;
195 
204  std::vector<std::vector<SiteIndex>> siteGroups() const;
205 
208  const AngstromPositions& wrapper,
209  const std::vector<std::pair<AtomIndex, AtomIndex>>& substitutions = {}
210  ) const;
211 
212  inline bool thermalized() const {
213  return thermalized_;
214  }
215 
221 
223  const std::vector<unsigned>& getFeasible() const;
224 
226  const RankingInformation& getRanking() const;
227 
229  Shapes::Shape getShape() const;
230 
235  const ShapeMap& getShapePositionMap() const;
236 
245  unsigned numAssignments() const;
246 
253  unsigned numStereopermutations() const;
254 
255 /* Operators */
256  inline auto tie() const {
257  return std::make_tuple(shape_, centerAtom_, numStereopermutations(), assigned());
258  }
259 
260 private:
261 /* State */
264 
267 
270 
273 
275  std::vector<unsigned> feasibles_;
276 
278  boost::optional<unsigned> assignmentOption_;
279 
282 
285 };
286 
287 } // namespace Molassembler
288 } // namespace Scine
289 
290 #endif
ShapeMap shapePositionMap_
Derived property of assignmentOption_.
Definition: AtomStereopermutatorImpl.h:281
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 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:275
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:278
AtomIndex centerAtom_
Central atom of the Stereopermutator.
Definition: AtomStereopermutatorImpl.h:263
std::function< std::vector< unsigned >(const Stereopermutators::Abstract &abstract, Shapes::Shape shape, AtomIndex placement, const RankingInformation &ranking, std::vector< std::vector< SiteIndex >> siteGroups) > FeasiblesGenerator
Generator function to list spatially feasible permutation indices.
Definition: AtomStereopermutator.h:99
Shapes::Shape getShape() const
Returns the underlying shape.
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:284
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:266
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.
void assign(boost::optional< unsigned > assignment, const std::vector< std::vector< SiteIndex >> &siteGroups={})
Changes the assignment of the stereopermutator.
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:272
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 setShape(Shapes::Shape shape, const FeasiblesGenerator &feasibility, const ThermalizationPredicate &thermalization, const std::vector< std::vector< SiteIndex >> &siteGroups={})
If the shape is changed, we must adapt.
RankingInformation ranking_
Ranking information of substituents.
Definition: AtomStereopermutatorImpl.h:269