Bug #910
g_msd entering infinite loop when analyzing systems with xy periodicity.
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]);
}
+ }
}
}
Associated revisions
History
#1 Updated by Michael Shirts almost 9 years ago
- Affected version - extra info set to all
#2 Updated by David van der Spoel almost 9 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 almost 9 years ago
Yeah, that didn't show up well with formatting. See proposed gerrit change for something more clear.
#4 Updated by Rossen Apostolov almost 9 years ago
Is that the patch? https://gerrit.gromacs.org/#/c/643/
If so we can close this bug.
#5 Updated by Michael Shirts almost 9 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 almost 9 years ago
- Status changed from New to Closed
Fixes problems with g_msd and g_energy
with xy periodic boxes.
Was correct in 4.0.7, but was wrong by 4.5.5. Redmine issue #910
Change-Id: I4247a4bd1cf1ab15ea6157646c97452216a887aa