Code examples

This page presents various example scripts grouped into the following categories.

Batch scripts

As described in OVITO’s Python interface, batch scripts perform program actions in a non-interactive manner and are typically executed from the system terminal via the ovitos script interpreter. The following examples demonstrate how to automate tasks and accomplish new things that cannot even be done with the graphical program version.

Python modifier functions

OVITO allows you to implement your own type of analysis modifier by writing a Python function that gets called every time the data pipeline is evaluated. This user-defined function has access to the positions and other properties of particles and can output information and results as new properties or global attributes.

Python viewport layer functions

OVITO allows you to implement your type of viewport layer by writing a Python function that gets called every time a viewport image is being rendered.