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

Enumerates the resonance structures of a molecular graph by redistributing π-electrons across conjugated bonds. More...

#include <ResonanceStructureGenerator.hpp>

Classes

class  StructureData
 Data structure storing formal atom charges and bond orders that define a single resonance structure. More...
 

Public Types

typedef std::shared_ptr< ResonanceStructureGeneratorSharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated ResonanceStructureGenerator instances. More...
 
typedef boost::indirect_iterator< StructureDataList::const_iterator, const StructureDataConstStructureDataIterator
 A constant random access iterator used to iterate over the generated const StructureData records. More...
 

Public Member Functions

 ResonanceStructureGenerator ()
 Constructs the ResonanceStructureGenerator instance. More...
 
 ResonanceStructureGenerator (const ResonanceStructureGenerator &gen)
 Constructs a copy of the ResonanceStructureGenerator instance gen. More...
 
virtual ~ResonanceStructureGenerator ()
 Virtual destructor. More...
 
ResonanceStructureGeneratoroperator= (const ResonanceStructureGenerator &gen)
 Replaces the state of this generator by a copy of the state of gen. More...
 
Util::BitSetgetOctetRuleCheckAtomTypes ()
 Returns the bit mask of atom types subjected to the octet rule check during violation minimization. More...
 
const Util::BitSetgetOctetRuleCheckAtomTypes () const
 Returns the bit mask of atom types subjected to the octet rule check during violation minimization. More...
 
void minimizeOctetRuleViolations (bool minimize)
 Specifies whether resonance structures violating the octet rule shall be filtered out. More...
 
bool octetRuleViolationsMinimized () const
 Tells whether octet rule violations are minimized. More...
 
void minimizeSP1GeometryViolations (bool minimize)
 Specifies whether resonance structures with sp-hybridization geometry violations shall be filtered out. More...
 
bool sp1GeometryViolationsMinimized () const
 Tells whether sp-hybridization geometry violations are minimized. More...
 
void minimizeCarbonBond12Charges (bool minimize)
 Specifies whether resonance structures with 1,2-charge separations on adjacent carbon atoms shall be filtered out. More...
 
bool carbonBond12ChargesMinimized () const
 Tells whether 1,2-charge separations on adjacent carbon atoms are minimized. More...
 
void setChargeCountWindow (std::size_t win_size)
 Sets the maximum allowed difference between the lowest and highest total absolute formal atom charge count of accepted resonance structures. More...
 
std::size_t getChargeCountWindow () const
 Returns the configured total absolute formal atom charge count window size. More...
 
void setMaxNumGeneratedStructures (std::size_t max_num)
 Sets the upper limit on the number of resonance structures generated per molecular graph. More...
 
std::size_t getMaxNumGeneratedStructures () const
 Returns the upper limit on the number of resonance structures generated per molecular graph. More...
 
void generate (const MolecularGraph &molgraph)
 Generates all unique resonance structures of the molecular graph molgraph. More...
 
std::size_t getNumStructures () const
 Returns the number of generated resonance structures. More...
 
const StructureDatagetStructureData (std::size_t idx) const
 Returns the resonance structure record at index idx. More...
 
ConstStructureDataIterator getStructureDataBegin () const
 Returns a constant iterator pointing to the beginning of the generated const StructureData records. More...
 
ConstStructureDataIterator getStructureDataEnd () const
 Returns a constant iterator pointing to the end of the generated const StructureData records. More...
 
ConstStructureDataIterator begin () const
 Returns a constant iterator pointing to the beginning of the generated const StructureData records. More...
 
ConstStructureDataIterator end () const
 Returns a constant iterator pointing to the end of the generated const StructureData records. More...
 

Detailed Description

Enumerates the resonance structures of a molecular graph by redistributing π-electrons across conjugated bonds.

For each generated resonance structure the formal atom charges and bond orders are reported as a StructureData record. Optional postprocessing minimizes octet rule violations, sp-hybridization geometry violations, and 1,2-charge separations on adjacent carbon atoms.

Member Typedef Documentation

◆ SharedPointer

A reference-counted smart pointer [SHPTR] for dynamically allocated ResonanceStructureGenerator instances.

◆ ConstStructureDataIterator

typedef boost::indirect_iterator<StructureDataList::const_iterator, const StructureData> CDPL::Chem::ResonanceStructureGenerator::ConstStructureDataIterator

A constant random access iterator used to iterate over the generated const StructureData records.

Constructor & Destructor Documentation

◆ ResonanceStructureGenerator() [1/2]

CDPL::Chem::ResonanceStructureGenerator::ResonanceStructureGenerator ( )

Constructs the ResonanceStructureGenerator instance.

◆ ResonanceStructureGenerator() [2/2]

CDPL::Chem::ResonanceStructureGenerator::ResonanceStructureGenerator ( const ResonanceStructureGenerator gen)

Constructs a copy of the ResonanceStructureGenerator instance gen.

Parameters
genThe generator to copy.

◆ ~ResonanceStructureGenerator()

virtual CDPL::Chem::ResonanceStructureGenerator::~ResonanceStructureGenerator ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

◆ operator=()

ResonanceStructureGenerator& CDPL::Chem::ResonanceStructureGenerator::operator= ( const ResonanceStructureGenerator gen)

Replaces the state of this generator by a copy of the state of gen.

Parameters
genThe generator to copy.
Returns
A reference to itself.

◆ getOctetRuleCheckAtomTypes() [1/2]

Util::BitSet& CDPL::Chem::ResonanceStructureGenerator::getOctetRuleCheckAtomTypes ( )

Returns the bit mask of atom types subjected to the octet rule check during violation minimization.

Returns
A reference to the bit mask (indexed by Chem::AtomType value).

◆ getOctetRuleCheckAtomTypes() [2/2]

const Util::BitSet& CDPL::Chem::ResonanceStructureGenerator::getOctetRuleCheckAtomTypes ( ) const

Returns the bit mask of atom types subjected to the octet rule check during violation minimization.

Returns
A const reference to the bit mask (indexed by Chem::AtomType value).

◆ minimizeOctetRuleViolations()

void CDPL::Chem::ResonanceStructureGenerator::minimizeOctetRuleViolations ( bool  minimize)

Specifies whether resonance structures violating the octet rule shall be filtered out.

Parameters
minimizeIf true, structures with octet rule violations on the configured atom types are minimized.

◆ octetRuleViolationsMinimized()

bool CDPL::Chem::ResonanceStructureGenerator::octetRuleViolationsMinimized ( ) const

Tells whether octet rule violations are minimized.

Returns
true if octet rule violations are minimized, and false otherwise.

◆ minimizeSP1GeometryViolations()

void CDPL::Chem::ResonanceStructureGenerator::minimizeSP1GeometryViolations ( bool  minimize)

Specifies whether resonance structures with sp-hybridization geometry violations shall be filtered out.

Parameters
minimizeIf true, sp-hybridization geometry violations are minimized.

◆ sp1GeometryViolationsMinimized()

bool CDPL::Chem::ResonanceStructureGenerator::sp1GeometryViolationsMinimized ( ) const

Tells whether sp-hybridization geometry violations are minimized.

Returns
true if sp-geometry violations are minimized, and false otherwise.

◆ minimizeCarbonBond12Charges()

void CDPL::Chem::ResonanceStructureGenerator::minimizeCarbonBond12Charges ( bool  minimize)

Specifies whether resonance structures with 1,2-charge separations on adjacent carbon atoms shall be filtered out.

Parameters
minimizeIf true, 1,2-charged carbon-carbon bonds are minimized.

◆ carbonBond12ChargesMinimized()

bool CDPL::Chem::ResonanceStructureGenerator::carbonBond12ChargesMinimized ( ) const

Tells whether 1,2-charge separations on adjacent carbon atoms are minimized.

Returns
true if 1,2-charged carbon-carbon bonds are minimized, and false otherwise.

◆ setChargeCountWindow()

void CDPL::Chem::ResonanceStructureGenerator::setChargeCountWindow ( std::size_t  win_size)

Sets the maximum allowed difference between the lowest and highest total absolute formal atom charge count of accepted resonance structures.

Parameters
win_sizeThe new total absolute formal atom charge count window size.

◆ getChargeCountWindow()

std::size_t CDPL::Chem::ResonanceStructureGenerator::getChargeCountWindow ( ) const

Returns the configured total absolute formal atom charge count window size.

Returns
The total absolute formal atom charge count window size.

◆ setMaxNumGeneratedStructures()

void CDPL::Chem::ResonanceStructureGenerator::setMaxNumGeneratedStructures ( std::size_t  max_num)

Sets the upper limit on the number of resonance structures generated per molecular graph.

Parameters
max_numThe new output structure limit.

◆ getMaxNumGeneratedStructures()

std::size_t CDPL::Chem::ResonanceStructureGenerator::getMaxNumGeneratedStructures ( ) const

Returns the upper limit on the number of resonance structures generated per molecular graph.

Returns
The output structure limit.

◆ generate()

void CDPL::Chem::ResonanceStructureGenerator::generate ( const MolecularGraph molgraph)

Generates all unique resonance structures of the molecular graph molgraph.

Parameters
molgraphThe molecular graph for which to generate the resonance structures.

◆ getNumStructures()

std::size_t CDPL::Chem::ResonanceStructureGenerator::getNumStructures ( ) const

Returns the number of generated resonance structures.

Returns
The resonance structure count.

◆ getStructureData()

const StructureData& CDPL::Chem::ResonanceStructureGenerator::getStructureData ( std::size_t  idx) const

Returns the resonance structure record at index idx.

Parameters
idxThe zero-based structure index.
Returns
A const reference to the resonance structure record.
Exceptions
Base::IndexErrorif idx is not in the range [0, getNumStructures()).

◆ getStructureDataBegin()

ConstStructureDataIterator CDPL::Chem::ResonanceStructureGenerator::getStructureDataBegin ( ) const

Returns a constant iterator pointing to the beginning of the generated const StructureData records.

Returns
A constant iterator pointing to the beginning of the generated const StructureData records.

◆ getStructureDataEnd()

ConstStructureDataIterator CDPL::Chem::ResonanceStructureGenerator::getStructureDataEnd ( ) const

Returns a constant iterator pointing to the end of the generated const StructureData records.

Returns
A constant iterator pointing to the end of the generated const StructureData records.

◆ begin()

ConstStructureDataIterator CDPL::Chem::ResonanceStructureGenerator::begin ( ) const

Returns a constant iterator pointing to the beginning of the generated const StructureData records.

Returns
A constant iterator pointing to the beginning of the generated const StructureData records.

◆ end()

ConstStructureDataIterator CDPL::Chem::ResonanceStructureGenerator::end ( ) const

Returns a constant iterator pointing to the end of the generated const StructureData records.

Returns
A constant iterator pointing to the end of the generated const StructureData records.

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