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

How to display the simulation time on each frame?

Hi,

I have my trajectory of simulation as a .gsd file, and I am using Ovito to make an animation of it. My system is changing over simulation time. It has dynamic. I need to load simulation time(Timestep * dt). How do I load simulation time in the rendering movie?

Thanks in advance.

Hi,

OVITO's GSD file reader parses general information such as the current timestep number ("configuration/step" chunk) and logged data associated with each trajectory frame and makes this information available within OVITO as so-called global attributes of the dataset. You probably have seen already that the Text Label viewport layer allows you to include such dynamic values in rendered images.

Sometimes, as in your case, a conversion, multiplication or other type of modification of the original value is necessary.  For this purpose you can use the Python Script modifier. A simple user-defined modifier function like the following is sufficient:

def modify(frame, data):
    data.attributes['Time'] = data.attributes['Timestep'] * 0.002 # Multiply with dt

You may then use the placeholder [Time] in the Text Label layer to include the current simulation time in rendered animations. Note that, unfortunately, the simulation timestep size is not stored in the GSD file. That's why you will have to enter the right timestep size in the Python code yourself. However, there might be the option to have your MD code write the timestep size information into the GSD file as logged data, please check.

Hello,

Thanks a lot, it workes.

Best