Handles the steric permutation of substituents of a non-terminal central atom. More...
#include <AtomStereopermutator.h>
Data Structures | |
class | Impl |
Public Types | |
using | ShapeMap = Temple::StrongIndexPermutation< SiteIndex, Shapes::Vertex > |
Mapping between site indices of a ranking and vertices of a shape. | |
using | SiteCentroids = Eigen::Matrix< double, 3, Eigen::Dynamic > |
Spatial positions of the centroids of sites. | |
using | ThermalizationPredicate = std::function< bool(AtomIndex, Shapes::Shape, const RankingInformation &)> |
Predicate to decide whether an atom stereopermutator is thermalized. | |
using | FeasiblesGenerator = std::function< std::vector< unsigned >(const Stereopermutators::Abstract &abstract, Shapes::Shape shape, AtomIndex placement, const RankingInformation &ranking, std::vector< std::vector< SiteIndex >> siteGroups) > |
Generator function to list spatially feasible permutation indices. | |
using | PropagatedState = std::tuple< RankingInformation, ShapeMap > |
Old state dumped upon propagation. | |
using | MinimalChiralConstraint = std::array< boost::optional< SiteIndex >, 4 > |
Site index sequence defining a chiral constraint. If a site index is None, then it denotes the position of the central index. | |
Public Member Functions | |
Special member functions | |
AtomStereopermutator (AtomStereopermutator &&other) noexcept | |
Construct an AtomStereopermutator. More... | |
AtomStereopermutator & | operator= (AtomStereopermutator &&other) noexcept |
Construct an AtomStereopermutator. More... | |
AtomStereopermutator (const AtomStereopermutator &other) | |
Construct an AtomStereopermutator. More... | |
AtomStereopermutator & | operator= (const AtomStereopermutator &other) |
Construct an AtomStereopermutator. More... | |
~AtomStereopermutator () | |
Construct an AtomStereopermutator. More... | |
AtomStereopermutator (const Graph &graph, Shapes::Shape shape, AtomIndex centerAtom, RankingInformation ranking) | |
Construct an AtomStereopermutator. More... | |
AtomStereopermutator (AtomIndex centerAtom, Shapes::Shape shape, RankingInformation ranking, const FeasiblesGenerator &feasibility={}, const ThermalizationPredicate &thermalization={}, const std::vector< std::vector< SiteIndex >> &siteGroups={}) | |
Construct an AtomStereopermutator. More... | |
Modifiers | |
void | assign (boost::optional< unsigned > assignment, const std::vector< std::vector< SiteIndex >> &siteGroups={}) |
Changes the assignment of the stereopermutator. More... | |
void | assignRandom (Random::Engine &engine) |
Assign the Stereopermutator randomly using relative statistical weights. More... | |
void | applyPermutation (const std::vector< AtomIndex > &permutation) |
Applies an atom index permutation. More... | |
boost::optional< ShapeMap > | fit (const SiteCentroids ¢roids, const FeasiblesGenerator &feasibility={}, const ThermalizationPredicate &thermalization={}) |
Determine the shape and assignment realized in positions. More... | |
boost::optional< ShapeMap > | fit (const AngstromPositions &wrapper, const FeasiblesGenerator &feasibility={}, const ThermalizationPredicate &thermalization={}) |
Determine the shape and assignment realized in positions. More... | |
boost::optional< ShapeMap > | fit (const Graph &graph, const AngstromPositions &angstromWrapper) |
Changes the assignment of the stereopermutator. More... | |
boost::optional< PropagatedState > | propagate (RankingInformation newRanking, boost::optional< Shapes::Shape > shapeOption, const FeasiblesGenerator &feasibility={}, const ThermalizationPredicate &thermalization={}) |
Propagate the stereocenter state through a possible ranking change. More... | |
void | propagateVertexRemoval (AtomIndex removedIndex) |
Adapts atom indices in the internal state to the removal of an atom. More... | |
void | setShape (Shapes::Shape shape, const FeasiblesGenerator &feasibility={}, const ThermalizationPredicate &thermalization={}, const std::vector< std::vector< SiteIndex >> &siteGroups={}) |
Change the underlying shape of the permutator. More... | |
void | setShape (Shapes::Shape shape, const Graph &graph, const std::vector< std::vector< SiteIndex >> &siteGroups={}) |
Changes the assignment of the stereopermutator. More... | |
void | thermalize (bool thermalization=true) |
Unconditionally thermalize the stereopermutations. | |
Observers | |
double | angle (SiteIndex i, SiteIndex j) const |
Fetches angle between binding sites in the idealized shape. More... | |
boost::optional< unsigned > | assigned () const |
Returns the permutation index within the set of feasible permutations, if set. More... | |
AtomIndex | placement () const |
Returns the atom this permutator is placed on. More... | |
boost::optional< unsigned > | indexOfPermutation () const |
Returns IOP within the set of symbolic ligand permutations. More... | |
std::vector < MinimalChiralConstraint > | minimalChiralConstraints (bool enforce=false) const |
Returns a minimal representation of chiral constraints. More... | |
std::string | info () const |
Returns an information string for diagnostic purposes. More... | |
std::string | rankInfo () const |
Returns an information string for ranking equality checking purposes. More... | |
std::vector< std::vector < SiteIndex > > | siteGroups () const |
Returns site indices grouped by rotational interconversion. More... | |
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. | |
bool | thermalized () const |
Returns whether the stereopermutations are thermalized. | |
const Stereopermutators::Abstract & | getAbstract () const |
Returns the underlying feasible stereopermutations object. More... | |
const std::vector< unsigned > & | getFeasible () const |
Returns the feasible stereopermutation indices. More... | |
const RankingInformation & | getRanking () const |
Returns the underlying ranking. More... | |
Shapes::Shape | getShape () const |
Returns the underlying shape. More... | |
const ShapeMap & | getShapePositionMap () const |
Yields the mapping from site indices to shape positions. More... | |
unsigned | numAssignments () const |
Returns the number of possible assignments. More... | |
unsigned | numStereopermutations () const |
Returns the number of possible stereopermutations. More... | |
Operators | |
bool | operator== (const AtomStereopermutator &other) const |
Checks whether the underlying shape, central atom index, number of stereopermutations and current assignment match. More... | |
bool | operator!= (const AtomStereopermutator &other) const |
Inverts operator ==. | |
bool | operator< (const AtomStereopermutator &other) const |
Lexicographically compares the central atom index, the shape, the number of stereopermutations, and the current assignment. More... | |
Static Public Member Functions | |
Shape picking | |
static Shapes::Shape | up (Shapes::Shape shape) |
Picks a shape retaining as much chiral state as possible on a shape size increase. More... | |
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. More... | |
Statics | |
static bool | thermalized (AtomIndex centerAtom, Shapes::Shape shape, const RankingInformation &ranking, const Graph &graph) |
Decide whether stereopermutations are thermalized based on the graph. More... | |
static auto | thermalizationFunctor (const Graph &g) |
Binds a graph instance into a functor invoking thermalized. | |
Private Attributes | |
std::unique_ptr< Impl > | pImpl_ |
Handles the steric permutation of substituents of a non-terminal central atom.
This class handles the permutation of ranked ligands around a central atom. It models its haptic ligands' binding sites and bridges in multidentate ligands in order to decide which stereopermutations are feasible. A stereopermutation may be infeasible, i.e. not realizable in three-dimensional space, if either haptic ligands would intersect due to too close ligand angles for their spatial heft, or if a multidentate ligand's bridge length between binding sites were too short to match the angle. The list of stereopermutations reduced by infeasible stereopermutations is then re-indexed and those indices into the list are called assignments.
A Stereopermutator can be unassigned, i.e. the distinct stereopermutation that the substituents are can be indeterminate. If you choose to generate conformers for a molecule that includes unassigned stereopermutators, every conformer will choose an assignment from the pool of feasible assignments randomly, but consistent with relative statistical occurrence weights.
E.g. a square planar AABC ligand set will have an A-A cis stereopermutation that occurs twice as often as the A-A trans stereopermutation.
|
noexcept |
Construct an AtomStereopermutator.
graph | The molecule's graph. This information is needed to model haptic ligands. |
shape | The local idealized shape to model. Typically the result of Molecule's inferShape. |
centerAtom | The atom index within the molecule that is the center of the local idealized shape |
ranking | The ranking of the central atom's substituents and ligand sites. Typically the result of Molecule's rankPriority. |
Complexity \(L\cdot S!\) where \(L\) is the number of links and \(S\) is the size of shape
Scine::Molassembler::AtomStereopermutator::AtomStereopermutator | ( | const AtomStereopermutator & | other | ) |
Construct an AtomStereopermutator.
graph | The molecule's graph. This information is needed to model haptic ligands. |
shape | The local idealized shape to model. Typically the result of Molecule's inferShape. |
centerAtom | The atom index within the molecule that is the center of the local idealized shape |
ranking | The ranking of the central atom's substituents and ligand sites. Typically the result of Molecule's rankPriority. |
Complexity \(L\cdot S!\) where \(L\) is the number of links and \(S\) is the size of shape
Scine::Molassembler::AtomStereopermutator::~AtomStereopermutator | ( | ) |
Construct an AtomStereopermutator.
graph | The molecule's graph. This information is needed to model haptic ligands. |
shape | The local idealized shape to model. Typically the result of Molecule's inferShape. |
centerAtom | The atom index within the molecule that is the center of the local idealized shape |
ranking | The ranking of the central atom's substituents and ligand sites. Typically the result of Molecule's rankPriority. |
Complexity \(L\cdot S!\) where \(L\) is the number of links and \(S\) is the size of shape
Scine::Molassembler::AtomStereopermutator::AtomStereopermutator | ( | const Graph & | graph, |
Shapes::Shape | shape, | ||
AtomIndex | centerAtom, | ||
RankingInformation | ranking | ||
) |
Construct an AtomStereopermutator.
graph | The molecule's graph. This information is needed to model haptic ligands. |
shape | The local idealized shape to model. Typically the result of Molecule's inferShape. |
centerAtom | The atom index within the molecule that is the center of the local idealized shape |
ranking | The ranking of the central atom's substituents and ligand sites. Typically the result of Molecule's rankPriority. |
Complexity \(L\cdot S!\) where \(L\) is the number of links and \(S\) is the size of shape
Scine::Molassembler::AtomStereopermutator::AtomStereopermutator | ( | AtomIndex | centerAtom, |
Shapes::Shape | shape, | ||
RankingInformation | ranking, | ||
const FeasiblesGenerator & | feasibility = {} , |
||
const ThermalizationPredicate & | thermalization = {} , |
||
const std::vector< std::vector< SiteIndex >> & | siteGroups = {} |
||
) |
Construct an AtomStereopermutator.
centerAtom | The atom index within the molecule that is the center of the local idealized shape |
shape | The local idealized shape to model. Typically the result of Molecule's inferShape. |
ranking | The ranking of the central atom's substituents and ligand sites. Typically the result of Molecule's rankPriority. |
feasibility | A functor for determining which abstract permutations are feasible. |
thermalization | A functor for deciding whether the stereopermutator is thermalized and all stereopermutations coalesce. |
siteGroups | The position groups for the binding sites. |
Complexity \(L\cdot S!\) where \(L\) is the number of links and \(S\) is the size of shape
Fetches angle between binding sites in the idealized shape.
i | Site index one |
j | Site index two |
Complexity \(\Theta(1)\)
std::runtime_error | If the stereopermutator is unassigned |
std::out_of_range | If any site index is out of range |
void Scine::Molassembler::AtomStereopermutator::applyPermutation | ( | const std::vector< AtomIndex > & | permutation | ) |
Applies an atom index permutation.
Complexity \(\Theta(1)\)
permutation | The permutation to apply |
void Scine::Molassembler::AtomStereopermutator::assign | ( | boost::optional< unsigned > | assignment, |
const std::vector< std::vector< SiteIndex >> & | siteGroups = {} |
||
) |
Changes the assignment of the stereopermutator.
assignment | The new assignment of the stereopermutator. May be boost::none , which sets the chiral state as indeterminate. Must be less than the number of assignments if not None. |
siteGroups | The shape position groups of the sites. |
Complexity \(\Theta(1)\) if assignment
is boost::none
. \(\Theta(S)\) otherwise
boost::optional<unsigned> Scine::Molassembler::AtomStereopermutator::assigned | ( | ) | const |
Returns the permutation index within the set of feasible permutations, if set.
Returns the information of whether the stereopermutator is assigned or not, and if so, which assignment it is.
Complexity \(\Theta(1)\)
void Scine::Molassembler::AtomStereopermutator::assignRandom | ( | Random::Engine & | engine | ) |
Assign the Stereopermutator randomly using relative statistical weights.
Stereopermutations are generated with relative statistical occurrence weights. The assignment is then chosen from the possible stereopermutations with a discrete distribution whose weights are the corresponding relative statistical occurrences.
Complexity \(\Theta(1)\) if assignment
is boost::none
. \(\Theta(S)\) otherwise
|
static |
Picks a shape retaining as much chiral state as possible on a shape size decrease.
Complexity \(O(S!)\) if uncached, \(\Theta(1)\) otherwise
std::logic_error | If there are no smaller shapes |
boost::optional<ShapeMap> Scine::Molassembler::AtomStereopermutator::fit | ( | const SiteCentroids & | centroids, |
const FeasiblesGenerator & | feasibility = {} , |
||
const ThermalizationPredicate & | thermalization = {} |
||
) |
Determine the shape and assignment realized in positions.
The shape and assignment are determined from Cartesian coordinates by the probability that the continuous shape measure with respect to an idealized shape is least likely to be drawn from a sample of randomly generated vertex positions. For shapes with many vertices, generating enough samples for a statistical argument is too expensive, and the shape whose continuous shape measure is lowest is chosen instead.
centroids | Spatial centroids of each site in the contained ranking, and the position of the central index last |
Complexity \(\Theta(S!)\)
boost::optional<ShapeMap> Scine::Molassembler::AtomStereopermutator::fit | ( | const AngstromPositions & | wrapper, |
const FeasiblesGenerator & | feasibility = {} , |
||
const ThermalizationPredicate & | thermalization = {} |
||
) |
Determine the shape and assignment realized in positions.
The shape and assignment are determined from Cartesian coordinates by the probability that the continuous shape measure with respect to an idealized shape is least likely to be drawn from a sample of randomly generated vertex positions. For shapes with many vertices, generating enough samples for a statistical argument is too expensive, and the shape whose continuous shape measure is lowest is chosen instead.
angstromWrapper | The wrapped positions |
Complexity \(\Theta(S!)\)
boost::optional<ShapeMap> Scine::Molassembler::AtomStereopermutator::fit | ( | const Graph & | graph, |
const AngstromPositions & | angstromWrapper | ||
) |
Changes the assignment of the stereopermutator.
assignment | The new assignment of the stereopermutator. May be boost::none , which sets the chiral state as indeterminate. Must be less than the number of assignments if not None. |
siteGroups | The shape position groups of the sites. |
Complexity \(\Theta(1)\) if assignment
is boost::none
. \(\Theta(S)\) otherwise
const Stereopermutators::Abstract& Scine::Molassembler::AtomStereopermutator::getAbstract | ( | ) | const |
Returns the underlying feasible stereopermutations object.
Complexity \(\Theta(1)\)
const std::vector<unsigned>& Scine::Molassembler::AtomStereopermutator::getFeasible | ( | ) | const |
Returns the feasible stereopermutation indices.
Complexity \(\Theta(1)\)
const RankingInformation& Scine::Molassembler::AtomStereopermutator::getRanking | ( | ) | const |
Returns the underlying ranking.
Complexity \(\Theta(1)\)
Shapes::Shape Scine::Molassembler::AtomStereopermutator::getShape | ( | ) | const |
Returns the underlying shape.
Complexity \(\Theta(1)\)
const ShapeMap& Scine::Molassembler::AtomStereopermutator::getShapePositionMap | ( | ) | const |
Yields the mapping from site indices to shape positions.
Complexity \(\Theta(1)\)
std::logic_error | if the stereopermutator is unassigned. |
boost::optional<unsigned> Scine::Molassembler::AtomStereopermutator::indexOfPermutation | ( | ) | const |
Returns IOP within the set of symbolic ligand permutations.
This is different to the assignment. The assignment denotes the index within the set of possible (more specifically, not obviously infeasible) stereopermutations.
Complexity \(\Theta(1)\)
std::string Scine::Molassembler::AtomStereopermutator::info | ( | ) | const |
Returns an information string for diagnostic purposes.
Complexity \(\Theta(1)\)
std::vector<MinimalChiralConstraint> Scine::Molassembler::AtomStereopermutator::minimalChiralConstraints | ( | bool | enforce = false | ) | const |
Returns a minimal representation of chiral constraints.
Every minimal representation consists only of site indices. If no site index is present, this position is the location of the central atom.
The minimal representation assumes that all shape tetrahedra are defined as Positive targets, which is checked in the shapes tests.
Complexity \(\Theta(T)\) where \(T\) is the number of tetrahedra defined for the modeled shape
enforce | Emit minimal representations of chiral constraints even if the stereopermutator does not have any chiral state, i.e. numStereopermutators() <= 1, as long as it is assigned. |
unsigned Scine::Molassembler::AtomStereopermutator::numAssignments | ( | ) | const |
Returns the number of possible assignments.
The number of possible assignments is the number of non-superposable arrangements of the abstract ligand case reduced by trans-arranged multidentate pairs where the bridge length is too short or overlapping haptic cones.
For instance, if octahedral M[(A-A)3], there are four abstract arrangements
However, the number of stereopermutations for a concrete case in which the bridges are too short to allow trans bonding is reduced by all arrangements containing a trans-bonded bidentate ligand, i.e. only Δ and Λ remain. The number of assignments is then only two.
This is the upper exclusive bound on Some-type arguments to assign().
Complexity \(\Theta(1)\)
unsigned Scine::Molassembler::AtomStereopermutator::numStereopermutations | ( | ) | const |
Returns the number of possible stereopermutations.
The number of possible stereopermutations is the number of non-superposable arrangements of the abstract ligand case without removing trans-arranged multidentate pairs or overlapping haptic cones.
For instance, if octahedral M[(A-A)3], there are four abstract arrangements
However, the number of assignments for a concrete case in which the bridges are too short to allow trans binding is reduced by all arrangements containing a trans-bonded bidentate ligand, i.e. only Δ and Λ remain.
Fetches the number of permutations determined by symbolic ligand calculation, not considering linking or haptic ligand cones.
Complexity \(\Theta(1)\)
bool Scine::Molassembler::AtomStereopermutator::operator< | ( | const AtomStereopermutator & | other | ) | const |
Lexicographically compares the central atom index, the shape, the number of stereopermutations, and the current assignment.
other | The other atom stereopermutator to compare against |
|
noexcept |
Construct an AtomStereopermutator.
graph | The molecule's graph. This information is needed to model haptic ligands. |
shape | The local idealized shape to model. Typically the result of Molecule's inferShape. |
centerAtom | The atom index within the molecule that is the center of the local idealized shape |
ranking | The ranking of the central atom's substituents and ligand sites. Typically the result of Molecule's rankPriority. |
Complexity \(L\cdot S!\) where \(L\) is the number of links and \(S\) is the size of shape
AtomStereopermutator& Scine::Molassembler::AtomStereopermutator::operator= | ( | const AtomStereopermutator & | other | ) |
Construct an AtomStereopermutator.
graph | The molecule's graph. This information is needed to model haptic ligands. |
shape | The local idealized shape to model. Typically the result of Molecule's inferShape. |
centerAtom | The atom index within the molecule that is the center of the local idealized shape |
ranking | The ranking of the central atom's substituents and ligand sites. Typically the result of Molecule's rankPriority. |
Complexity \(L\cdot S!\) where \(L\) is the number of links and \(S\) is the size of shape
bool Scine::Molassembler::AtomStereopermutator::operator== | ( | const AtomStereopermutator & | other | ) | const |
Checks whether the underlying shape, central atom index, number of stereopermutations and current assignment match.
other | The other atom stereopermutator to compare against |
AtomIndex Scine::Molassembler::AtomStereopermutator::placement | ( | ) | const |
Returns the atom this permutator is placed on.
Complexity \(\Theta(1)\)
boost::optional<PropagatedState> Scine::Molassembler::AtomStereopermutator::propagate | ( | RankingInformation | newRanking, |
boost::optional< Shapes::Shape > | shapeOption, | ||
const FeasiblesGenerator & | feasibility = {} , |
||
const ThermalizationPredicate & | thermalization = {} |
||
) |
Propagate the stereocenter state through a possible ranking change.
In case a graph modification changes the ranking of this stereopermutator's substituents, it must be redetermined whether the new configuration is a stereopermutator and if so, which assignment corresponds to the previous one.
Complexity \(L\cdot S!\) where \(L\) is the number of links and \(S\) is the size of shape
void Scine::Molassembler::AtomStereopermutator::propagateVertexRemoval | ( | AtomIndex | removedIndex | ) |
Adapts atom indices in the internal state to the removal of an atom.
Atom indices are adapted to a graph-level removal of an atom. The removed index is changed to a placeholder value.
Complexity \(\Theta(1)\)
std::string Scine::Molassembler::AtomStereopermutator::rankInfo | ( | ) | const |
Returns an information string for ranking equality checking purposes.
Complexity \(\Theta(1)\)
void Scine::Molassembler::AtomStereopermutator::setShape | ( | Shapes::Shape | shape, |
const FeasiblesGenerator & | feasibility = {} , |
||
const ThermalizationPredicate & | thermalization = {} , |
||
const std::vector< std::vector< SiteIndex >> & | siteGroups = {} |
||
) |
Change the underlying shape of the permutator.
Complexity \(L\cdot S!\) where \(L\) is the number of links and \(S\) is the size of shape
void Scine::Molassembler::AtomStereopermutator::setShape | ( | Shapes::Shape | shape, |
const Graph & | graph, | ||
const std::vector< std::vector< SiteIndex >> & | siteGroups = {} |
||
) |
Changes the assignment of the stereopermutator.
assignment | The new assignment of the stereopermutator. May be boost::none , which sets the chiral state as indeterminate. Must be less than the number of assignments if not None. |
siteGroups | The shape position groups of the sites. |
Complexity \(\Theta(1)\) if assignment
is boost::none
. \(\Theta(S)\) otherwise
std::vector<std::vector<SiteIndex> > Scine::Molassembler::AtomStereopermutator::siteGroups | ( | ) | const |
Returns site indices grouped by rotational interconversion.
Complexity \(\Theta(S^2)\)
std::runtime_error | If the stereopermutator is unassigned |
|
static |
Decide whether stereopermutations are thermalized based on the graph.
If Options::Thermalization::pyramidalInversion is set, considers asymmetric pyramidal nitrogen atom centers a stereocenter only if part of a cycle of size 4 or smaller.
If Options::Thermalization::berryPseudorotation is set, the shape is a trigonal bipyramid and there are no links between sites, stereopermutations are thermalized.
If Options::Thermalization::bartellMechanism is set, the shape is a pentagonal bipyramid and there are no links between sites, stereopermutations are thermalized.
|
static |
Picks a shape retaining as much chiral state as possible on a shape size increase.
Complexity \(O(S!)\) if uncached, \(\Theta(1)\) otherwise
std::logic_error | If there are no larger shapes |