Skip to content

get_neighborhood does not work when cutoff_radius is specified #153

@samwaseda

Description

@samwaseda

It's actually a very rare case, but the following code does not work:

from pyiron_atomistics import Project
a_0 = 3.4812
structure = Project(".").create.structure.bulk('Fe', cubic=True, crystalstructure='fcc', a=a_0).repeat(5)
neigh = structure.get_neighbors(num_neighbors=12)
narrow_paths = structure.positions[:, None, :] + neigh.vecs * 0.5
narrow_paths = narrow_paths[neigh.indices > neigh.atom_numbers]
structure.get_neighborhood(narrow_paths, num_neighbors=None, cutoff_radius=5).distances.max()

Output : inf (while it should be some finite number since different points do not have different neighborhood)

The reason is get_extended_positions from structuretoolkit.common.helper does not correctly calculate the distance of external points to the nearest point in the box. I always knew that this could be a problem but I guess I should come up with a decent algorithm.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions