Fix infinite loop bug
This commit is contained in:
parent
e7fa5c3b3c
commit
fd262cd8c9
|
|
@ -47,7 +47,7 @@ which_index(s::system, dim::Int, coord::Int)::Int = (dim - 1) * (s.n - 1) + coor
|
||||||
function nearest(s::system, Δk::Int)::Int
|
function nearest(s::system, Δk::Int)::Int
|
||||||
# TODO: Optimize
|
# TODO: Optimize
|
||||||
while true
|
while true
|
||||||
if Δk > (s.N ÷ 2 - 1)
|
if Δk >= s.N ÷ 2
|
||||||
Δk -= s.N
|
Δk -= s.N
|
||||||
elseif Δk < -s.N ÷ 2
|
elseif Δk < -s.N ÷ 2
|
||||||
Δk += s.N
|
Δk += s.N
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue