gmx msd with -mol and -rmcomm causes segmentation fault - Redmine #2043
Archive from user: Heikki Mikkolainen
I’m trying to calculate the diffusion coefficient of lipids in a bilayer using:
gmx msd -lateral z -f test.xtc -n index.ndx -s topol.tpr -o msd.xvg -rmcomm -mol diff.xvg
I select group “POPC” to calculate mean squared displacement and group “Membrane” for center of mass removal. The program stalls or segfaults while reading the first frame. To me it looks like the code is trying to calculate the COM of “Membrane” using the COM coordinates of POPC molecules (xa[prev] instead of x[prev]).
I tried to fix the problem using small modifications shown below, but I’m not sure if the center of mass is calculated correctly. The results seem to be OK though.
$ diff gmx_msd.cpp_fixed gmx_msd.cpp_original
802,803c802,803
< prep_data(false, gnx_com[0], index_com[0], x[cur], x[prev], box);
< calc_com(false, gnx_com[0], index_com[0], x[cur], x[prev], box,
---
> prep_data(bMol, gnx_com[0], index_com[0], xa[cur], xa[prev], box);
> calc_com(bMol, gnx_com[0], index_com[0], xa[cur], xa[prev], box,
(from redmine: issue id 2043, created on 2016-08-30 by gmxdefault, closed on 2018-01-04)
- Changesets:
- Revision 0a5e6f65 by Paul Bauer on 2018-01-04T10:13:04Z:
Fix gmx msd when using COM removal and molecules
Changed order of code to actually assign correct coordinates before
copying the data, and modified data structure size when using COM
removal and individual molecules.
Fixes #2043
Change-Id: Ic16f05a589609a43f14fd75753ca8589cf3d8c42