Doubt about the average RDF in ovito

Hello,

I’m new in this forum.

I have a question about Ovito. I did a simulation with Lammps and I want to analyze the RDF. I would be interested in averaging the latest RDFs. I was looking at the OVITO Python Reference manual and found how to do a general average. However, I didn’t manage to define a frame interval. Could you explain to me how I define a frame interval to do the averaging?
This is my code

from ovito.io import import_file, export_file
from ovito.modifiers import CoordinationAnalysisModifier, TimeAveragingModifier
import numpy

pipeline = import_file(“md.lammpstrj”)
print(“Number of MD frames:”, pipeline.source.num_frames)

pipeline.modifiers.append(CoordinationAnalysisModifier(cutoff = 5.0, number_of_bins = 100, partial=True))

pipeline.modifiers.append(TimeAveragingModifier(operate_on=‘table:coordination-rdf’))

partial_rdf = pipeline.compute()
print(partial_rdf.tables[‘coordination-rdf[average]’].xy())

export_file(pipeline, “partial_rdf_average.txt”, “txt/table”, key=“coordination-rdf[average]”)

I found this definition of interval

modifier.interval = (pipeline.source.num_frames//2, pipeline.source.num_frames-1)

but I couldn’t define the initial frame (for example a number 46502) to reach the final frame

Thank you very much for your help

Yes, you are right, you can set the interval attribute of the TimeAveragingModifier instance to a pair of integers specifying the first and the last frame of the averaging interval, either by passing it as keyword argument to the constructor function

TimeAveragingModifier(interval=(46502, pipeline.source.num_frames-1), operate_on = ...

or after construction,

mod = TimeAveragingModifier()
mod.interval = (46502, pipeline.source.num_frames-1)

see the blue “Note” box in the OVITO scripting reference chapter Applying modifiers.

Thanks a lot!