Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Periodic boundary conditions fails for small models with d>1 #67

Closed
dylanljones opened this issue May 13, 2022 · 0 comments
Closed

Periodic boundary conditions fails for small models with d>1 #67

dylanljones opened this issue May 13, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@dylanljones
Copy link
Owner

Describe the bug
Setting periodic boundary conditions for small lattices in higher dimensions fails due a broadcasting error and raises a ValueError.

To Reproduce
Steps to reproduce the behavior:

import lattpy as lp

latt = lp.finite_hypercubic((2, 2), periodic=True)

The resulting error is:

Traceback (most recent call last):
File "D:\Dropbox\Dev\Physics\lattpy\issue.py", line 16, in <module>
  main()
File "D:\Dropbox\Dev\Physics\lattpy\issue.py", line 12, in main
  latt = lp.finite_hypercubic((2, 2), periodic=True)
File "D:\Dropbox\Dev\Physics\lattpy\lattpy\__init__.py", line 451, in finite_hypercubic
  latt.build(s, primitive=primitive, periodic=periodic)
File "D:\Dropbox\Dev\Physics\lattpy\lattpy\lattice.py", line 431, in build
  self.set_periodic(periodic, primitive)
File "D:\Dropbox\Dev\Physics\lattpy\lattpy\lattice.py", line 620, in set_periodic
  self.data.set_periodic(pidx, pdists, pnvecs, paxs)
File "D:\Dropbox\Dev\Physics\lattpy\lattpy\data.py", line 467, in set_periodic
  self.neighbors[i, i0:i1] = pidx
ValueError: could not broadcast input array from shape (2,) into shape (1,)

Expected behavior
Set periodic boundary conditions if possible. In the example above this is not necessary since the sites are already neighbors.

Environment

  • lattpy version: 0.7.4
  • OS and Python version: All
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant