WIP: Numerical sorting of all types#1
Conversation
This reverts commit 5876ac4.
|
The last commit, 156faf9, addresses another issue that I came across. Missing |
|
Hi @jotelha , can I ask why you are using number instead of alphanumerics here? I do most of my work with biomolecular force fields that benefit from non-numeric atomtypes, and where the sorting is actually desirable to sort by ascii instead of integers, since we absolutely cannot assume that atomtypes are integers for the general user. If you try list sorting by |
|
I also see now that LAMMPS allows alphanumeric types, so topotools looks to be doing things the right way right now. I don't think I'd be opposed to adding a flag to |
|
Hi @jvermaas, I see, to be honest, I have never encountered any LAMMPS data file that uses type labels other than integers. I was not aware that this is even possible with LAMMPS. It appears that the feature to use alphanumeric type labels is comparably new (2022, https://docs.lammps.org/Howto_type_labels.html). I am in the niche of computational nanotribology, and we usually deal with mixed systems that model solid-liquid-solid interfaces, e.g. probe in solvent sliding across adsorbed solute on substrate. Here, it's common to have all atom types (and other bonded interaction types) numbered from 1 to N in the LAMMPS data files, and as soon as N > 9, topotools messes up the ordering with its current alphanumeric sorting behavior. I think introducing a flag to Best, Johannes |
Dear topotool maintainers,
I am addressing the following issue:
When processing LAMMPS data files that contain more than 9 types of an entity (e.g. atom types, bond types, angle types, dihedral types, improper types), topotools does not preserve the types, but reassigns them in alphabetical order. As an example, I use the following representation of a single DSPC molecule,
solute.data:When processed with
package require topotools topo readlammpsdata solute.data topo writelammpsdata solute_sorted.datain VMD, the processed result in
solute_sorted.dataisi.e types that were originally numbered 10, 11 ..., are now numbered 2, 3, ..., in any Masses and Coeffs section, and the subsequent types are offset accordingly.
Thus, it becomes very cumbersome to reassign non-bonded and bonded parameters correctly.
Ideally, I would like the above topotools read/write snippet to act idempotently, preserving types.
With the help of Claude, see https://claude.ai/share/a54d8e69-f336-4e1e-9bbf-3152fbfefa96, I have applied the changes in this commit to preserve the original numbering of types.
I attach the files in question for reference.
sample_data_files.zip
I suspect that there has been a specific intention in sorting types alphabetically in topotools initially, and thus these changes might break desired behavior elsewhere. I have hence marked this PR as work in progress and hope it can serve to start a discussion and document the somewhat counter-intuitive sorting behavior.
Best,
Johannes