Author Topic: Average Quaternions for Each Grain  (Read 65 times)


  • Newbie
  • *
  • Posts: 1
Average Quaternions for Each Grain
« on: July 20, 2018, 06:33:31 PM »
Hi all,

I want to get a characteristic quaternion for each grain. I am unsure how to go about this seeing as the orientations (W,X,Y,Z) that can be exported from Polyhedral Template Matching are not all similar within a grain. Any direction would be great.



Alexander Stukowski

  • Administrator
  • Sr. Member
  • *****
  • Posts: 435
Re: Average Quaternions for Each Grain
« Reply #1 on: July 23, 2018, 02:54:47 PM »

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.