Skip to content

Commit

Permalink
add abs to n_steps
Browse files Browse the repository at this point in the history
  • Loading branch information
xukai92 committed May 14, 2019
1 parent c25a048 commit fc3685a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/integrator.jl
Expand Up @@ -42,7 +42,7 @@ function step(
n_steps::Int=1
) where {F<:AbstractFloat,T<:Real}
fwd = n_steps > 0 # simulate hamiltonian backward when n_steps < 0
ϵ = fwd ? lf.ϵ : - lf.ϵ
ϵ = fwd ? lf.ϵ : -lf.ϵ
n_valid = 0

r_new, _is_valid_1 = lf_momentum/2, h, θ, r)
Expand All @@ -55,7 +55,7 @@ function step(
else
# Reverse half leapfrog step for r when breaking
# the loop immaturely.
if i > 1 && i < _n_steps
if i > 1 && i < abs(n_steps)
r, _ = lf_momentum(-lf.ϵ / 2, h, θ, r)
end
break
Expand Down

0 comments on commit fc3685a

Please sign in to comment.