dylanljones/lattpy

Wrong neighbors if we set 2nd connections

tpyang opened this issue · 0 comments

Describe the bug
See below, site 5 is found for site 3 as nearest neighbor, but site 3 is not found for site 5 as nearest neighbor,

To Reproduce
Steps to reproduce the behavior:

import lattpy as lp
import matplotlib.pyplot as plt

latt = lp.Lattice.hexagonal()
latt.add_atom()
latt.add_connections(2)

latt.build((3-0.1, 3-0.1, ), primitive=True)
latt.set_periodic([1, ], primitive=True)

latt.plot(show_indices=True)
plt.show()
print(latt.neighbors(3,distidx=0))
print(latt.neighbors(5,distidx=0))

The resulting error is:

[1 0 4 6 5 8]
[7 4 2 8 0]

Expected behavior
[1 0 4 6 5 8]
[7 4 2 8 0 3]

Environment

  • lattpy version: 0.7.7
  • OS and Python version: MacOs, python3.8

Additional context
Add any other context about the problem here.