Hello,
I want to read a LAMMPS xyz file into a pipeline using python and then remove some frames and save it again?
Any idea is appreciated.
And how can create a LAMMPS restart file from a specific frame?
Thank you
Hi,
Please have a look at this section in the OVITO python reference: ovito.io — OVITO Python Reference 3.9.4 documentation
To export specific animation frames only, you can pass the frame
keyword parameter to the export_file()
function. Alternatively, you can use the multiple_frames=True
option in combination with the keyword arguments start_frame
, end_frame
, and every_nth_frame
.
Binary LAMMPS restart files contain information about the current state of the simulation, this information is not accessible to OVITO since it cannot be reconstructed from LAMMPS data / dump files. You can, however, export a LAMMPS data file from OVITO which can be used to start a new simulation run.
Thank you, that answers my question.
What if I want to export specific frames which are not uniformly distributed. I can have them listed in an array or list. Like [0,4,10,17,18,19,20,47,78,79,80,100]
Is it possible to create an empty pipeline and fill it with atoms manually?
- Yes, as mentioned above you can use the
frame
keyword parameter:
for i in [0,4,10,17,18,19,20,47,78,79,80,100]:
export_file(pipeline, f"output.{i}.dump", "lammps/dump", frame=i)
- Setting up a pipeline from scratch is possible with a so-called PythonScriptSource - both in the OVITO Pro desktop application and in a stand-alone Python script.
I know this, but I wanted them as one file.
I see. In that case, the easiest solution would be to merge those files in a subsequent step, e.g. using the command line tool cat
.
cat *.dump > merged.dump
Thank you, I would have preferred a direct way at the export step.
cat might do it in the wrong order.