Closed arn-all closed 4 years ago
Good catch! So, if I'm reading the documentation right, the x,y,z coordinates are always "wrapped" into the box, but can be "unwrapped" by applying the optional nx,ny,nz terms.
If you want to make further improvements,
dump atom_data can easily be generalized for any atom style by looking at the list of dictionaries atoms_prop_info returns. The total number of "table_name" values will be the number of fields to read not counting the nx,ny,nz terms.
Velocities sections don't have optional terms, so I'm not sure the usecols parameter is necessary there. If you do include, it can be generalized to any velocity style similarly as the atom style.
Including the unwrapped coordinates is doable, but might be a bit more complicated. Maybe count terms in the first atoms line during the first pass, then after calling load_table, call pd.read_csv on the extra columns if present?
Problem
When using Lammps
write_data
command, positions are written to a file, but lammps also appends 3 flags to each line (0, 1 or -1). Those flags seemed not to be handled properly byatomman.load()
.The format of the file is :
For more details, see https://lammps.sandia.gov/doc/read_data.html , paragraph starting with "LAMMPS always stores atom coordinates as values which are inside the simulation box."
Steps to reproduce
The following Lammps script was used. It generated the file presented above.
When using atomman.load("atom_data", "minimized.lmp"), the returned System contained 29 atypes, instead of the 2 expected, meaning the file was not parsed properly.
Proposed solution
The proposed fix consists in ignoring those flags when reading the table. It's easily done by using the
usecols
options ofpd.read_csv()
. What I did for the moment is hardcode which columns are to be used forload('atom_data')
with atom_style set to atomic (i.e [1, 2, 3, 4]). It is improvable to support other atom_styles. I thinkusecols
should be set invelocities_prop_info
depending on theatom_style
, but I'm not sure it's the way you want to do it though. Anyway, this is a very modest contribution to try to help, it's not claimed to be merge-ready or anything ;)Discussion
Possible limitations :
Thanks for your work on atomman,