pyiron / pyiron/structuretoolkit

`get_neighborhood` does not work when `cutoff_radius` is specified

Open
#153 0 comments 0 reactions 1 assignee View on GitHub

@samwaseda is already working on this.

Since Feb 23, 2024.

bug
Dominant language
Python
Stars
8
Forks
1
Avg merge
1d 28m
Merged PRs (30d)
10

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.