Fix imaging correction in diffusion calculation. OpenMP parallelize diffusion and unwrap. #985
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Version 6.14.0.
The previous correction to imaging in the diffusion calculation (#984) was not enough, and could fail if the "unwrapped" position of the particle got too far away from the main unit cell (resulted in diffusion distances that were much too low). This PR fixes this by consolidating the unwrapping code originally in
ImageRoutines.cppto a separate file, and using that for both theunwrapanddiffusionactions. The original unwrap routines are further sped up by only calculating the unwrap vector if the current position is farther than half a box length away from the previous position in any dimension (~2.3x speedup). In addition, thediffusionandunwrapactions have been OpenMP-parallelized for even more speedup (forunwrap~2.7x speedup at 4 threads, fordiffusionabout 2.5x speedup at 4 threads).