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

within_inf returns wrong supercell indices? #649

Open
pfebrer opened this issue Nov 8, 2023 · 0 comments
Open

within_inf returns wrong supercell indices? #649

pfebrer opened this issue Nov 8, 2023 · 0 comments

Comments

@pfebrer
Copy link
Contributor

pfebrer commented Nov 8, 2023

Describe the bug

The supercell indices that within_inf returns are for the atoms translated to the unit cell, is this intended?

Code to reproduce problem

import numpy as np

# Create a geometry with an atom outside of the unit cell
geometry = sisl.Geometry([-0.5, 0, 0], lattice=np.diag([2, 10, 10]))

# Search for atoms
search = sisl.Lattice(np.diag([3, 10, 10]))
ia, xyz, isc = geometry.within_inf(search, periodic=[True, True, True])

print("ia", ia)
print("xyz", xyz)
print("isc", isc)
ia [0]
xyz [[1.5 0.  0. ]]
isc [[0 0 0]]

As you can see, it says that the image of atom 0 on sc (0,0,0) is inside the search lattice, which is a lie. The supercell index should be (1, 0, 0), unless the function specifies that it will first translate atoms to the unit cell.

I understand even less the output if I change the search to [2, 10, 10]:

import numpy as np
geometry = sisl.Geometry([-0.5, 0, 0], lattice=np.diag([2, 10, 10]))

search = sisl.Lattice(np.diag([2, 10, 10]))
ia, xyz, isc = geometry.within_inf(search, periodic=[True, True, True])

print("ia", ia)
print("xyz", xyz)
print("isc", isc)
ia []
xyz []
isc []

It says there are no atoms in the search lattice, this is clearly wrong, isn't it? Regardless of whether the first one is intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant