# Nearest Image for Particle Simulations and Molecular Dynamics in MATLAB

/Often when working on particle simulations and Molecular Dynamics you need to find the nearest image of a particle when working with Periodic Boundary Conditions. After working out several implementations in MATLAB, I have come to favor the approach I show here. I will a simple approach with a few assumptions that makes the implementation easier but it can easily be extended. This works great for diffusion or random walk simulations or for your molecular dynamics code and for on lattice or off lattice simulations.

Read More