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

Applies a Chem::Reaction template to the reactant components of a target Chem::Reaction to generate the corresponding product molecules. More...

#include <Reactor.hpp>

Public Types

typedef AtomBondMapping ReactionSite
 Stores information about perceived reaction sites. More...
 
typedef ReactionSubstructureSearch::MappingIterator ReactionSiteIterator
 A mutable random access iterator used to iterate over the stored ReactionSite instances. More...
 
typedef ReactionSubstructureSearch::ConstMappingIterator ConstReactionSiteIterator
 A constant random access iterator used to iterate over the stored const ReactionSite instances. More...
 

Public Member Functions

 Reactor ()
 Constructs and initializes the Reactor instance. More...
 
 Reactor (const Reaction &rxn_pattern)
 Constructs and initializes the Reactor instance for the specified reaction pattern. More...
 
 Reactor (const Reactor &)=delete
 
 ~Reactor ()
 Destructor. More...
 
Reactor & operator= (const Reactor &)=delete
 
void setReactionPattern (const Reaction &rxn_pattern)
 Allows to specify a new reaction pattern for the transformation of reactants to products. More...
 
bool findReactionSites (Reaction &rxn_target)
 Perceives all possible reaction sites on the reactants of the given reaction target where the specified reaction pattern can be applied. More...
 
std::size_t getNumReactionSites () const
 Returns the number of recorded reactions sites in the last call to findReactionSites(). More...
 
ReactionSite & getReactionSite (std::size_t idx)
 Returns a non-const reference to the stored ReactionSite instance at index idx. More...
 
const ReactionSite & getReactionSite (std::size_t idx) const
 Returns a const reference to the stored ReactionSite instance at index idx. More...
 
ConstReactionSiteIterator getReactionSitesBegin () const
 Returns a constant iterator pointing to the beginning of the stored const ReactionSite instances. More...
 
ConstReactionSiteIterator getReactionSitesEnd () const
 Returns a constant iterator pointing to the end of the stored const ReactionSite instances. More...
 
ReactionSiteIterator getReactionSitesBegin ()
 Returns a mutable iterator pointing to the beginning of the stored ReactionSite instances. More...
 
ReactionSiteIterator getReactionSitesEnd ()
 Returns a mutable iterator pointing to the end of the stored ReactionSite instances. More...
 
ConstReactionSiteIterator begin () const
 Returns a constant iterator pointing to the beginning of the stored const ReactionSite instances. More...
 
ConstReactionSiteIterator end () const
 Returns a constant iterator pointing to the end of the stored const ReactionSite instances. More...
 
ReactionSiteIterator begin ()
 Returns a mutable iterator pointing to the beginning of the stored ReactionSite instances. More...
 
ReactionSiteIterator end ()
 Returns a mutable iterator pointing to the end of the stored ReactionSite instances. More...
 
void performReaction (const ReactionSite &rxn_site)
 Performs a transformation of the target reactants to corresponding products at the reaction site rxn_site. More...
 

Detailed Description

Applies a Chem::Reaction template to the reactant components of a target Chem::Reaction to generate the corresponding product molecules.

The reaction pattern (a Chem::Reaction with atom mapped reactant and product templates) is installed via setReactionPattern(). findReactionSites() then locates all matching substructures on the target reaction's reactants — internally using Chem::ReactionSubstructureSearch — and stores them as Reactor::ReactionSite instances. Calling performReaction() for a given reaction site copies the matched reactants, applies the bond/atom changes encoded in the pattern, and appends the resulting product molecules to the target reaction's product list.

Member Typedef Documentation

◆ ReactionSite

Stores information about perceived reaction sites.

◆ ReactionSiteIterator

A mutable random access iterator used to iterate over the stored ReactionSite instances.

◆ ConstReactionSiteIterator

A constant random access iterator used to iterate over the stored const ReactionSite instances.

Constructor & Destructor Documentation

◆ Reactor() [1/3]

CDPL::Chem::Reactor::Reactor ( )

Constructs and initializes the Reactor instance.

◆ Reactor() [2/3]

CDPL::Chem::Reactor::Reactor ( const Reaction &  rxn_pattern)

Constructs and initializes the Reactor instance for the specified reaction pattern.

Parameters
rxn_patternThe reaction pattern describing the transformation of reactants to products.

◆ Reactor() [3/3]

CDPL::Chem::Reactor::Reactor ( const Reactor &  )
delete

◆ ~Reactor()

CDPL::Chem::Reactor::~Reactor ( )

Destructor.

Destroys the Reactor instance and frees all allocated resources.

Member Function Documentation

◆ operator=()

Reactor& CDPL::Chem::Reactor::operator= ( const Reactor &  )
delete

◆ setReactionPattern()

void CDPL::Chem::Reactor::setReactionPattern ( const Reaction &  rxn_pattern)

Allows to specify a new reaction pattern for the transformation of reactants to products.

Parameters
rxn_patternThe reaction pattern describing the transformation of reactants to products.

◆ findReactionSites()

bool CDPL::Chem::Reactor::findReactionSites ( Reaction &  rxn_target)

Perceives all possible reaction sites on the reactants of the given reaction target where the specified reaction pattern can be applied.

The specified Chem::Reaction instance rxn_target serves both as a provider for the starting materials (reactant components) in a later reaction transformation (see performReaction()) as well as a container for the generated reaction products.

Parameters
rxn_targetThe reaction target providing the reactants to be transformed.
Returns
true if matching reaction sites were found, and false otherwise.
Note
Any reaction site mappings that were recorded in a previous call to findReactionSites() will be discarded.
See also
performReaction()

◆ getNumReactionSites()

std::size_t CDPL::Chem::Reactor::getNumReactionSites ( ) const

Returns the number of recorded reactions sites in the last call to findReactionSites().

Returns
The number of recorded reactions sites in the last call to findReactionSites().

◆ getReactionSite() [1/2]

ReactionSite& CDPL::Chem::Reactor::getReactionSite ( std::size_t  idx)

Returns a non-const reference to the stored ReactionSite instance at index idx.

Parameters
idxThe zero-based index of the ReactionSite instance to return.
Returns
A non-const reference to the ReactionSite instance at the specified index.
Exceptions
Base::IndexErrorif idx is not in the range [0, getNumReactionSites()).

◆ getReactionSite() [2/2]

const ReactionSite& CDPL::Chem::Reactor::getReactionSite ( std::size_t  idx) const

Returns a const reference to the stored ReactionSite instance at index idx.

Parameters
idxThe zero-based index of the ReactionSite instance to return.
Returns
A const reference to the ReactionSite instance at the specified index.
Exceptions
Base::IndexErrorif idx is not in the range [0, getNumReactionSites()).

◆ getReactionSitesBegin() [1/2]

ConstReactionSiteIterator CDPL::Chem::Reactor::getReactionSitesBegin ( ) const

Returns a constant iterator pointing to the beginning of the stored const ReactionSite instances.

Returns
A constant iterator pointing to the beginning of the stored const ReactionSite instances.

◆ getReactionSitesEnd() [1/2]

ConstReactionSiteIterator CDPL::Chem::Reactor::getReactionSitesEnd ( ) const

Returns a constant iterator pointing to the end of the stored const ReactionSite instances.

Returns
A constant iterator pointing to the end of the stored const ReactionSite instances.

◆ getReactionSitesBegin() [2/2]

ReactionSiteIterator CDPL::Chem::Reactor::getReactionSitesBegin ( )

Returns a mutable iterator pointing to the beginning of the stored ReactionSite instances.

Returns
A mutable iterator pointing to the beginning of the stored ReactionSite instances.

◆ getReactionSitesEnd() [2/2]

ReactionSiteIterator CDPL::Chem::Reactor::getReactionSitesEnd ( )

Returns a mutable iterator pointing to the end of the stored ReactionSite instances.

Returns
A mutable iterator pointing to the end of the stored ReactionSite instances.

◆ begin() [1/2]

ConstReactionSiteIterator CDPL::Chem::Reactor::begin ( ) const

Returns a constant iterator pointing to the beginning of the stored const ReactionSite instances.

Returns
A constant iterator pointing to the beginning of the stored const ReactionSite instances.

◆ end() [1/2]

ConstReactionSiteIterator CDPL::Chem::Reactor::end ( ) const

Returns a constant iterator pointing to the end of the stored const ReactionSite instances.

Returns
A constant iterator pointing to the end of the stored const ReactionSite instances.

◆ begin() [2/2]

ReactionSiteIterator CDPL::Chem::Reactor::begin ( )

Returns a mutable iterator pointing to the beginning of the stored ReactionSite instances.

Returns
A mutable iterator pointing to the beginning of the stored ReactionSite instances.

◆ end() [2/2]

ReactionSiteIterator CDPL::Chem::Reactor::end ( )

Returns a mutable iterator pointing to the end of the stored ReactionSite instances.

Returns
A mutable iterator pointing to the end of the stored ReactionSite instances.

◆ performReaction()

void CDPL::Chem::Reactor::performReaction ( const ReactionSite &  rxn_site)

Performs a transformation of the target reactants to corresponding products at the reaction site rxn_site.

The reactant components of the Chem::Reaction instance specified in a prior call to findReactionSites() serve as starting materials for the reaction transformation into corresponding product molecules (according to the set reaction pattern). The input molecules are left unchanged by the transformation. New molecules will be generated that are directly stored as the product components of the given target reaction instance. Note that the product molecules generated in a previous call will not be discarded and are still accessible after new products have been generated.

Parameters
rxn_siteSpecifies the reaction site where the transformation shall take place.
See also
setReactionPattern(), findReactionSites()

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