2D analysis using the ovito-python module

Hello.

I’m currently using the Python library of OVITO and have noticed that the OVITO GUI has a corresponding interface to inform OVITO whether the input dump file is two-dimensional or three-dimensional.

The problem is how to convey this information in the Python library. Since the dimensionality has an impact on many modifiers, I’m wondering how to construct a pipeline so that all subsequently appended modifiers perform calculations based on two-dimensional data.

Thank you in advance.

Hi,
You have to add a custom modifier to the pipeline as shown here:

# Boilerplate code generated by OVITO Pro 3.13.0
...

# Data import:
pipeline = import_file('file.dump')

# Manual modifications of the imported data objects:
def modify_pipeline_input(frame: int, data: DataCollection):
    data.cell_.is2D = True
pipeline.modifiers.append(modify_pipeline_input)

...

If you’re uncertain you can use OVITO Pro’s Python Code Generator to convert any state from the GUI into a Python script.

1 Like

Thank you for your reply. Currently, I’m using the GUI version of ovito-basic, which lacks the code generator feature.