Mapping Structures when vacancies and atoms switch spots

Hi, I am modelling lithium intercalation in graphite with cluster expansion. To do so I have the carbon layers and a layer in between composed of lithium atoms and vacancies. When I do DFT on my set of training structures some of the structures have significant relaxation with the lithium and vacancies changing sites. I used map_structure_to_reference() due to the movement caused by relaxation and found that for the structures where lithium atoms and vacancies swapped spots the function returned the structure to its original, pre-relaxation, structure. My question is, since the energy values I got are for the relaxed structure it would be inaccurate for me to use the structure I got from map_structure_to_reference() since that is a completely different structure correct? I added a picture below to help better illustrate what is happening (red dots are just vacancies).

In interstitial sublattices it is not uncommon for the interstitial to move to another site during relaxation, since barriers can be small and some sites can in fact be unstable with respect to others. You also seem to have a rather elongated cell, which can make it difficult to see directly if you have, e.g., atoms wrapping around the periodic boundary conditions.

Such elongated cells can also be challenging for the structure mapping. We have just improved our structure mapping routines, which you could try out by pulling the master branch. We hope to release a new version very soon and then this feature will also be available via PyPI.

The updated mapping functionality is now officially released as part of icet 4.0.