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

Exporting with Time indicator which is read from Lammps dump file header

Hi Scholars!

I have a series of dump files which have "Time" indicator in the header. This "Time" indicator does NOT have a direct correlation with "Timestep".  A sample of the header is:

ITEM: UNITS
metal
ITEM: TIME
748.9978780670657
ITEM: TIMESTEP
221950
ITEM: NUMBER OF ATOMS
512000
ITEM: BOX BOUNDS pp pp pp
-1.2927888323272029e+02 1.2927888323272029e+02
-1.1196798728952757e+02 1.1196798728952757e+02
-1.0427284512728778e+02 1.0427284512728778e+02
ITEM: ATOMS id type x y z c_peng c_keng c_eng

My question is, does Ovito understand this indicator?! if so, how can I add it to a computed data table as a new column inside my "for" loop?

FYI, I'm trying to evaluate the cluster size distribution (after wiegner-seits analysis and cluster analysis) as a function of real time (Not Timestep). For your convenience, I also put my code:

P.S. sorry for the messy "for" loop! I couldn't find any other way to create a Numpy/Dataframe containing both cluster info (indicators and sizes) and frame number.

Hi,

My question is, does Ovito understand this indicator?!

Yes, it will be stored as Global Attribute associated with each frame and can be accessed like this:

data.attributes["Time"]

https://www.ovito.org/docs/current/python/modules/ovito_data.html?#ovito.data.DataCollection.attributes

if so, how can I add it to a computed data table as a new column inside my "for" loop?

Here's how you can modify an existing data table "Cluster list", that the Cluster analysis modifier generates, such that it contains an additional column with your custom time stamp:

def modify(frame: int, data: DataCollection):
    #Add time value as additional column to  data table "cluster list"   
    data.tables["clusters_"].create_property("Time", dtype=float, components=1)
    data.tables["clusters_"]["Time"][...] = data.attributes["Time"]

https://www.ovito.org/docs/current/python/modules/ovito_data.html?#ovito.data.DataTable.

 

Thanks, Worked Like a charm!

新的OVITO微信频道!
New for our users in China: OVITO on WeChat 

Official OVITO WeChat channel operated by Foshan Diesi Technology Co., Ltd.