corrected centroid. added average. model have thier own write_cmm and write_xyz function