Cannot output nonaffine displacement data in the pipeline

Hi everyone,

I am using a python snippet (appended below) to calculate the nonaffine square displacement D2_min of the lammps snapshots. But ovito returns error that “D2_min is not found” because it is not a particle property.
I also append two of the lammps data files below for reference.
PS: the python script is mixed with codes and outputs for reader’s convenience.

My ovito was installed by conda:
##Name Version Build Channel
anari_ovito 0.8.0 hc48e508_2194 https://conda.ovito.org
ospray_ovito 3.0.0 hec17384_2261 https://conda.ovito.org
ovito 3.10.1 py38h8be8162_0 https://conda.ovito.org

Could anyone help with this? Many thanks.

ovito.py (3.5 KB)
step-607.data (17.5 KB)
step-608.data (17.5 KB)

Hi @ytzhang,

I had a similar issue a few years back. The properties names read from files are parsed so capital letters are changed to lower case inside Ovito. I think this is why your script returns an error.

See @stukowski’s answer’s here for how to check for particles properties names as referenced by Ovito using the GUI.

One more thing: I noticed you tried to print the names of the particle properties to confirm the presence of "d2min" using the following line of code:

print("Available properties:", data.particles.keys())

This produced the following, rather unhelpful, output:

Available properties: KeysView(Particles())

These are the correct ways to list the names of the available particle properties:

>>> data = pipeline.compute()
>>> print(data.particles.keys())
KeysView(Particles())
>>> print(data.particles)       
{'Position': Property('Position'), 'Particle Type': Property('Particle Type'), 'Particle Identifier': Property('Particle Identifier'), 'Mass': Property('Mass')}
>>> print(list(data.particles.keys()))
['Position', 'Particle Type', 'Particle Identifier', 'Mass']

These property names can then be used to index into the particles object:

mass = data.particles['Mass']

Regarding OVITO’s name mangling, the rules and tips previously shared by @Germain still apply.

1 Like