Chemical Data Processing Library C++ API - Version 1.1.1
Classes | Public Types | Public Member Functions | Static Public Attributes | List of all members
CDPL::Chem::AutomorphismGroupSearch Class Reference

AutomorphismGroupSearch. More...

#include <AutomorphismGroupSearch.hpp>

Public Types

typedef std::shared_ptr< AutomorphismGroupSearchSharedPointer
 
typedef SubstructureSearch::MappingIterator MappingIterator
 A mutable random access iterator used to iterate over the stored atom/bond mapping objects. More...
 
typedef SubstructureSearch::ConstMappingIterator ConstMappingIterator
 A constant random access iterator used to iterate over the stored atom/bond mapping objects. More...
 
typedef std::function< bool(const MolecularGraph &, const AtomBondMapping &)> MappingCallbackFunction
 

Public Member Functions

 AutomorphismGroupSearch (unsigned int atom_flags=DEF_ATOM_PROPERTY_FLAGS, unsigned int bond_flags=DEF_BOND_PROPERTY_FLAGS)
 Constructs and initializes a AutomorphismGroupSearch instance. More...
 
void setAtomPropertyFlags (unsigned int flags)
 
unsigned int getAtomPropertyFlags () const
 
void setBondPropertyFlags (unsigned int flags)
 
unsigned int getBondPropertyFlags () const
 
void includeIdentityMapping (bool include)
 
bool identityMappingIncluded () const
 
bool findMappings (const MolecularGraph &molgraph)
 Searches for the possible atom/bond mappings in the automorphism group of the given molecular graph. More...
 
void stopSearch ()
 
std::size_t getNumMappings () const
 Returns the number of atom/bond mappings that were recorded in the last call to findMappings(). More...
 
AtomBondMappinggetMapping (std::size_t idx)
 Returns a non-const reference to the stored atom/bond mapping object at index idx. More...
 
const AtomBondMappinggetMapping (std::size_t idx) const
 Returns a const reference to the stored atom/bond mapping object at index idx. More...
 
MappingIterator getMappingsBegin ()
 Returns a mutable iterator pointing to the beginning of the stored atom/bond mapping objects. More...
 
ConstMappingIterator getMappingsBegin () const
 Returns a constant iterator pointing to the beginning of the stored atom/bond mapping objects. More...
 
MappingIterator getMappingsEnd ()
 Returns a mutable iterator pointing to the end of the stored atom/bond mapping objects. More...
 
ConstMappingIterator getMappingsEnd () const
 Returns a constant iterator pointing to the end of the stored atom/bond mapping objects. More...
 
MappingIterator begin ()
 Returns a mutable iterator pointing to the beginning of the stored atom/bond mapping objects. More...
 
ConstMappingIterator begin () const
 Returns a constant iterator pointing to the beginning of the stored atom/bond mapping objects. More...
 
MappingIterator end ()
 Returns a mutable iterator pointing to the end of the stored atom/bond mapping objects. More...
 
ConstMappingIterator end () const
 Returns a constant iterator pointing to the end of the stored atom/bond mapping objects. More...
 
void setMaxNumMappings (std::size_t max_num_mappings)
 Allows to specify a limit on the number of stored atom/bond mappings. More...
 
std::size_t getMaxNumMappings () const
 Returns the specified limit on the number of stored atom/bond mappings. More...
 
void addAtomMappingConstraint (std::size_t atom1_idx, std::size_t atom2_idx)
 Adds a constraint on the allowed atom mappings. More...
 
void clearAtomMappingConstraints ()
 Clears all previously defined atom mapping constraints. More...
 
void addBondMappingConstraint (std::size_t bond1_idx, std::size_t bond2_idx)
 Adds a constraint on the allowed bond mappings. More...
 
void clearBondMappingConstraints ()
 Clears all previously defined bond mapping constraints. More...
 
void setFoundMappingCallback (const MappingCallbackFunction &func)
 
const MappingCallbackFunctiongetFoundMappingCallback () const
 

Static Public Attributes

static constexpr unsigned int DEF_ATOM_PROPERTY_FLAGS
 Specifies the default set of atomic properties considered for atom matching. More...
 
static constexpr unsigned int DEF_BOND_PROPERTY_FLAGS
 Specifies the default set of bond properties considered for bond matching. More...
 

Detailed Description

AutomorphismGroupSearch.

Member Typedef Documentation

◆ SharedPointer

◆ MappingIterator

A mutable random access iterator used to iterate over the stored atom/bond mapping objects.

◆ ConstMappingIterator

A constant random access iterator used to iterate over the stored atom/bond mapping objects.

◆ MappingCallbackFunction

Constructor & Destructor Documentation

◆ AutomorphismGroupSearch()

CDPL::Chem::AutomorphismGroupSearch::AutomorphismGroupSearch ( unsigned int  atom_flags = DEF_ATOM_PROPERTY_FLAGS,
unsigned int  bond_flags = DEF_BOND_PROPERTY_FLAGS 
)

Constructs and initializes a AutomorphismGroupSearch instance.

Member Function Documentation

◆ setAtomPropertyFlags()

void CDPL::Chem::AutomorphismGroupSearch::setAtomPropertyFlags ( unsigned int  flags)

◆ getAtomPropertyFlags()

unsigned int CDPL::Chem::AutomorphismGroupSearch::getAtomPropertyFlags ( ) const

◆ setBondPropertyFlags()

void CDPL::Chem::AutomorphismGroupSearch::setBondPropertyFlags ( unsigned int  flags)

◆ getBondPropertyFlags()

unsigned int CDPL::Chem::AutomorphismGroupSearch::getBondPropertyFlags ( ) const

◆ includeIdentityMapping()

void CDPL::Chem::AutomorphismGroupSearch::includeIdentityMapping ( bool  include)

◆ identityMappingIncluded()

bool CDPL::Chem::AutomorphismGroupSearch::identityMappingIncluded ( ) const

◆ findMappings()

bool CDPL::Chem::AutomorphismGroupSearch::findMappings ( const MolecularGraph molgraph)

Searches for the possible atom/bond mappings in the automorphism group of the given molecular graph.

The method will store all found mappings up to the maximum number of recorded mappings specified by setMaxNumMappings().

Parameters
molgraphThe molecular graph that has to be searched for automorphisms.
Returns
true if any mappings of the specified molecular graph have been found, and false otherwise.
Note
Any atom/bond mappings that were recorded in a previous call to findMappings() will be discarded.

◆ stopSearch()

void CDPL::Chem::AutomorphismGroupSearch::stopSearch ( )

◆ getNumMappings()

std::size_t CDPL::Chem::AutomorphismGroupSearch::getNumMappings ( ) const

Returns the number of atom/bond mappings that were recorded in the last call to findMappings().

Returns
The number of atom/bond mappings that were recorded in the last call to findMappings().

◆ getMapping() [1/2]

AtomBondMapping& CDPL::Chem::AutomorphismGroupSearch::getMapping ( std::size_t  idx)

Returns a non-const reference to the stored atom/bond mapping object at index idx.

Parameters
idxThe zero-based index of the atom/bond mapping object to return.
Returns
A non-const reference to the atom/bond mapping object at index idx.
Exceptions
Base::IndexErrorif no mappings are available or idx is not in the range [0, getNumMappings() - 1].

◆ getMapping() [2/2]

const AtomBondMapping& CDPL::Chem::AutomorphismGroupSearch::getMapping ( std::size_t  idx) const

Returns a const reference to the stored atom/bond mapping object at index idx.

Parameters
idxThe zero-based index of the atom/bond mapping object to return.
Returns
A const reference to the atom/bond mapping object at index idx.
Exceptions
Base::IndexErrorif no mappings are available or idx is not in the range [0, getNumMappings() - 1].

◆ getMappingsBegin() [1/2]

MappingIterator CDPL::Chem::AutomorphismGroupSearch::getMappingsBegin ( )

Returns a mutable iterator pointing to the beginning of the stored atom/bond mapping objects.

Returns
A mutable iterator pointing to the beginning of the stored atom/bond mapping objects.

◆ getMappingsBegin() [2/2]

ConstMappingIterator CDPL::Chem::AutomorphismGroupSearch::getMappingsBegin ( ) const

Returns a constant iterator pointing to the beginning of the stored atom/bond mapping objects.

Returns
A constant iterator pointing to the beginning of the stored atom/bond mapping objects.

◆ getMappingsEnd() [1/2]

MappingIterator CDPL::Chem::AutomorphismGroupSearch::getMappingsEnd ( )

Returns a mutable iterator pointing to the end of the stored atom/bond mapping objects.

Returns
A mutable iterator pointing to the end of the stored atom/bond mapping objects.

◆ getMappingsEnd() [2/2]

ConstMappingIterator CDPL::Chem::AutomorphismGroupSearch::getMappingsEnd ( ) const

Returns a constant iterator pointing to the end of the stored atom/bond mapping objects.

Returns
A constant iterator pointing to the end of the stored atom/bond mapping objects.

◆ begin() [1/2]

MappingIterator CDPL::Chem::AutomorphismGroupSearch::begin ( )

Returns a mutable iterator pointing to the beginning of the stored atom/bond mapping objects.

Returns
A mutable iterator pointing to the beginning of the stored atom/bond mapping objects.

◆ begin() [2/2]

ConstMappingIterator CDPL::Chem::AutomorphismGroupSearch::begin ( ) const

Returns a constant iterator pointing to the beginning of the stored atom/bond mapping objects.

Returns
A constant iterator pointing to the beginning of the stored atom/bond mapping objects.

◆ end() [1/2]

MappingIterator CDPL::Chem::AutomorphismGroupSearch::end ( )

Returns a mutable iterator pointing to the end of the stored atom/bond mapping objects.

Returns
A mutable iterator pointing to the end of the stored atom/bond mapping objects.

◆ end() [2/2]

ConstMappingIterator CDPL::Chem::AutomorphismGroupSearch::end ( ) const

Returns a constant iterator pointing to the end of the stored atom/bond mapping objects.

Returns
A constant iterator pointing to the end of the stored atom/bond mapping objects.

◆ setMaxNumMappings()

void CDPL::Chem::AutomorphismGroupSearch::setMaxNumMappings ( std::size_t  max_num_mappings)

Allows to specify a limit on the number of stored atom/bond mappings.

In a call to findMappings() the automorphism search will terminate as soon as the specified maximum number of stored atom/bond mappings has been reached. A previously set limit on the number of mappings can be disabled by providing zero for the value of max_num_mappings.

Parameters
max_num_mappingsThe maximum number of atom/bond mappings to store.
Note
By default, no limit is imposed on the number of stored mappings.

◆ getMaxNumMappings()

std::size_t CDPL::Chem::AutomorphismGroupSearch::getMaxNumMappings ( ) const

Returns the specified limit on the number of stored atom/bond mappings.

Returns
The specified maximum number of stored atom/bond mappings.
See also
setMaxNumMappings(), findMappings()

◆ addAtomMappingConstraint()

void CDPL::Chem::AutomorphismGroupSearch::addAtomMappingConstraint ( std::size_t  atom1_idx,
std::size_t  atom2_idx 
)

Adds a constraint on the allowed atom mappings.

By default, an atom can be mapped to any valid other atom. When this method gets called for a particular atom pair (specified by atom1_idx and atom2_idx), a future search will report only those solutions which feature the specified mapping of the two atoms. Multiple calls to addAtomMappingConstraint() for a particular atom enlarges the set of valid mapping solutions.

Parameters
atom1_idxThe index of the first atom.
atom2_idxThe index of the second atom.

◆ clearAtomMappingConstraints()

void CDPL::Chem::AutomorphismGroupSearch::clearAtomMappingConstraints ( )

Clears all previously defined atom mapping constraints.

See also
addAtomMappingConstraint()

◆ addBondMappingConstraint()

void CDPL::Chem::AutomorphismGroupSearch::addBondMappingConstraint ( std::size_t  bond1_idx,
std::size_t  bond2_idx 
)

Adds a constraint on the allowed bond mappings.

By default, an bond can be mapped to any valid other bond. When this method gets called for a particular bond pair (specified by bond1_idx and bond2_idx), a future search will report only those solutions which feature the specified mapping of the two bonds. Multiple calls to addBondMappingConstraint() for a particular bond enlarges the set of valid mapping solutions.

Parameters
bond1_idxThe index of the first bond.
bond2_idxThe index of the second bond.

◆ clearBondMappingConstraints()

void CDPL::Chem::AutomorphismGroupSearch::clearBondMappingConstraints ( )

Clears all previously defined bond mapping constraints.

See also
addBondMappingConstraint()

◆ setFoundMappingCallback()

void CDPL::Chem::AutomorphismGroupSearch::setFoundMappingCallback ( const MappingCallbackFunction func)

◆ getFoundMappingCallback()

const MappingCallbackFunction& CDPL::Chem::AutomorphismGroupSearch::getFoundMappingCallback ( ) const

Member Data Documentation

◆ DEF_ATOM_PROPERTY_FLAGS

constexpr unsigned int CDPL::Chem::AutomorphismGroupSearch::DEF_ATOM_PROPERTY_FLAGS
staticconstexpr

◆ DEF_BOND_PROPERTY_FLAGS

constexpr unsigned int CDPL::Chem::AutomorphismGroupSearch::DEF_BOND_PROPERTY_FLAGS
staticconstexpr
Initial value:

Specifies the default set of bond properties considered for bond matching.


The documentation for this class was generated from the following file:
CDPL::Chem::AtomPropertyFlag::FORMAL_CHARGE
const unsigned int FORMAL_CHARGE
Specifies the formal charge of an atom.
Definition: Chem/AtomPropertyFlag.hpp:73
CDPL::Chem::BondPropertyFlag::AROMATICITY
const unsigned int AROMATICITY
Specifies the membership of a bond in aromatic rings.
Definition: BondPropertyFlag.hpp:73
CDPL::Chem::BondPropertyFlag::CONFIGURATION
const unsigned int CONFIGURATION
Specifies the steric configuration of a double bond.
Definition: BondPropertyFlag.hpp:78
CDPL::Chem::AtomPropertyFlag::EXPLICIT_BOND_COUNT
const unsigned int EXPLICIT_BOND_COUNT
Specifies the explicit bond count of an atom.
Definition: Chem/AtomPropertyFlag.hpp:118
CDPL::Chem::AtomPropertyFlag::CONFIGURATION
const unsigned int CONFIGURATION
Specifies the configuration of a stereogenic atom.
Definition: Chem/AtomPropertyFlag.hpp:98
CDPL::Chem::BondPropertyFlag::ORDER
const unsigned int ORDER
Specifies the order of a bond.
Definition: BondPropertyFlag.hpp:63
CDPL::Chem::BondPropertyFlag::TOPOLOGY
const unsigned int TOPOLOGY
Specifies the ring/chain topology of a bond.
Definition: BondPropertyFlag.hpp:68
CDPL::Chem::AtomPropertyFlag::TYPE
const unsigned int TYPE
Specifies the generic type or element of an atom.
Definition: Chem/AtomPropertyFlag.hpp:63
CDPL::Chem::AtomPropertyFlag::ISOTOPE
const unsigned int ISOTOPE
Specifies the isotopic mass of an atom.
Definition: Chem/AtomPropertyFlag.hpp:68
CDPL::Chem::AtomPropertyFlag::AROMATICITY
const unsigned int AROMATICITY
Specifies the membership of an atom in aromatic rings.
Definition: Chem/AtomPropertyFlag.hpp:93
CDPL::Chem::AtomPropertyFlag::H_COUNT
const unsigned int H_COUNT
Specifies the hydrogen count of an atom.
Definition: Chem/AtomPropertyFlag.hpp:78
CDPL::Chem::AtomPropertyFlag::HYBRIDIZATION_STATE
const unsigned int HYBRIDIZATION_STATE
Specifies the hybridization state an atom.
Definition: Chem/AtomPropertyFlag.hpp:123