Closed pfebrer closed 2 months ago
This might be related to #511.
No, I don't think within_inf
is the problem here.
The computed lattice to pass to within_inf
seems wrong. If I print it I get:
Lattice{nsc: [1 1 1],
origin=[-7.0000, -7.0000, -12.0000],
A=[16.0000, 0.0000, 0.0000],
B=[0.0000, 16.0000, 0.0000],
C=[0.0000, 0.0000, 26.0000],
bc=[Periodic,
Periodic,
Periodic]
}
so it only includes up to z=14.
I don't know what toCuboid
is suposed to do :sweat_smile:
Aaaah ok, I see what is happening. I think previously orthogonal
was the first argument of toCuboid
and now it is not.
So toCuboid(True)
must be changed to toCuboid(orthogonal=True)
Thanks for backtracking, and fixing! Have been hung up all day!
Describe the bug
This part of the code: https://github.com/zerothi/sisl/blob/115479f6e54591de16196986fe01526380497ca7/src/sisl/physics/densitymatrix.py#L913-L926
which finds atoms with an orbital that reaches the unit cell, does not work properly.
This is critical because it gives wrong densities, since atoms that should contribute are not taken into account.
Code to reproduce problem
The simplest reproducing code that I could come up with is the following. I build a cell with two atoms inside and no periodic boundary conditions. Clearly, it should find both atoms to contribute to the unit cell.
With a cell
[10, 10, 20]
, if the second atom is atz=10
it is correctly found, while if it is atz=15
it is not found.I have no idea what causes this problem, but it is pretty nasty :(
(I didn't change anything in this part when I implemented the new algorithm for the density)