Project

General

Profile

Bug #2043

gmx msd with -mol and -rmcomm causes segmentation fault

Added by Heikki Mikkolainen about 3 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
analysis tools
Target version:
Affected version - extra info:
Affected version:
Difficulty:
uncategorized
Close

Description

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,
start.sh (235 Bytes) start.sh Heikki Mikkolainen, 08/30/2016 06:37 PM
index.ndx (555 KB) index.ndx Heikki Mikkolainen, 08/30/2016 06:37 PM
topol.tpr (712 KB) topol.tpr Heikki Mikkolainen, 08/30/2016 06:37 PM
test.xtc (8 MB) test.xtc Heikki Mikkolainen, 08/30/2016 06:37 PM
log_2016 (3.46 KB) log_2016 Heikki Mikkolainen, 08/30/2016 06:43 PM
gmx_msd.cpp_original (37.2 KB) gmx_msd.cpp_original Heikki Mikkolainen, 08/30/2016 07:08 PM
gmx_msd.cpp_fixed (37.2 KB) gmx_msd.cpp_fixed Heikki Mikkolainen, 08/30/2016 07:08 PM

Associated revisions

Revision 0a5e6f65 (diff)
Added by Paul Bauer almost 2 years ago

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

History

#1 Updated by Chris Neale almost 3 years ago

I can confirm that I see this with gromacs 5.1.2 for two different test systems. More details are below, but basically as originally reported there is an infinite hang at the start when -mol is combined with -rmcomm.

I find that gmx msd (version 5.1.2) hangs when I use the -rmcomm option. If I run a test like this:

#!/bin/bash
gro=EQUIL.gro
xtc=MD.xtc
tpr=MD.tpr

rm -f tmp.ndx
gmx make_ndx -f $gro -o tmp.ndx << EOF
r1
r1-60
q
EOF

rm -f msd.xvg diff_mol.xvg
echo -e "r1\nr_1-60\n" | gmx msd -s $tpr -f $xtc -n tmp.ndx -o msd.xvg -mol diff_mol.xvg -lateral z -rmcomm -e 100

Then it hangs forever after outputting:

<... snip ...>
Command line:
  gmx msd -s MD.tpr -f MD.xtc -n tmp.ndx -o msd.xvg -mol diff_mol.xvg -lateral z -rmcomm -e 100

Calculating diffusion coefficients for molecules.
Reading file MD.tpr, VERSION 5.1.2 (single precision)
Reading file MD.tpr, VERSION 5.1.2 (single precision)

Select a group to calculate mean squared displacement for:
Group     0 (         System) has 17248 elements
Group     1 (          Other) has  8280 elements
Group     2 (           DOPC) has  8280 elements
Group     3 (              K) has     8 elements
Group     4 (             CL) has     8 elements
Group     5 (          Water) has  8952 elements
Group     6 (            SOL) has  8952 elements
Group     7 (      non-Water) has  8296 elements
Group     8 (            Ion) has    16 elements
Group     9 (           DOPC) has  8280 elements
Group    10 (              K) has     8 elements
Group    11 (             CL) has     8 elements
Group    12 ( Water_and_ions) has  8968 elements
Group    13 (            r_1) has   138 elements
Group    14 (         r_1-60) has  8280 elements
Select a group: Selected 13: 'r_1'

Now select a group for center of mass removal:
Group     0 (         System) has 17248 elements
Group     1 (          Other) has  8280 elements
Group     2 (           DOPC) has  8280 elements
Group     3 (              K) has     8 elements
Group     4 (             CL) has     8 elements
Group     5 (          Water) has  8952 elements
Group     6 (            SOL) has  8952 elements
Group     7 (      non-Water) has  8296 elements
Group     8 (            Ion) has    16 elements
Group     9 (           DOPC) has  8280 elements
Group    10 (              K) has     8 elements
Group    11 (             CL) has     8 elements
Group    12 ( Water_and_ions) has  8968 elements
Group    13 (            r_1) has   138 elements
Group    14 (         r_1-60) has  8280 elements
Select a group: Selected 14: 'r_1-60'
Split group of 138 atoms into 1 molecules
Reading frame       0 time    0.000   

However, if I remove the -rmcomm option and run like this:

echo -e "r1\n" | gmx msd -s $tpr -f $xtc -n tmp.ndx -o msd.xvg -mol diff_mol.xvg -lateral z -e 100

there it is fine:

<... snip ...>
Select a group: Selected 13: 'r_1'
Split group of 138 atoms into 1 molecules
Last frame         50 time  100.000   

Used 11 restart points spaced 10 ps over 100 ps

<D> = 0.0329 Std. Dev. = 0.0000 Error = 0.0000
Fitting from 10 to 90 ps

D[       r_1] 0.0308 (+/- 0.0149) 1e-5 cm^2/s

gcq#494: "If it's a good idea, go ahead and do it. It's much easier to apologize than it is to get permission." (Grace Hopper, developer of COBOL)

The hang with -rmcomm still exists even if I don't use the "-lateral z" option is removed, but removing -mol fixes the problem.

#2 Updated by Gerrit Code Review Bot almost 2 years ago

Gerrit received a related patchset '1' for Issue #2043.
Uploader: Paul Bauer ()
Change-Id: gromacs~release-2018~Ic16f05a589609a43f14fd75753ca8589cf3d8c42
Gerrit URL: https://gerrit.gromacs.org/7423

#3 Updated by Erik Lindahl almost 2 years ago

  • Target version set to 2018

#4 Updated by Erik Lindahl almost 2 years ago

  • Status changed from New to Fix uploaded

#5 Updated by Mark Abraham almost 2 years ago

  • Status changed from Fix uploaded to Closed
  • Assignee set to Paul Bauer

Also available in: Atom PDF