Forum Navigation
You need to log in to create posts and topics.

Atom numbers in visualization


I have a POSCAR file that I need to visualize in OVITO. I need to know the atom number that is being visualized corresponding to my POSCAR file. Any help is much appreciated. Thanks!!


are you asking how to include that information into the rendered image? In that case you can work with "Viewport Layers".
When you open the python script overlay editor in OVITO Pro, you'll see it already contains a code example that adds a label with the current number of atoms to the viewport.

If you are only asking how to check how many atoms are present in your system, you could e.g. use the Python Scripting interface in the GUI and add the following modifier:

def modify(frame, data):
    print(f"number of atoms: {data.particles.count}")

If you want to use OVITO Basic: You can use the Expression Selection Modifier and use the boolean expression "1". Then, add a textlabel viewport overlay and enter e.g. "[ExpressionSelection.count] atoms" into the Text editor.


Hi Constanze,

I am not looking for this. I am visualizing a POSCAR file. I add the identify diamond modifier and get the number of atoms in the diamond and the number of atoms in unknown coordination. I need to identify the exact atoms that are in the diamond from OVITO for which I need the exact atom number corresponding to the POSCAR.


if I understand you correctly you want to look up the particle indices of the atoms identified as diamond structure? Then you could do the following:

from import *
import numpy as np

def modify(frame, data):
    structure_type = data.particles["Structure Type"]
    #Look up indices of atoms with a structure type other than zero
    print(f"Atom indices: {np.where(structure_type != 0)[0]}")

Alternatively, you can use the Filter function in the Data Inspector. Simply enter "StructureType != 0" in to the search bar. The left most column is the particle index.