Import only every n steps in python scripting

Quote from Betim Bahtiri on January 14, 2021, 2:25 pmHello,
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... ?
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... ?

Quote from Constanze Kalcher on January 14, 2021, 2:33 pmHi 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 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

Quote from Alexander Stukowski on January 14, 2021, 2:34 pmHi,
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()
andFileSource.load()
functions instead of the file search pattern (see the documentation of theimport_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.
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.

Quote from Betim Bahtiri on January 14, 2021, 3:04 pmHello Alexander and Constanze,
thank you a lot.
Hello Alexander and Constanze,
thank you a lot.