private void setActiveCenters ( IAtomContainer reactant ) throws CDKException { AllRingsFinder arf = new AllRingsFinder ( ) ; IRingSet ringSet = arf . findAllRings ( reactant ) ; for ( int ir = 0 ; ir < ringSet . getAtomContainerCount ( ) ; ir ++ ) { IRing ring = ( IRing ) ringSet . getAtomContainer ( ir ) ; //only rings with even number of atoms int nrAtoms = ring . getAtomCount ( ) ; if ( nrAtoms % 2 == 0 ) { int nrSingleBonds = 0 ; for ( IBond iBond : ring . bonds ( ) ) { if ( iBond . getOrder ( ) == IBond . Order . SINGLE ) nrSingleBonds ++ ; } //if exactly half (nrAtoms/2==nrSingleBonds) if ( nrSingleBonds != 0 && nrAtoms / 2 == nrSingleBonds ) { for ( IBond iBond : ring . bonds ( ) ) iBond . setFlag ( CDKConstants . REACTIVE_CENTER , true ) ; } } } }
Set the active center for this molecule . The active center will be those which correspond to a ring with pi electrons with resonance .