Author Topic: How can I determine the minimum/maximum of a particle property?  (Read 794 times)

Alexander Stukowski

  • Administrator
  • Full Member
  • *****
  • Posts: 221
How can I determine the minimum/maximum of a particle property?
« on: November 28, 2016, 09:05:59 AM »
Let's suppose you would like to determine the global maximum of a particle property for every frame of a simulation and export this information to a text file. This can be done by inserting a Python Script modifier into the data pipeline. The following modifier script computes the maximum of the Potential Energy particle property and injects the value as a new global attribute into the data pipeline:

Code: [Select]
def modify(frame, input, output):
    max_energy = input.particle_properties['Potential Energy'].array.max()
    output.attributes['Maximum Energy'] = float(max_energy)

You can now use OVITO's standard file export function to generate a table of the Maximum Energy attribute and write it to a text file. Select Calculation Results Text File as output file format.
« Last Edit: November 28, 2016, 09:21:32 AM by Alexander Stukowski »