Forum Navigation
You need to log in to create posts and topics.

Angle between grain boundaries


I would like to calculate the angle between two grains. I tried to start by translating the quaternions to pairs of rotation axes and angles as given here"" But I'm not able to access the output arrays to use in "Compute modifier" in Ovito Pro 3.7.4.

Could you help me with this?


Thank you




Uploaded files:
  • Capture.JPG

Hello Prash,

I'm not sure about your calculations. However if you want to add a new property to the "Grain List" table you can easily do that in the following way.

from import *

def modify(frame: int, data: DataCollection):
    # Print all available tables to find the grain list
    #Prints: {'structures': DataTable(), 'ptm-rmsd': DataTable(), 'grains-merge': DataTable(), 'grains-log': DataTable(), 'grains': DataTable()}
    # Confirm that the grain table is indeed the right one:
    #Prints: {'Grain Identifier': Property('Grain Identifier'), 'Grain Size': Property('Grain Size'), 'Color': Property('Color'), 'Structure Type': Property('Structure Type'), 'Orientation': Property('Orientation')}
    # My test case has 2 grains so each property I want to add needs exactly 2 values. This data is stored in sample_data
    sample_data = [42, 420]
    # The new name for the property
    property_name = 'New Propery Name'
    # Now we can create the new column in the grain list
    data.tables['grains_'].create_property(property_name, data=sample_data)

Please let me know if you encounter any problems creating a new property.


Yes, the Compute Property modifier of OVITO lets you perform only computations that involve property values of individual atoms, bonds, or grid voxels. But it cannot perform computations that involve per-grain quantities. For that, you need to perform the computation using a Python modifier script - like Daniel suggested. In your Python function, you have full access to the DataTable object that stores all per-grain quantities computed by the grain segmentation modifier (including the "Orientation" per-grain property, which holds the 4 quaternion components).

New for our users in China: OVITO on WeChat 

Official OVITO WeChat channel operated by Foshan Diesi Technology Co., Ltd.