dylanljones/lattpy

Periodic boundary conditions misses some neighbors for non-square lattices

dylanljones opened this issue · 1 comments

Describe the bug
Setting periodic boundary conditions misses neighbors for some lattices.

To Reproduce
See, for example, the hexagonal lattice

import lattpy as lp
import matplotlib.pyplot as plt

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

latt.build((3, 3, ), primitive=True)
latt.set_periodic([0, ], primitive=True)

latt.plot()
plt.show()

The top (12) and bottom (3) sites are each missing one neighbor (site 1 and 14, respectively)

Figure_1

Environment

  • lattpy version: 0.7.4
  • OS and Python version: All

Periodic neighbors are actually correct