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

Public Member Functions

boost::optional
< AtomStereopermutator
makePermutator (AtomIndex candidateIndex, const StereopermutatorList &stereopermutators, const boost::optional< AngstromPositions > &maybePositions=boost::none, const boost::optional< SubstitutionsGenerator::SubstitutionMap > &maybeSubstitutions=boost::none) const
 
boost::optional
< BondStereopermutator
makePermutator (const BondIndex &bond, const StereopermutatorList &stereopermutators, const boost::optional< AngstromPositions > &maybePositions=boost::none, const boost::optional< SubstitutionsGenerator::SubstitutionMap > &maybeSubstitutions=boost::none, BondStereopermutator::Alignment alignment=BondStereopermutator::Alignment::Eclipsed) const
 
StereopermutatorList detectStereopermutators_ () const
 Generates a list of stereopermutators based on graph properties alone.
 
void ensureModelInvariants_ () const
 Ensures basic expectations about what constitutes a Molecule are met.
 
bool isValidIndex_ (AtomIndex index) const
 Returns whether the specified index is valid or not.
 
void propagateGraphChange_ ()
 Updates the molecule's StereopermutatorList after a graph modification.
 
Constructors
 Impl () noexcept
 Default constructor.
 
 Impl (Utils::ElementType element) noexcept
 Mono-atomic constructor.
 
 Impl (Utils::ElementType a, Utils::ElementType b, BondType bondType) noexcept
 Diatomic constructor.
 
 Impl (Graph graph)
 Graph-only constructor.
 
 Impl (Graph graph, const AngstromPositions &positions, const boost::optional< std::vector< BondIndex > > &bondStereopermutatorCandidatesOptional=boost::none, const boost::optional< PeriodicBoundaryDuplicates > &periodics=boost::none)
 Graph and positions constructor.
 
 Impl (Graph graph, StereopermutatorList stereopermutators, boost::optional< AtomEnvironmentComponents > canonicalComponentsOption)
 Graph and stereopermutators constructor.
 
Modifiers
AtomIndex addAtom (Utils::ElementType elementType, AtomIndex adjacentTo, BondType bondType)
 Adds an atom by attaching it to an existing atom.
 
BondIndex addBond (AtomIndex a, AtomIndex b, BondType bondType)
 Adds a bond between existing atoms.
 
const BondStereopermutatoraddPermutator (const BondIndex &bond, BondStereopermutator::Alignment alignment)
 Add a new BondStereopermutator to the molecule.
 
void applyPermutation (const std::vector< AtomIndex > &permutation)
 Applies an index permutation to all member state.
 
void assignStereopermutator (AtomIndex a, const boost::optional< unsigned > &assignment)
 
void assignStereopermutator (const BondIndex &edge, const boost::optional< unsigned > &assignment)
 
void assignStereopermutatorRandomly (AtomIndex a, Random::Engine &engine)
 
void assignStereopermutatorRandomly (const BondIndex &e, Random::Engine &engine)
 
std::vector< AtomIndexcanonicalize (AtomEnvironmentComponents componentBitmask)
 Canonicalizes the graph, invalidating all atom and bond indices. More...
 
void removeAtom (AtomIndex a)
 
void removeBond (AtomIndex a, AtomIndex b)
 
bool removePermutator (const BondIndex &bond)
 Removes the BondStereopermutator on a specified edge, if present. More...
 
bool setBondType (AtomIndex a, AtomIndex b, BondType bondType)
 Changes an existing bond's type.
 
void setElementType (AtomIndex a, Utils::ElementType elementType)
 Changes an existing atom's element type.
 
void setShapeAtAtom (AtomIndex a, Shapes::Shape shape)
 
void thermalizeStereopermutator (AtomIndex a, bool thermalization)
 Alters thermalization state of an atom stereopermutator.
 
Information
boost::optional
< AtomEnvironmentComponents
canonicalComponents () const
 Yield which components were used in canonicalization.
 
boost::optional< Shapes::ShapeinferShape (AtomIndex index, const RankingInformation &ranking) const
 
std::string dumpGraphviz () const
 Returns a graphivz string representation of the molecule.
 
const Graphgraph () const
 Provides read-only access to the graph member.
 
std::size_t hash () const
 Convolutional hash.
 
const StereopermutatorListstereopermutators () const
 Provides read-only access to the list of stereopermutators.
 
StereopermutatorList inferStereopermutatorsFromPositions (const AngstromPositions &angstromWrapper, const boost::optional< std::vector< BondIndex > > &explicitBondStereopermutatorCandidatesOption=boost::none, boost::optional< const std::unordered_set< AtomIndex > & > uninteresting=boost::none, const boost::optional< SubstitutionsGenerator::SubstitutionMap > &substitutions=boost::none) const
 Yield which components were used in canonicalization.
 
bool canonicalCompare (const Impl &other, AtomEnvironmentComponents componentBitmask) const
 Compares two canonical instances with one another.
 
boost::optional< std::vector
< AtomIndex > > 
modularIsomorphism (const Impl &other, AtomEnvironmentComponents componentBitmask) const
 Modular comparison of this Impl with another.
 
std::string str () const
 Returns a command-line interface information string.
 
RankingInformation rankPriority (AtomIndex a, const std::vector< AtomIndex > &excludeAdjacent={}, const boost::optional< AngstromPositions > &positionsOption=boost::none) const
 Yield which components were used in canonicalization.
 
Operators
bool operator== (const Impl &other) const
 Equality operator, performs most strict equality comparison.
 
bool operator!= (const Impl &other) const
 Negates. More...
 

Static Public Member Functions

static Utils::AtomCollection applyCanonicalizationMap (const std::vector< AtomIndex > &canonicalizationIndexMap, const Utils::AtomCollection &atomCollection)
 
static bool isGraphBasedBondStereopermutatorCandidate_ (BondType bondType)
 Returns whether an edge is double, triple or higher bond order.
 

Data Fields

Data
Graph adjacencies_
 
StereopermutatorList stereopermutators_
 
boost::optional
< AtomEnvironmentComponents
canonicalComponentsOption_
 

Member Function Documentation

void Scine::Molassembler::Molecule::Impl::assignStereopermutator ( AtomIndex  a,
const boost::optional< unsigned > &  assignment 
)

Sets the stereopermutator assignment at a particular atom

This sets the stereopermutator assignment at a specific atom index. For this, a stereopermutator must be instantiated and contained in the StereopermutatorList returned by stereopermutators(). The supplied assignment must be either boost::none or smaller than stereopermutatorPtr->numAssignments().

Note
Although molecules in which this occurs are infrequent, consider the StereopermutatorList you have accessed prior to calling this function and particularly any iterators thereto invalidated. This is because an assignment change can trigger a ranking change, which can in turn lead to the introduction of new stereopermutators or the removal of old ones.
void Scine::Molassembler::Molecule::Impl::assignStereopermutator ( const BondIndex edge,
const boost::optional< unsigned > &  assignment 
)

Sets the stereopermutator assignment on a bond

This sets the stereopermutator assignment at a specific bond index. For this, a stereopermutator must be instantiated and contained in the StereopermutatorList returned by stereopermutators(). The supplied assignment must be either boost::none or smaller than stereopermutatorPtr->numAssignments().

Note
Although molecules in which this occurs are infrequent, consider the StereopermutatorList you have accessed prior to calling this function and particularly any iterators thereto invalidated. This is because an assignment change can trigger a ranking change, which can in turn lead to the introduction of new stereopermutators or the removal of old ones.
void Scine::Molassembler::Molecule::Impl::assignStereopermutatorRandomly ( AtomIndex  a,
Random::Engine engine 
)

Assigns a stereopermutator stereopermutation at random

This sets the stereocetner assignment at a specific index, taking relative statistical occurence weights of each stereopermutation into account.

Precondition
There must be an AtomStereopermutator at the passed index
Exceptions
Ifno AtomStereopermutator exists at the passed index
Note
Although molecules in which this occurs are infrequent, consider the StereopermutatorList you have accessed prior to calling this function and particularly any iterators to its members invalidated. This is because an assignment change can trigger a ranking change, which can in turn lead to the introduction of new stereopermutators or the removal of old ones.
void Scine::Molassembler::Molecule::Impl::assignStereopermutatorRandomly ( const BondIndex e,
Random::Engine engine 
)

Assigns a bond stereopermutator to a random assignment

Precondition
There must be a BondStereopermutator at the passed edge
Exceptions
Ifno BondStereopermutator exists at the passed edge
Note
Although molecules in which this occurs are infrequent, consider the StereopermutatorList you have accessed prior to calling this function and particularly any iterators to its members invalidated. This is because an assignment change can trigger a ranking change, which can in turn lead to the introduction of new stereopermutators or the removal of old ones.
std::vector<AtomIndex> Scine::Molassembler::Molecule::Impl::canonicalize ( AtomEnvironmentComponents  componentBitmask)

Canonicalizes the graph, invalidating all atom and bond indices.

Parameters
componentBitmaskThe components of the molecular graph to include in the canonicalization procedure.
Warning
Any comparisons made on canonical graphs must be made with a less or equally strict components bitmask. If you choose a stricter bitmask than you have used in the canonicalization procedure, you risk false positives and false negatives.
This invalidates all atom indices and bond indices and any references to constituting members of the molecule.
Note
Use
See Also
canonicalCompare to compare instances of canonicalized molecules.
Returns
Permutation mapping from old indices to new:
auto indexMapping = mol.canonicalize();
AtomIndex newIndex = indexMapping.at(oldIndex);
You can use this to update invalidated indices.
boost::optional<Shapes::Shape> Scine::Molassembler::Molecule::Impl::inferShape ( AtomIndex  index,
const RankingInformation ranking 
) const

Determines what the local geometry at a non-terminal atom ought to be

Returns the expected shape name at a non-terminal atom.

Exceptions
ifthe supplied atomic index is invalid
bool Scine::Molassembler::Molecule::Impl::operator!= ( const Impl other) const

Negates.

See Also
operator ==
void Scine::Molassembler::Molecule::Impl::removeAtom ( AtomIndex  a)

Removes an atom from the graph, including bonds to it.

Removes an atom from the molecular graph, including bonds to the atom, after checking that removing it is safe, i.e. the removal does not disconnect the graph.

Exceptions
ifthe supplied index is invalid or isSafeToRemoveAtom returns false.
void Scine::Molassembler::Molecule::Impl::removeBond ( AtomIndex  a,
AtomIndex  b 
)

Removes an atom after checking if removing that bond is safe, i.e. does not disconnect the graph. An example of bonds that can always be removed are ring-closing bonds, since they never disconnect the molecular graph.

Exceptions
ifisSafeToRemoveBond returns false.
Note
It is not safe to remove a bond just because one of the involved atoms is terminal, since that atom would then be disconnected from the rest of the molecule. This function merely removes a bond from the graph. It is, however, considered safe to remove the terminal vertex, which involves removing the bond to it.
bool Scine::Molassembler::Molecule::Impl::removePermutator ( const BondIndex bond)

Removes the BondStereopermutator on a specified edge, if present.

Returns
Whether a permutator was deleted
void Scine::Molassembler::Molecule::Impl::setShapeAtAtom ( AtomIndex  a,
Shapes::Shape  shape 
)

Sets the local geometry at an atom index

This sets the local geometry at a specific atom index. There are a number of cases that this function treats differently, besides faulty arguments: If there is already a AtomStereopermutator instantiated at this atom index, its underlying shape is altered. If there is no AtomStereopermutator at this index, one is instantiated. In all cases, new or modified stereopermutators are default-assigned if there is only one possible assignment.

Exceptions
if

The documentation for this struct was generated from the following file: