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.
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.
so I finally took the time to implement a method. I added the ‘get_symmetric_neighbor_list’ method to the Structure-class. Providing a maximum distance (and a space group), it will generate all neighbors up to that distance and group them according to their symmetry. It will also give the explicit symmetry operations that relate the neighbors in a symmetry-equivalent group. This is basically what is called ‘orbit’ for a set of sites that have the same site-symmetry group (sit on the same Wyckoff-position).
To check whether two bonds are symmetrically related I added the ‘are_symmetrically_related_bond’ method to the SymmOp class.