Chemical Data Processing Library Python API - Version 1.4.0
Classes | Public Member Functions | Properties | List of all members
CDPL.Chem.ResonanceStructureGenerator Class Reference

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

+ Inheritance diagram for CDPL.Chem.ResonanceStructureGenerator:

Classes

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

Public Member Functions

None __init__ ()
 Constructs the ResonanceStructureGenerator instance.
 
None __init__ (ResonanceStructureGenerator gen)
 Constructs a copy of the ResonanceStructureGenerator instance gen. More...
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
ResonanceStructureGenerator assign (ResonanceStructureGenerator gen)
 Replaces the state of this generator by a copy of the state of gen. More...
 
bool octetRuleViolationsMinimized ()
 Tells whether octet rule violations are minimized. More...
 
None minimizeOctetRuleViolations (bool minimize)
 Specifies whether resonance structures violating the octet rule shall be filtered out. More...
 
bool sp1GeometryViolationsMinimized ()
 Tells whether sp-hybridization geometry violations are minimized. More...
 
None minimizeSP1GeometryViolations (bool minimize)
 Specifies whether resonance structures with sp-hybridization geometry violations shall be filtered out. More...
 
bool carbonBond12ChargesMinimized ()
 Tells whether 1,2-charge separations on adjacent carbon atoms are minimized. More...
 
None minimizeCarbonBond12Charges (bool minimize)
 Specifies whether resonance structures with 1,2-charge separations on adjacent carbon atoms shall be filtered out. More...
 
Util.BitSet getOctetRuleCheckAtomTypes ()
 Returns the bit mask of atom types subjected to the octet rule check during violation minimization. More...
 
int getChargeCountWindow ()
 Returns the configured total absolute formal atom charge count window size. More...
 
None setChargeCountWindow (int win_size)
 Sets the maximum allowed difference between the lowest and highest total absolute formal atom charge count of accepted resonance structures. More...
 
int getMaxNumGeneratedStructures ()
 Returns the upper limit on the number of resonance structures generated per molecular graph. More...
 
None setMaxNumGeneratedStructures (int max_num)
 Sets the upper limit on the number of resonance structures generated per molecular graph. More...
 
None generate (MolecularGraph molgraph)
 Generates all unique resonance structures of the molecular graph molgraph. More...
 
int getNumStructures ()
 Returns the number of generated resonance structures. More...
 
StructureData getStructureData (int idx)
 Returns the resonance structure record at index idx. More...
 
StructureData __getitem__ (int idx)
 
int __len__ ()
 

Properties

 objectID = property(getObjectID)
 
 numStructures = property(getNumStructures)
 
 minOctetRuleViolations = property(octetRuleViolationsMinimized, minimizeOctetRuleViolations)
 
 minSP1GeometryViolations = property(sp1GeometryViolationsMinimized, minimizeSP1GeometryViolations)
 
 minCarbonBond12Charges = property(carbonBond12ChargesMinimized, minimizeCarbonBond12Charges)
 
 octetRuleCheckAtomTypes = property(getOctetRuleCheckAtomTypes)
 
 chargeCountWindow = property(getChargeCountWindow, setChargeCountWindow)
 
 maxNumGeneratedStructures = property(getMaxNumGeneratedStructures, setMaxNumGeneratedStructures)
 

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.

Constructor & Destructor Documentation

◆ __init__()

None CDPL.Chem.ResonanceStructureGenerator.__init__ ( ResonanceStructureGenerator  gen)

Constructs a copy of the ResonanceStructureGenerator instance gen.

Parameters
genThe generator to copy.

Member Function Documentation

◆ getObjectID()

int CDPL.Chem.ResonanceStructureGenerator.getObjectID ( )

Returns the numeric identifier (ID) of the wrapped C++ class instance.

Different Python ResonanceStructureGenerator instances may reference the same underlying C++ class instance. The commonly used Python expression a is not b thus cannot tell reliably whether the two ResonanceStructureGenerator instances a and b reference different C++ objects. The numeric identifier returned by this method allows to correctly implement such an identity test via the simple expression a.getObjectID() != b.getObjectID().

Returns
The numeric ID of the internally referenced C++ class instance.

◆ assign()

ResonanceStructureGenerator CDPL.Chem.ResonanceStructureGenerator.assign ( ResonanceStructureGenerator  gen)

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

Parameters
genThe generator to copy.
Returns
self

◆ octetRuleViolationsMinimized()

bool CDPL.Chem.ResonanceStructureGenerator.octetRuleViolationsMinimized ( )

Tells whether octet rule violations are minimized.

Returns
True if octet rule violations are minimized, and False otherwise.

◆ minimizeOctetRuleViolations()

None 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.

◆ sp1GeometryViolationsMinimized()

bool CDPL.Chem.ResonanceStructureGenerator.sp1GeometryViolationsMinimized ( )

Tells whether sp-hybridization geometry violations are minimized.

Returns
True if sp-geometry violations are minimized, and False otherwise.

◆ minimizeSP1GeometryViolations()

None 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.

◆ carbonBond12ChargesMinimized()

bool CDPL.Chem.ResonanceStructureGenerator.carbonBond12ChargesMinimized ( )

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.

◆ minimizeCarbonBond12Charges()

None 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.

◆ getOctetRuleCheckAtomTypes()

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).

◆ getChargeCountWindow()

int CDPL.Chem.ResonanceStructureGenerator.getChargeCountWindow ( )

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

Returns
The total absolute formal atom charge count window size.

◆ setChargeCountWindow()

None CDPL.Chem.ResonanceStructureGenerator.setChargeCountWindow ( int  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.

◆ getMaxNumGeneratedStructures()

int CDPL.Chem.ResonanceStructureGenerator.getMaxNumGeneratedStructures ( )

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

Returns
The output structure limit.

◆ setMaxNumGeneratedStructures()

None CDPL.Chem.ResonanceStructureGenerator.setMaxNumGeneratedStructures ( int  max_num)

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

Parameters
max_numThe new output structure limit.

◆ generate()

None CDPL.Chem.ResonanceStructureGenerator.generate ( MolecularGraph  molgraph)

Generates all unique resonance structures of the molecular graph molgraph.

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

◆ getNumStructures()

int CDPL.Chem.ResonanceStructureGenerator.getNumStructures ( )

Returns the number of generated resonance structures.

Returns
The resonance structure count.

◆ getStructureData()

StructureData CDPL.Chem.ResonanceStructureGenerator.getStructureData ( int  idx)

Returns the resonance structure record at index idx.

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