From 6979a88954252a2d9dbc055297b30eb35384dde6 Mon Sep 17 00:00:00 2001 From: JiQi535 <54908836+JiQi535@users.noreply.github.com> Date: Sun, 27 Mar 2022 18:03:37 -0700 Subject: [PATCH] sort atom id in dumps of SNA descriptors By default, dump files of LAMMPs has an indeterminate order for atoms. To constrain the sequence of atom to be consistent with that of a structure, "dump_modify 1 sort id" should be added for LAMMPS input files. An alternative way is to also dump the atom ids into the dump files, so that the calculated atomic descriptors can be correctly allocated to atoms. In calculator templates of maml, "dump_modify 1 sort id" is used consistently, and only the "SpectralNeighborAnalysis" misses this line of command. So in this commit, this dump_modify is added to "SpectralNeighborAnalysis". Interestingly, for small cells, LAMMPS dumps the atoms with sorted id by default, while the ids are unsorted for large cells. This behavior is seemingly not described in LAMMPS documentation, and it is unclear where is the border for "large" and "small". This is why that our previous works on SNAP did not have problem, as the dumped atoms for the small training structures were likely sorted by default. --- maml/apps/pes/_lammps.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/maml/apps/pes/_lammps.py b/maml/apps/pes/_lammps.py index 43341d7d..2d2f656a 100644 --- a/maml/apps/pes/_lammps.py +++ b/maml/apps/pes/_lammps.py @@ -262,9 +262,13 @@ class SpectralNeighborAnalysis(LMPStaticCalculator): "compute snad all snad/atom ", "compute snav all snav/atom ", "dump 1 all custom 1 dump.element element", + "dump_modify 1 sort id", "dump 2 all custom 1 dump.sna c_sna[*]", + "dump_modify 2 sort id", "dump 3 all custom 1 dump.snad c_snad[*]", + "dump_modify 3 sort id", "dump 4 all custom 1 dump.snav c_snav[*]", + "dump_modify 4 sort id", ] def __init__(self, rcutfac, twojmax, element_profile, quadratic=False, **kwargs):