Molassembler  3.0.0
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Scine::Molassembler::Shapes::Properties Namespace Reference

Runtime-computed properties of shapes. More...

Data Structures

struct  DistortionInfo
 Data type grouping distortions between shapes. More...
 
struct  ShapeTransitionGroup
 A grouping of index mappings of equal angular and chiral distortion. More...
 

Functions

Permutation applyPermutation (const Permutation &occupation, const Permutation &permutation)
 Rotates a passed list of indices with a specified rotation vector. More...
 
std::vector< VertexapplyRotation (const Permutation &occupation, Shape shape, unsigned rotationFunctionIndex)
 Rotates a passed list of indices of a specific shape. More...
 
unsigned rotationPeriodicity (Shape shape, const Permutation &rotation)
 Calculate the periodicty of a shape's index rotation. More...
 
PURITY_WEAK std::vector
< std::vector< Vertex > > 
positionGroups (Shape shape)
 Group shape vertices according to whether they can be interconverted by rotation. More...
 
std::vector< char > positionGroupCharacters (Shape shape)
 Generate a character representation of a shape's position groups. More...
 
Permutation inverseRotation (const Permutation &rotation)
 Generate the inverse rotation to a shape's rotation. More...
 
Eigen::Vector3d getCoordinates (Shape shape, const boost::optional< Vertex > &vertexOption)
 Gets the coordinates of an indexOptional for a specific shape. More...
 
double getTetrahedronVolume (const Eigen::Vector3d &i, const Eigen::Vector3d &j, const Eigen::Vector3d &k, const Eigen::Vector3d &l)
 Tetrahedron volume spanned by four positions. More...
 
double calculateAngleDistortion (Shape from, Shape to, const std::vector< Vertex > &indexMapping)
 Calculates angular distorition for an index mapping between shapes. More...
 
boost::optional< VertexpropagateIndexOptionalThroughMapping (const boost::optional< Vertex > &indexOptional, const std::vector< Vertex > &indexMapping)
 Propagates an index optional through an index mapping. More...
 
double calculateChiralDistortion (Shape from, Shape to, const std::vector< Vertex > &indexMapping)
 Calculates chiral distortion for a transition between shapes. More...
 
std::set< std::vector< Vertex >> generateAllRotations (Shape shape, const std::vector< Vertex > &indices)
 Generates all rotations of a sequence of indices within a shape. More...
 
std::vector< VertexapplyIndexMapping (Shape to, const std::vector< Vertex > &mapping)
 Transform shape positions through a mapping. More...
 
std::vector< DistortionInfoshapeTransitionMappings (Shape from, Shape to)
 Calculates ideal index mappings for +1, 0 size transitions. More...
 
std::vector< DistortionInfoligandLossTransitionMappings (Shape from, Shape to, Vertex positionInSourceShape)
 Calculates ideal index mappings for ligand loss transitions. More...
 
ShapeTransitionGroup selectBestTransitionMappings (const std::vector< DistortionInfo > &distortions)
 Selects the best transition mapping from many DistortionInfos. More...
 
PURITY_WEAK unsigned numUnlinkedStereopermutations (Shape shape, unsigned nIdenticalLigands)
 Calculates the number of stereopermutations in a specific shape and a number of identical ligands. More...
 
PURITY_WEAK bool hasMultipleUnlinkedStereopermutations (Shape shape, unsigned nIdenticalLigands)
 Calculates if there are multiple unlinked stereopermutations in a specific shape for a number of identical ligands. More...
 
PURITY_WEAK Shape mostSymmetric (std::vector< Shape > selection)
 Yields the shape with the most rotations from a selection. More...
 
PURITY_WEAK Shape mostSymmetric (unsigned shapeSize)
 Yields the shape with the most rotations of a particular size. More...
 

Variables

constexpr double floatingPointEqualityThreshold [[gnu::unused]] = 1e-4
 

Detailed Description

Runtime-computed properties of shapes.

Function Documentation

std::vector<Vertex> Scine::Molassembler::Shapes::Properties::applyIndexMapping ( Shape  to,
const std::vector< Vertex > &  mapping 
)

Transform shape positions through a mapping.

Writes the indices of the original shape in the mapping into the target shape's indexing scheme.

Complexity \(\Theta(S)\)

Parameters
toThe shape whose index mapping is to be applied
mappingAn index mapping that specifies how indices are mapped from a source shape to a target shape
Permutation Scine::Molassembler::Shapes::Properties::applyPermutation ( const Permutation &  occupation,
const Permutation &  permutation 
)

Rotates a passed list of indices with a specified rotation vector.

Complexity \(\Theta(S)\)

std::vector<Vertex> Scine::Molassembler::Shapes::Properties::applyRotation ( const Permutation &  occupation,
Shape  shape,
unsigned  rotationFunctionIndex 
)

Rotates a passed list of indices of a specific shape.

Complexity \(\Theta(S)\)

double Scine::Molassembler::Shapes::Properties::calculateAngleDistortion ( Shape  from,
Shape  to,
const std::vector< Vertex > &  indexMapping 
)

Calculates angular distorition for an index mapping between shapes.

Calculates the angular distortion for a transition between two shapes and a specific index mapping that connects indices from the source shape to the target shape

Complexity \(\Theta(S^2)\)

double Scine::Molassembler::Shapes::Properties::calculateChiralDistortion ( Shape  from,
Shape  to,
const std::vector< Vertex > &  indexMapping 
)

Calculates chiral distortion for a transition between shapes.

Calculates the chiral distortion for a transition between two shapes and a specific index mapping that connects indices from the source shape to the target shape

Complexity \(\Theta(T)\) where \(T\) is the number of tetrahedra for the shape, typically small

std::set< std::vector<Vertex>> Scine::Molassembler::Shapes::Properties::generateAllRotations ( Shape  shape,
const std::vector< Vertex > &  indices 
)

Generates all rotations of a sequence of indices within a shape.

Complexity At most maxRotation iterations

Eigen::Vector3d Scine::Molassembler::Shapes::Properties::getCoordinates ( Shape  shape,
const boost::optional< Vertex > &  vertexOption 
)

Gets the coordinates of an indexOptional for a specific shape.

As was defined previously, boost::none is a placeholder for the central atom, which is not explicitly held in memory as it is always placed at {0, 0, 0}.

Complexity \(\Theta(1)\)

double Scine::Molassembler::Shapes::Properties::getTetrahedronVolume ( const Eigen::Vector3d &  i,
const Eigen::Vector3d &  j,
const Eigen::Vector3d &  k,
const Eigen::Vector3d &  l 
)

Tetrahedron volume spanned by four positions.

Returns the Eigen calculation of a signed tetrahedron volume from four tetrahedron edge point vectos

Complexity \(\Theta(1)\)

PURITY_WEAK bool Scine::Molassembler::Shapes::Properties::hasMultipleUnlinkedStereopermutations ( Shape  shape,
unsigned  nIdenticalLigands 
)

Calculates if there are multiple unlinked stereopermutations in a specific shape for a number of identical ligands.

Complexity \(\Theta(S!)\)

Permutation Scine::Molassembler::Shapes::Properties::inverseRotation ( const Permutation &  rotation)

Generate the inverse rotation to a shape's rotation.

Inverts the permutation provided by rotation. UB if rotation is not an index permutation.

Complexity \(\Theta(N)\)

std::vector<DistortionInfo> Scine::Molassembler::Shapes::Properties::ligandLossTransitionMappings ( Shape  from,
Shape  to,
Vertex  positionInSourceShape 
)

Calculates ideal index mappings for ligand loss transitions.

Generates shape transition index mappings for the special case of ligand loss, in which a ligand is removed from a particular position in the shape

Complexity \(\Theta(S!)\)

Parameters
fromTransition source shape
toTransition target shape
positionInSourceShapeposition lost in source shape
Precondition
Shapes::size(from) == Shapes::size(to) + 1
PURITY_WEAK Shape Scine::Molassembler::Shapes::Properties::mostSymmetric ( std::vector< Shape >  selection)

Yields the shape with the most rotations from a selection.

Complexity \(\Theta(1)\)

PURITY_WEAK Shape Scine::Molassembler::Shapes::Properties::mostSymmetric ( unsigned  shapeSize)

Yields the shape with the most rotations of a particular size.

Complexity \(\Theta(1)\)

PURITY_WEAK unsigned Scine::Molassembler::Shapes::Properties::numUnlinkedStereopermutations ( Shape  shape,
unsigned  nIdenticalLigands 
)

Calculates the number of stereopermutations in a specific shape and a number of identical ligands.

Complexity \(\Theta(S!)\)

std::vector<char> Scine::Molassembler::Shapes::Properties::positionGroupCharacters ( Shape  shape)

Generate a character representation of a shape's position groups.

Groups shape vertices according to whether they can be interconverted. Then transforms the shape positions themselves to character representations of the groups they belong to.

Complexity \(\Theta(S^2)\)

Parameters
shapeShape for which to generate the character representation
PURITY_WEAK std::vector<std::vector<Vertex> > Scine::Molassembler::Shapes::Properties::positionGroups ( Shape  shape)

Group shape vertices according to whether they can be interconverted by rotation.

Complexity \(\Theta(S^2)\)

boost::optional<Vertex> Scine::Molassembler::Shapes::Properties::propagateIndexOptionalThroughMapping ( const boost::optional< Vertex > &  indexOptional,
const std::vector< Vertex > &  indexMapping 
)

Propagates an index optional through an index mapping.

Index optionals as used in tetrahedron definitions in shapes need to be propagated through index mappings generated in the process of finding the optimal shape transitions. Shorthand function that performs a propagation if a the passed indexOptional is not boost::none, returns none otherwise.

Complexity \(\Theta(1)\)

unsigned Scine::Molassembler::Shapes::Properties::rotationPeriodicity ( Shape  shape,
const Permutation &  rotation 
)

Calculate the periodicty of a shape's index rotation.

Complexity \(\Theta(M S)\) where \(M\) is the multiplicity of the rotation and \(S\) is the shape size

ShapeTransitionGroup Scine::Molassembler::Shapes::Properties::selectBestTransitionMappings ( const std::vector< DistortionInfo > &  distortions)

Selects the best transition mapping from many DistortionInfos.

Selects index mappings from a DistortionInfo list, choosing those with lowest angular distortion first, and lowest chiral distortion afterwards. Groups them into a ShapeTransitionGroup.

Complexity \(\Theta(N)\)

std::vector<DistortionInfo> Scine::Molassembler::Shapes::Properties::shapeTransitionMappings ( Shape  from,
Shape  to 
)

Calculates ideal index mappings for +1, 0 size transitions.

Generates shape transition index mappings with the lowest angular distortion and then subsets that group to those with the lowest chiral distortion. Transitions are limited to shapes with size differences of 0 and ±1.

Complexity \(\Theta(S!)\)

Parameters
fromTransition source shape
toTransition target shape
Precondition
Shapes::size(from) + {0, 1} == Shapes::size(to)