wrote a method for writing out xyz-data