def write_metadata res
      File.open(@options[:output_parameters], 'wb') do |f|
        f.write(JSON.pretty_generate(res))
      end
    end
def write_metadata res
      File.open(@options[:output_parameters], 'wb') do |f|
        f.write(JSON.pretty_generate(res))
      end
    end
Write out metadata from the optimisation run