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

expression selection based on one frame

I'm trying to select and delete all the atoms that have a below a maximum displacement vector on one particular frame so I can track the large displacement atoms over the other frames. Every attempt I've made either selects and deletes all the atoms with that displacement in each frame or only selects atoms in that one frame.



For your kind of problem, it sounds like OVITO's Freeze Property modifier should provide a solution. That modifier allows you copy the values of a particle property from one particular frame of the trajectory over to all other frames. Thus, the values of the copied displacement property will be static, and you can subsequently use them to select the same set of particles with the Expression Selection modifier across all trajectory frames.

Note that, in fact, there are two ways to use the Freeze Property modifier in this case. Both lead to the same result. (1) You can let the modifier freeze the "Displacement" particle property and then select particles based on that static copy of the property as described above, or (2) you can first select a set of particles in one particular frame of the trajectory and then use the Freeze Property modifier to freeze the current "Selection" state of the particles and preserve it across all trajectory frames. The latter approach is demonstrated in the manual here.


Hi Thomas,

Freeze Property is a perfect solution to your problem. Besides, based on the atom id, there is an informal but simple way to select certain atoms. By this python script:

from import *
from import *
from ovito.modifiers import CalculateDisplacementsModifier
from ovito.pipeline import *

threshold=100.0 # The threshold displacement value
pipeline = import_file('inputfile.*')
data = pipeline.compute(pipeline.source.num_frames-1)
disp=data.particles['Displacement Magnitude']
pid=data.particles["Particle Identifier"][disp>threshold]
for id in pid:
print("ParticleIdentifier=={} || ".format(id),end="")

Just copy and paste the output of this script into the ovito GUI-Add modification-Expression selection, and you will select all the atoms with large displacement.

Good luck!