code: public void writeMolecule(IAtomContainer mol) throws IOException {
  
          String st = "";
          boolean writecharge = true;
  
          try {
  
              String s1 = "" + mol.getAtomCount();
              writer.write(s1, 0, s1.length());
              writer.write('\n');
  
              String s2 = null; // FIXME: add some interesting comment
              if (s2 != null) {
                  writer.write(s2, 0, s2.length());
              }
              writer.write('\n');
  
              // Loop through the atoms and write them out:
              Iterator<IAtom> atoms = mol.atoms().iterator();
              while (atoms.hasNext()) {
                  IAtom a = atoms.next();
                  st = a.getSymbol();
  
                  Point3d p3 = a.getPoint3d();
                  if (p3 != null) {
                      st = st + "\t" + (p3.x < 0 ? "" : " ") + fsb.format(p3.x) + "\t" + (p3.y < 0 ? "" : " ")
                              + fsb.format(p3.y) + "\t" + (p3.z < 0 ? "" : " ") + fsb.format(p3.z);
                  } else {
                      st = st + "\t " + fsb.format(0.0) + "\t " + fsb.format(0.0) + "\t " + fsb.format(0.0);
                  }
  
                  if (writecharge) {
                      double ct = a.getCharge() == CDKConstants.UNSET ? 0.0 : a.getCharge();
                      st = st + "\t" + ct;
                  }
  
                  writer.write(st, 0, st.length());
                  writer.write('\n');
  
              }
          } catch (IOException e) {
              //            throw e;
              logger.error("Error while writing file: ", e.getMessage());
              logger.debug(e);
          }
      }
docs: writes a single frame in XYZ format to the Writer.
  @param mol the Molecule to write