Project

General

Profile

Bug #910

g_msd entering infinite loop when analyzing systems with xy periodicity.

Added by Michael Shirts over 7 years ago. Updated over 7 years ago.

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

Description

When g_msd is applied to a system with xy periodicity, it stalls, as it continually tries to subtract a zero box vector.

I've added some files to reproduce the error (note that this is a 4.5.5 tpr), with command gmx_msd -s md3.tpr -f md3.xtc. Any group selection will lead to the error.

A proposed change (in 4.6 code) is as follows:

diff --git a/src/tools/gmx_msd.c b/src/tools/gmx_msd.c
index a529b1f..47fb33c 100644
--- a/src/tools/gmx_msd.c
+++ b/src/tools/gmx_msd.c
@ -400,11 +400,15 @ static void prep_data(gmx_bool bMol,int gnx,atom_id index[],

for(m=DIM-1; m>=0; m--) 
         {
+ if (hbox[m] == 0)
+ {
+ continue;
+ }
while(xcur[ind][m]-xprev[ind][m] <= hbox[m])
rvec_inc(xcur[ind],box[m]);
while(xcur[ind][m]-xprev[ind][m] > hbox[m])
rvec_dec(xcur[ind],box[m]);
}
+ }
}
}
md3.tpr (32.7 KB) md3.tpr Michael Shirts, 03/29/2012 10:21 PM
md3.xtc (68.5 KB) md3.xtc Michael Shirts, 03/29/2012 10:21 PM

Associated revisions

Revision 9770ca5f (diff)
Added by Michael Shirts over 7 years ago

Fixes problems with g_msd and g_energy

  • Fixes a problem where g_msd will stall on reading a file
    with xy periodic boxes.
  • Fixes a problem with gmx_energy ignoring the -skip option.
    Was correct in 4.0.7, but was wrong by 4.5.5. Redmine issue #910

Change-Id: I4247a4bd1cf1ab15ea6157646c97452216a887aa

History

#1 Updated by Michael Shirts over 7 years ago

  • Affected version - extra info set to all

#2 Updated by David van der Spoel over 7 years ago

I would suggest rather the following, seems that a - sign has gone missing.

for(m=DIM-1; m>=0; m--) {
while(xcur[ind][m]-xprev[ind][m] <= -hbox[m])
rvec_inc(xcur[ind],box[m]);
while(xcur[ind][m]-xprev[ind][m] > hbox[m])
rvec_dec(xcur[ind],box[m]);
}

#3 Updated by Michael Shirts over 7 years ago

Yeah, that didn't show up well with formatting. See proposed gerrit change for something more clear.

#4 Updated by Rossen Apostolov over 7 years ago

Is that the patch? https://gerrit.gromacs.org/#/c/643/
If so we can close this bug.

#5 Updated by Michael Shirts over 7 years ago

Rossen Apostolov wrote:

Is that the patch? https://gerrit.gromacs.org/#/c/643/
If so we can close this bug.

Yes, this is the patch.

#6 Updated by Michael Shirts over 7 years ago

  • Status changed from New to Closed

Also available in: Atom PDF