Skip to content

Commit

Permalink
return compute and frame_weight from lock block
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiq committed Mar 22, 2024
1 parent 7f140d0 commit abf0d72
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/mddf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,9 @@ function mddf(
# Reset the number of frames read by each chunk
R_chunk[ichunk].files[1].nframes_read = 0
for _ in frame_range
# variables used in this scope
local compute
local frame_weight
# Read frame coordinates
lock(read_lock) do
iframe, compute = goto_nextframe!(iframe, R, trajectory, to_compute_frames, options)
compute, frame_weight = lock(read_lock) do
iframe, compute = goto_nextframe!(iframe, R, trajectory, to_compute_frames, options)
if compute
# Read frame for computing
# The solute coordinates must be read in intermediate arrays, because the
Expand All @@ -212,7 +209,10 @@ function mddf(
frame_weight = R_chunk[ichunk].files[1].frame_weights[iframe]
# Display progress bar
options.silent || next!(progress)
end # compute if
else
frame_weight = 0.0
end
return compute, frame_weight
end # release reading lock
#
# Perform MDDF computation
Expand Down

0 comments on commit abf0d72

Please sign in to comment.