Is it possible to get the minimum self distance for a unit cell? #2637
-
I was looking for a way to return what the minimimum self image distance is for a given unit cell. Is there a function that can calculate this? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Not sure what you mean by this, but all distances returned by pymatgen are by default the min distance. You can specify the image if needed as well. |
Beta Was this translation helpful? Give feedback.
-
Sorry I'll clarify. I mean that I would like to know what the minimum non-zero distance is from a site to itself, which should be a constant of the unit cell and the same for all sites? |
Beta Was this translation helpful? Give feedback.
-
There isn't a function that directly does this, but it is just several lines of code to do it. Create a structure with a single atom at the site in the lattice. Do get_neighbors and give it a cutoff radius that is the maximum of the lattice parameters. The neighbors can be sorted by distance and the first one would be the shortest distance. |
Beta Was this translation helpful? Give feedback.
-
Ok thank you, I wanted to check that this wasn't some kind of constant of the lattice with a name before I made a heuristic! |
Beta Was this translation helpful? Give feedback.
There isn't a function that directly does this, but it is just several lines of code to do it. Create a structure with a single atom at the site in the lattice. Do get_neighbors and give it a cutoff radius that is the maximum of the lattice parameters. The neighbors can be sorted by distance and the first one would be the shortest distance.