# averaging of stain

Quote from bahman Danesh on May 15, 2020, 4:56 pmDear OVITO experts,

I was wondering whether we can calculate the average value over all atomic strain tensors of the model? I know that for shear strain it is possible by using a python script. How about the strain tensors?

Bets regards,

Bahman

Dear OVITO experts,

I was wondering whether we can calculate the average value over all atomic strain tensors of the model? I know that for shear strain it is possible by using a python script. How about the strain tensors?

Bets regards,

Bahman

Quote from Constanze Kalcher on May 18, 2020, 11:35 amDear Bahman,

yes of course, like for any other particle property, you can also compute system or time averages of the atomic strain tensor. For time averaging, you can simply use the Time averaging modifier. A system average can be computed by using a Python script modifier in the GUI.

Here is how you can access the per-atom Green-Lagrangian strain tensor that can be computed with the Atomic Strain modifier.

data.particles["Strain Tensor"]If you want to look up a specific component only, you can do e.g.

#first component data.particles["Strain Tensor"][:,0] #6th (last) component data.particles["Strain Tensor"][:,5]see e.g. https://numpy.org/devdocs/reference/arrays.indexing.html#basic-slicing-and-indexing

-Constanze

Dear Bahman,

yes of course, like for any other particle property, you can also compute system or time averages of the atomic strain tensor. For time averaging, you can simply use the Time averaging modifier. A system average can be computed by using a Python script modifier in the GUI.

Here is how you can access the per-atom Green-Lagrangian strain tensor that can be computed with the Atomic Strain modifier.

data.particles["Strain Tensor"]

If you want to look up a specific component only, you can do e.g.

#first component data.particles["Strain Tensor"][:,0] #6th (last) component data.particles["Strain Tensor"][:,5]

see e.g. https://numpy.org/devdocs/reference/arrays.indexing.html#basic-slicing-and-indexing

-Constanze