code: public static IAtomContainer convertToAtomContainer(IRingSet ringSet) {
          IRing ring = (IRing) ringSet.getAtomContainer(0);
          if (ring == null) return null;
          IAtomContainer ac = ring.getBuilder().newInstance(IAtomContainer.class);
          for (int i = 0; i < ringSet.getAtomContainerCount(); i++) {
              ring = (IRing) ringSet.getAtomContainer(i);
              for (int r = 0; r < ring.getBondCount(); r++) {
                  IBond bond = ring.getBond(r);
                  if (!ac.contains(bond)) {
                      for (int j = 0; j < bond.getAtomCount(); j++) {
                          ac.addAtom(bond.getAtom(j));
                      }
                      ac.addBond(bond);
                  }
              }
          }
          return ac;
      }
docs: Converts a RingSet to an AtomContainer.
  
  @param  ringSet  The RingSet to be converted.
  @return          The AtomContainer containing the bonds and atoms of the ringSet.