mdtraj icon indicating copy to clipboard operation
mdtraj copied to clipboard

Computing the minimum image distance, excluding self

Open leeping opened this issue 8 years ago • 6 comments

Hi everyone,

I know it's been a while. :) I've been using mdtraj for a lot of my simulation analysis, and recently I've revisited the old problem of how can we know if our protein is closely interacting with a periodic image of itself. This would involve calculating the minimum-image distances between our protein and its periodic images, but excluding the self-distance. (See attached image for an example).

min_image

I wrote some simple code using MDtraj for doing this: https://gist.github.com/leeping/367d9a45e156a258bd939669173ff8af . It creates 26 copies of the original protein (shifted by lattice vectors), stacks the trajectories together along the atom axis, and then computes the distances between the original copy and each of the 26 others. I'm leaving it here in case anyone finds it useful.

I'm not sure if this is an implemented feature in any trajectory analysis package. If this is a desirable feature, we may want to think about improving the implementation. Maybe we can modify the mdtraj.compute_distances function to exclude the self-image, and this would probably save both compute time and lines of code.

Let me know what you think.

Thanks,

  • Lee-Ping

leeping avatar Feb 24 '17 19:02 leeping