@ Override public IRingSet getRingSet ( IAtomContainer molecule ) throws CDKException { Collection < List < IAtom >> cycles = findRings ( molecule ) ; IRingSet ringSet = molecule . getBuilder ( ) . newInstance ( IRingSet . class ) ; for ( List < IAtom > ringAtoms : cycles ) { IRing ring = molecule . getBuilder ( ) . newInstance ( IRing . class ) ; for ( IAtom atom : ringAtoms ) { atom . setFlag ( CDKConstants . ISINRING , true ) ; ring . addAtom ( atom ) ; for ( IAtom atomNext : ringAtoms ) { if ( ! atom . equals ( atomNext ) ) { IBond bond = molecule . getBond ( atom , atomNext ) ; if ( bond != null ) { bond . setFlag ( CDKConstants . ISINRING , true ) ; ring . addElectronContainer ( bond ) ; } } } } ringSet . addAtomContainer ( ring ) ; } return ringSet ; }
Returns Ring set based on Hanser Ring Finding method