bug in dump_modify sort

when i use “dump_modify sort 1” for xyz style it does not sort based on the first column.
but when I use “dump_modify sort 2” it sorts based on the first column. 3 sort based on the second column and so on.

It works correctly for me. Sort 1 sorts the first column, 2 the second, etc.

Would you please provide a sample input that reproduces this?

dump 1 all xyz 10 dump1.lammpstrj
dump_modify 1 sort 1
it does not dort the first column, but “dump_modify 1 sort 2” sorts based on the first column

No, sort 1 does sort the first column.


I think you are partially right, but this may not a bug. Dump_xyz style writes 4 columns, in the order of “type xs ys zs”, which is according to the restriction of XYZ file format.

But the LAMMPS descriptors would be “id type xs ys zs” for the default atom_style, which consist of 5 columns. Due to XYZ file format restriction, the actual first column, which is atom_id, is not written to the dump file. So the first column we see in dump_xyz files is actually the 2nd column, and sort 2 sorts the dump xyz files by atom_type, and sort 3 sorts the xyz by xs, etc.

Same behavior is observed for dump_cfg, which sort 3 sorts the first column in cfg files, which is x. This is because in cfg file formats, the first two columns (atom_id and atom_type) are not written.