deepmodeling / dpdata

A Python package for manipulating atomistic data of software in computational science
https://docs.deepmodeling.com/projects/dpdata/
GNU Lesser General Public License v3.0
195 stars 129 forks source link

[BUG] Unable to handle incomplete trajectories #616

Open nbzy1995 opened 6 months ago

nbzy1995 commented 6 months ago

Bug summary

Here are really two issues.

  1. If I have a lammps/dump file that has some incomplete frames or it contains some comment lines starting with "#", dpdata.System() will throw an ValueError exception: ValueError: invalid literal for int() with base 10: '#####'

. It might be better if it can either throw a more meaningful exception, or it can report a warning and still able to read in the frames and mark the incorrect frame as nan.

  1. It seems dpdata.System() cannot read in velocities in the lammps dump file.

  2. Another minor feature request: can we add an option to choose not to reorder the atom indices? i.e., dpdata.System( reorder = False).

dpdata Version

v0.2.17 Latest on Oct

Input Files, Running Commands, Error Log, etc.

Python code:

import dpdata

# 1. Load input data file 
# I attached a lammps dump file with the last frame incomplete. [traj.txt](https://github.com/deepmodeling/dpdata/files/14617582/traj.txt)

in_file= "traj.txt"

d_conf = dpdata.System(in_file, fmt="lammps/dump")

Steps to Reproduce

Run the above python codes.

Further Information, Files, and Links

No response