code: private void writeAtomContainerSet(IAtomContainerSet som) throws IOException, CDKException {
  
          for (int i = 0; i < som.getAtomContainerCount(); i++) {
              IAtomContainer mol = som.getAtomContainer(i);
              for (int j = 0; j < som.getMultiplier(i); j++) {
                  StringWriter sw = new StringWriter();
                  writer.write("$MOL");
                  writer.write('\n');
                  MDLV2000Writer mdlwriter = null;
                  try {
                      mdlwriter = new MDLV2000Writer(sw);
                  } catch (Exception ex) {
                      logger.error(ex.getMessage());
                      logger.debug(ex);
                      throw new CDKException("Exception while creating MDLWriter: " + ex.getMessage(), ex);
                  }
                  mdlwriter.write(mol);
                  mdlwriter.close();
                  writer.write(sw.toString());
              }
          }
      }
docs: Writes a MoleculeSet to an OutputStream for the reaction.
  
  @param   som  The MoleculeSet that is written to an OutputStream