Finding Symmetry Equivalent Bonds (neighbors)

Hey everyone,
so I just started using pymatgen and created a ‘Structure’-instance using the .from_spacegroup method. I put a species of atoms on a Wyckoff position and the atoms on symmetry-equivalent sites were created.

I also used the get_all_neighbors method to generate all the bonds up to a certain distance, which I find super convenient. However, is there a way to find all ‘symmetry-equivalent’ neighbors or bonds? As far as I can tell the code can only distinguish them by atom and distance. I guess I could search by brute-force, by iterating over all the bonds, applying all operations of the space group and then comparing and collecting them, but if this was already implemented somewhere, it would be very helpful to me.


Hi @Niclas_Heinsdorf, welcome!

That’s a good question. First, if you haven’t seen it already make sure to check out the StructureGraph class in pymatgen.analysis.graphs and the NearNeighbor classes in pymatgen.analysis.local_env which pymatgen uses to construct the graphs – these use a variety of bonding algorithms as benchmarked in this paper.

In terms of just symmetry-equivalent bonds, I don’t think that feature currently exists, but a Pull Request to add it would be very welcome.

I think if I were looking at it I would start with what you’re doing and find the Wyckoff labels first (or, specifically, the groups of “equivalent sites” as defined by the SpacegroupAnalyzer). I would then probably find a way to annotate the sites, perhaps even by annotating the Species with the Wyckoff label (perhaps this would be messy). Finally, I would reuse or maybe even use directly the StructureGraph.types_and_weights_of_connections property.

This is just a sketch but I hope it helps. Apologies that this requires some intermediate Python coding, I think it would be a good feature to add but to my knowledge does not exist yet.



1 Like

Hey thanks for the quick reply!
So I had a look into the StructureGraph and NearNeighbor classes, but (although I don’t know what CrystalNN does under the hood) it didn’t seem like it was what I am looking for. Maybe if it was looking for symmetry preserving distortions to determine the most likely bond, I could reuse that information, although I’m not sure my ‘problem’ can reformulated in such a way.

I’m not sure if I understand what you’re getting at when you say that I should use the types_and_weights_of_connetections-thing.

I would certainly welcome this as a feature, since it is super helpful for building physical models.