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

how to slice the lammps dump trajectory as a function of the nanoparticle's center of mass

Dear all,

I would like to slice the trajectory as a function of the moving nanoparticle's center of mass so that I can track the liquid flow condition at any time without worrying about the nanoparticle might move out of the slice plane.

I could not find any related information, can ovito do this?

Attachments contain the system setup view ( a nanoparticle immersed in a pool of liquids and there is a substrate at the bottom) and the corresponding trajectory.

Thank you very much!


Dezhao Huang
Ph.D. candidate at University of Notre Dame
Department of Aerospace and Mechanical Engineering
B14 Fitzpatrick Hall
Notre Dame, IN 46556-5710



Uploaded files:

Hi Dezhao,

yes, you can do that through the python scripting interface. Open the GUI of OVITO Pro, insert a python script modifier into your pipeline and try the following script as an example:

from import *
from ovito.modifiers import SelectTypeModifier, ClusterAnalysisModifier, SliceModifier, InvertSelectionModifier, ClearSelectionModifier

def modify(frame, data):
    data.apply(SelectTypeModifier(property = 'Particle Type', types = {2}))
    data.apply(ClusterAnalysisModifier(compute_com = True, only_selected = True, cutoff = 4. ))
    cluster_com = data.tables['clusters']['Center of Mass'][0]
    data.apply(SliceModifier(normal = (0,1,0), distance = cluster_com[1], only_selected = True ))

This script will compute the center of mass of the nanoparticle, which you can pass to the SliceModifier as "distance" argument.
Let me know if you have questions.


Uploaded files:
  • slice.gif

Thank you very much, Constanze!

This is very helpful!