Regarding the Use of Generate Trajectory Lines Modifier

I am using GenerateTrajectoryLinesModifier to obtain the trajectory of a subset of particles from a dump file (includes shear) over a period of time. Below is my simplified code:

pipeline = import_file(dump_file)
cmd = convert_ovito_command(processor_atoms_id)   #  select some atoms
pipeline.modifiers.append(ExpressionSelectionModifier(expression=cmd))
pipeline.modifiers.append(UnwrapTrajectoriesModifier())
trajectory_modifier = GenerateTrajectoryLinesModifier(only_selected=True, sampling_frequency=1)
pipeline.modifiers.append(trajectory_modifier)
trajectory_modifier.generate()

In the code above, processor_atoms_id refers to the atom IDs that a particular processor process (in an MPI parallel program) needs to handle.
I have encountered an issue where the program occasionally throws the following error:

      trajectory_modifier.generate()
RuntimeError: The current simulation sequence consists only of a single frame. Thus, no trajectory lines were created.

By “occasionally,” I mean that the same code sometimes runs without errors and sometimes produces this error. The error message indicates that there is only a single frame, which seems unlikely given the context.

Could someone help me understand what might be causing this error? I am happy to provide additional information if needed.

Right, this kind of error is unexpected - at least if the loaded trajectory always contains more than one frame. You can check this by printing the value of pipeline.source.num_frames.

By “occasionally,” I mean that the same code sometimes runs without errors and sometimes produces this error.

Could you please clarify whether or not you always run this code with the exact same inputs (dump_file and processor_atoms_id)? In other words, is the behavior you observe reproducible or does the error occur unpredictably?

Thank you for your response.

I understand that the information I provided might not be sufficient. The error is difficult to reproduce and occurs only occasionally. The same program and data may not exhibit the issue upon subsequent runs.

I am running the MPI-parallel Python program on a supercomputer, which involves multiple nodes. I suspect that this issue may be related to mpi4py rather than ovito. I will keep monitoring the error and will update this thread with any new findings.

Thank you once again for your assistance.