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

Import only every n steps in python scripting

Hello,

i would like to import only 100th step to do my calculations because i have to many dump files.

traj_mod.source.load("Y:/DATA/MD/Diffusion_REAXFF/Small_model/1wt_water/02_model_01/02_296/results/dump.*")

 

How can i load only every 100th dump file e.g. dump.0 dump.100 dump.200... ?

Hi Betim,

instead of using the wildcard notation you can just pass an explicit list of file paths to the import_file() function. Since you're using python you'll have all the freedom there.

https://www.ovito.org/docs/current/python/modules/ovito_io.php

-Constanze

Hi,

There is no built-in option to import only every n-th file. But you can pass an explicit list of filenames to the import_file() and FileSource.load() functions instead of the file search pattern (see the documentation of the import_file() function). In other words you could do something like this:

traj_mod.source.load(["dump.0", "dump.100", "dump.200", "dump.300", ...])

So all you have to do is build this list of filename strings in your script.

Hello Alexander and Constanze,

 

thank you a lot.