How To Script with OVITO

A series of recipes and tutorials on how to use python scripting with OVITO

Author
Affiliation

Materials Scientist

Published

February 29, 2024

About

OVITO is a visualization software for computational chemistry and materials science (Stukowski 2009). Its primarily used through a graphical user interface (GUI), but it has a standalone python scripting library that allows for full fledge use of all OVITO capabilities1. Its very powerful approach that enables manipulation of atomic simulation data to create beautiful visualizations.

1 No need for Pro subscription

2 I will use the acronym SOVITO regularly

3 Both Basic and Pro versions

This site is a rendering from a collection of Google Colab/Jupyter notebooks that show recipes for how to perform visualization and data analysis using python scripting OVITO (SOVITO2) interface. This is not a “How to run LAMMPS” nor a guide on how to perform specific analysis. Its merely how one would use SOVITO to get “pre-defined” outcomes similar to those in the GUI3.

In addition to these recipes, you can find examples on the OVITO scripting documentation here. Some of the example scripts there can be ran on there own, while the modifier, scripts are intended to be combined with a pipeline object.

Installing OVITO python scripting

You don’t need to install the GUI version of OVITO to use the code shown on this site. There are two options:

pip

pip install -U ovito

Conda

conda install --strict-channel-priority -c https://conda.ovito.org -c conda-forge ovito=3
Note

Most of the notebooks inlcude cell magic escapes to pip install OVITO.

Notes on Rendering

OVITO has the following options for rendering images:

  1. OpenGL
  2. Tachyon
  3. OSPRay
  4. Anari4 (CUDA GPU)

4 This is an experimental renderer and I had trouble getting it to work

Both 1 and 4 are hardware based while 2-3 are software ray tracing programs. For quick rendered images, I find that 1 is the best, however since I’m running the notebooks on Google Colab or JupyterLab in a headless configuration I couldn’t get OpenGL to work so I used 2 or 3.

In general, the choice of render is based on need for speed and preference for the stylistic aspects of redendering atomistic simulations. There is no “best” choice for everyone, just use what you like. Therefore in the notebooks just change the render to what you would prefer.

Tip

The developer(s) of OVITO really try to provide very modern tools for visualization. This includes the ability to use glTF, which is a web standard for displaying 3D models. This means you can display your simulation cell with analysis colorings and make them maninuplateable.

Notebooks

Most of the notebooks have been drafted using Google Colab which is a custom version of Jupyter notebooks. The notebooks are then rendered with Quarto to produce this website. This makes it so the reader can either copy code snippets in whatever python setup they prefer. Could be VSCode, JupyterLab, Google Colab, etc.

On each recipe page you should find a links at the top and side to view the notebook version of the webpage displayed.

References

Stukowski, Alexander. 2009. “Visualization and Analysis of Atomistic Simulation Data with OVITO–the Open Visualization Tool.” Modelling and Simulation in Materials Science and Engineering 18 (1): 015012. https://doi.org/10.1088/0965-0393/18/1/015012.

Citation

BibTeX citation:
@online{bringuier2024,
  author = {Bringuier, Stefan},
  publisher = {Github Pages},
  title = {How {To} {Script} with {OVITO}},
  date = {2024-02-29},
  url = {https://stefanbringuier.github.io/HowToSOVITO},
  langid = {en}
}