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

Load multiple files from command line

Hi All,

Ovito allows to overlay multiple objects from separate files: the new files are simply added via File->Load file and answering "yes" to the prompt "When importing the selected file, do you want to keep the existing objects?" one can visualize multiple snapshots in a single space. Is it possible to load multiple files like that from the command line?

I tried "ovito file1 file2 ...", however, Ovito only loaded file1.

Thank you,

Botond

Hi Botond,

yes, actually specifying multiple filenames on the command line (what you already did) would be the right way to go about this.

The outcome depends on their file-formats, however. If they all have the same file format, they will be concatenated into a sequence forming an animatable trajectory. If they have different formats, OVITO will  try to detect whether they represent a pair of topology/trajectory files. If not, they should be inserted as several independent objects into the scene.
In the first case, what you will see in the GUI, is then only one pipeline and a "Load Trajectory Modifier". Maybe that happened in your case?

 

Hi Botond,

In the current OVITO version, opening multiple files at once from the command line only works for certain combinations of file types. The behavior was recently changed in order to support opening pairs of topology and trajectory files in one step. This is explained in the manual here.

If you pass one topology file and one trajectory file to OVITO on the command line, the program will load the topology file and automatically add a Load Trajectory modifier to the data pipeline for loading the trajectory. If you specify two or more topology files, OVITO will load them side by side into the scene, like you asked. However, if your specify multiple trajectory files, OVITO will concatenate the trajectories to form one longer trajectory. Currently, there is no way for the user to influence this standard behavior from the command line.

I'm sorry for the double posting. Looks like Constanze and I responded almost at the same time.

Dear Constanze and Alexander,

Thank you both for your help. These are the kind of plots I'm making. For that, I have a series of LAMMPS (lammps_*.dat) and corresponding VTK (vtk_*.vtk) snapshots. I load them together so they overlap. What I was trying was to call Ovito from the command line and provide the first LAMMPS and VTK files as:

ovito lammps_0.dat vtk_0.vtk

If I understand it correctly, it is not possible to load them like this, is that correct? Any command line alternatives would be appreciated because it would be very helpful if I could somehow automatize this process and wouldn't have to load the files in manually for each of my simulation runs.

Thank you again,

Botond

 

Uploaded files:
  • Screenshot-from-2020-11-24-10-16-42.png

In fact, simultaneously loading a LAMMPS data file and a VTK mesh file in this manner is supposed to work. Both are considered "non-trajectory" file formats by OVITO, because the contain only a single frame each. OVITO will then load the two files as separate objects into the scene.

Unfortunately, however, I just discovered a small bug in the software, which prevents this from working. OVITO likely crashes if you try this, because one of the files is a particle structure and the other isn't. A fix for the bug is already underway and updated builds of OVITO 3.3.3 will become available later tonight.

By the way, if you are working with OVITO Pro, you could also make use of the Python scripting interface to load multiple datasets from the command line. For example:

ovito --exec "from ovito.io import *; import_file('file1.data').add_to_scene(); import_file('file2.vtk').add_to_scene()"

You could wrap this command line in a shell script to load several files and perform any additional visualization setup steps as needed.

Thanks, that is exactly what I experienced: Ovito crashed with no error message.

So far I'm not using Pro, but it seems like it's worth considering given the Python scripting capabilities.

Thank you,

Botond