code: public void writeAtomContainer(IAtomContainer molecule) {
          SmilesGenerator sg = new SmilesGenerator();
          if (useAromaticityFlag.isSet()) sg = sg.aromatic();
          String smiles = "";
          try {
              smiles = sg.create(molecule);
              logger.debug("Generated SMILES: " + smiles);
              writer.write(smiles);
              writer.write('\n');
              writer.flush();
              logger.debug("file flushed...");
          } catch (CDKException | IOException exc) {
              logger.error("Error while writing Molecule: ", exc.getMessage());
              logger.debug(exc);
          }
      }
docs: Writes the content from molecule to output.
  
  @param   molecule  Molecule of which the data is given as output.