def dsk_out(fout,kvecs,mdsk,edsk):
  """ output fluctuating structure factor dS(k) in energy.pl format 
  Args:
    fout (str): output filename
    kvecs (list): a list of 3D vectors
    mdsk (list): mean <dS(k)>, one value per kvector
    edsk (list): error, one value per kvector
  Returns:
    bool: success
  """
  fp   = open(fout,'w')
  fp.write('# kx  ky  kz  dsk_mean  dsk_error\n') # write header
  for ik in range(len(kvecs)):
    kvec = kvecs[ik]
    dskm = mdsk[ik]
    dske = edsk[ik]
    line = '%12.8f  %12.8f  %12.8f  %10.6f  %10.6f\n' % (kvec[0],kvec[1],kvec[2],dskm,dske)
    fp.write(line)
  # end for
  fp.flush()
  fp.close()
  return True