You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is actually a strange bug. I am not sure if there are any major implicaitons. Maybe it does not guarantee the validity of get_all_distances.
Try the following code::
from pymatgen.util.testing import PymatgenTest
cscl = PymatgenTest.get_structure("CsCl")
gen = SlabGenerator(cscl, (1, 1, 1), 10, 10)
o = gen.oriented_unit_cell
f1 = o[0].frac_coords
f2 = o[1].frac_coords
lattice = o.lattice
print len([image for dist, image in lattice.get_all_distance_and_image(
f1, f2) if dist < 4])
import itertools
for image in itertools.product(range(-2, 3), range(-2, 3), range(-2, 3)):
dist, image = lattice.get_distance_and_image(f1, f2, image)
if dist < 4:
print image
In essence, only 6 Cl atoms were found at dist < 4 from Cs. This is because some of the nearest neighbors lie outside the range of -1 <= image <= 1.
But the get_sites_in_sphere of structure class works properly because it does not depend on this mehtod. I am just not sure if there are other methods that rely on this.
I'm not entirely sure what get_all_distance_and_image is supposed to return -- as far as I can tell, its a method that you created from part of the code from get_distance_and_image. I don't think it should be its own function because the sites that it returns are entirely dependent on the lattice representation, and I'm not really sure what you'd ever want those sites for. (get distance and image is useful because it always returns the single closest image)
This is actually a strange bug. I am not sure if there are any major implicaitons. Maybe it does not guarantee the validity of get_all_distances.
Try the following code::
In essence, only 6 Cl atoms were found at dist < 4 from Cs. This is because some of the nearest neighbors lie outside the range of -1 <= image <= 1.
But the get_sites_in_sphere of structure class works properly because it does not depend on this mehtod. I am just not sure if there are other methods that rely on this.
@wmdrichards Can you take a look and review?
The text was updated successfully, but these errors were encountered: