joaomcteixeira / taurenmd

A command-line interface for analysis of Molecular Dynamics simulations.
https://taurenmd.readthedocs.io/en/latest/
GNU General Public License v2.0
9 stars 2 forks source link

[FEATURE] Distances should be able to do periodic boundaries #30

Open richardjgowers opened 4 years ago

richardjgowers commented 4 years ago

The distance calculations don't seem to be able to handle periodic boundaries, they probably should. Even with a centered and sane configuration, linalg.norm isn't going to give the minimum distance between two centers. One way of doing this would be mda.lib.distances.distance_array or mda.lib.distances.calc_bonds which will take a unitcell (box=) to given a minimum distance between two centers.

Maybe less importantly, calling center_of_geometry() isn't always going to give the real center if the atoms are split over a periodic boundary, eg if the atoms were all forced to be within the primary unit cell and the residue was bridging a box boundary.

richardjgowers commented 4 years ago

e: the center_of_mass problem can be resolved by using the unwrap keyword in mda

joaomcteixeira commented 4 years ago

Hi @richardjgowers , thanks very much for this scientific input, indeed! I will look carefully into your suggested implementation in the following days and come back to this issue asap.