public static List < IRingSet > partitionRings ( IRingSet ringSet ) { List < IRingSet > ringSets = new ArrayList < IRingSet > ( ) ; if ( ringSet . getAtomContainerCount ( ) == 0 ) return ringSets ; IRing ring = ( IRing ) ringSet . getAtomContainer ( 0 ) ; if ( ring == null ) return ringSets ; IRingSet rs = ring . getBuilder ( ) . newInstance ( IRingSet . class ) ; for ( int f = 0 ; f < ringSet . getAtomContainerCount ( ) ; f ++ ) { rs . addAtomContainer ( ringSet . getAtomContainer ( f ) ) ; } do { ring = ( IRing ) rs . getAtomContainer ( 0 ) ; IRingSet newRs = ring . getBuilder ( ) . newInstance ( IRingSet . class ) ; newRs . addAtomContainer ( ring ) ; ringSets . add ( walkRingSystem ( rs , ring , newRs ) ) ; } while ( rs . getAtomContainerCount ( ) > 0 ) ; return ringSets ; }
Partitions a RingSet into RingSets of connected rings . Rings which share an Atom a Bond or three or more atoms with at least on other ring in the RingSet are considered connected . Thus molecules such as azulene and indole will return a List with 1 element .