Thin out trajectry file

I have a a big trajectry file, which occupy my strage.
I do not wan to remove the file and make re-run becuase calculation time is very long.

Are there any methods that can thin out the trajectry file to compress data it self, and save the file again?
Best regards

Hi,

  • You can try a strong zip algorithm like 7z
  • You can drop some of the frames in the trajectory file if you don’t need all of them
  • Depending on what atoms objects you have inside the file, maybe they contain arrays that are less important (e.g., tags). You can use ase info -v <filename> to write something.
  • You can attempt to establish a trajectory file using float32 rather than the default float64, but that requires non-trivial coding

Best regards
Ask

Thanks for the reply

You can drop some of the frames in the trajectory file if you don’t need all of them

I’d like to follow this, how should I do it?

You can either use ase.io.iread() to iterate over them and then save, or the command-line. Something like ase convert myfile.traj@::20 myotherfile.traj. See ase convert --help.

It’s wise to independently verify, e.g. using a script, that all your required data is stored correctly before deleting the old file.

1 Like

Thanks for the additional comments,
It was solved! best regards!