Madeline,

Yes, the PTM function calculates the local lattice orientations, but averaging the corresponding quaternion values, which all get mapped to the fundamental zone, is non-trivial (the correct way depends on the lattice symmetry). And if you have a polycrystalline system, another challenge is to correctly identify the individual grains and assign the atoms to them first. Currently, Ovito doesn't have a built-in function for that, but this is an area of active research and, in fact, Peter Larsen, the author of the PTM function, is working on a powerful algorithm to perform the grain segmentation automatically. But we haven't made this function publicly available so far, because it's still very experimental. If you have an interesting application or test case for this new type of grain analysis function, please get in touch with me or Peter via email.

If you don't care about the grain segmentation problem, and simply want to average all the quaternions calculated by PTM for a known set of atoms, then it is certainly possible to write a small Python routine for Ovito that calculates the mean orientation value. Probably, Peter has already written some code for that in the past and I should be able to dig it out. Let me know if you want to take this path instead of waiting for a proper grain segmentation function to become available in Ovito in the future.

-Alex