public void newSaturate ( IAtomContainer atomContainer ) throws CDKException { logger . info ( "Saturating atomContainer by adjusting bond orders..." ) ; boolean allSaturated = allSaturated ( atomContainer ) ; if ( ! allSaturated ) { IBond [ ] bonds = new IBond [ atomContainer . getBondCount ( ) ] ; for ( int i = 0 ; i < bonds . length ; i ++ ) bonds [ i ] = atomContainer . getBond ( i ) ; boolean succeeded = newSaturate ( bonds , atomContainer ) ; for ( int i = 0 ; i < bonds . length ; i ++ ) { if ( bonds [ i ] . getOrder ( ) == IBond . Order . DOUBLE && bonds [ i ] . getFlag ( CDKConstants . ISAROMATIC ) && ( bonds [ i ] . getBegin ( ) . getSymbol ( ) . equals ( "N" ) && bonds [ i ] . getEnd ( ) . getSymbol ( ) . equals ( "N" ) ) ) { int atomtohandle = 0 ; if ( bonds [ i ] . getBegin ( ) . getSymbol ( ) . equals ( "N" ) ) atomtohandle = 1 ; List < IBond > bondstohandle = atomContainer . getConnectedBondsList ( bonds [ i ] . getAtom ( atomtohandle ) ) ; for ( int k = 0 ; k < bondstohandle . size ( ) ; k ++ ) { IBond bond = bondstohandle . get ( k ) ; if ( bond . getOrder ( ) == IBond . Order . SINGLE && bond . getFlag ( CDKConstants . ISAROMATIC ) ) { bond . setOrder ( IBond . Order . DOUBLE ) ; bonds [ i ] . setOrder ( IBond . Order . SINGLE ) ; break ; } } } } if ( ! succeeded ) { throw new CDKException ( "Could not saturate this atomContainer!" ) ; } } }
Saturates a molecule by setting appropriate bond orders . This method is known to fail especially on pyrolle - like compounds . Consider using import org . openscience . cdk . smiles . DeduceBondSystemTool which should work better