OVITO > Frequently Asked Questions (FAQ)

How can I determine the minimum/maximum of a particle property?


Alexander Stukowski:
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: ---def modify(frame, input, output):
    max_energy = input.particle_properties['Potential Energy'].array.max()
    output.attributes['Maximum Energy'] = float(max_energy)
--- End code ---

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.


[0] Message Index

Go to full version