Project

General

Profile

Bug #1993

calc_verlet_buffer_size can't handle nstlist==1

Added by Mark Abraham over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
mdrun
Target version:
Affected version - extra info:
probably all versions with the Verlet scheme
Affected version:
Difficulty:
uncategorized
Close

Description

kT_fac becomes zero if you do gmx mdrun -nstlist 1, because there is no lifetime for the list, so no particle drift. This leads to s2 being zero and an arithmetic exception, which the code should be asserting against, because it divides by s2 quite a bit.

It seems like something should also be recognizing this trivial case and returning a zero-sized buffer, but the code probably isn't resilient enough to do that.

Associated revisions

Revision 1e968381 (diff)
Added by Berk Hess over 3 years ago

Fix Verlet buffer calculation with nstlist=1

Under rare circumstances the Verlet buffer calculation code was
called with nstlist=1, which caused a division by zero. The division
by zero is now avoided.
Furthermore, grompp now also determines and prints the Verlet buffer
sizes with nstlist=1, which provider the user information and adds
consistency checks.

Fixes #1993.

Change-Id: I6777f9c18dfcdaee0e4fe3e4609704fb48b5c138

History

#1 Updated by Mark Abraham over 3 years ago

  • Description updated (diff)

#2 Updated by Berk Hess over 3 years ago

I agree it should simply return a zero buffer (but I have to think which checks should be done before, since we shouldn't fail with a strange error when grompp used nstlist=1 and mdrun uses nstlist > 1).
But I can't reproduce this issue. I thought I added a check for all cases with nstlist=1. What setup are you using?

#3 Updated by Berk Hess over 3 years ago

It seems like this error could occur when nstlist is set to 1 in the mdp and tpr file.

#4 Updated by Mark Abraham over 3 years ago

I found it while implementing the integration tests of https://gerrit.gromacs.org/#/c/5899/17 when I set -nstlist to 1 in terminationhelper.cpp. But so far I indeed haven't been able to reproduce with standalone mdrun, and the gdb backtrace hasn't enlightened me yet.

#5 Updated by Gerrit Code Review Bot over 3 years ago

Gerrit received a related patchset '1' for Issue #1993.
Uploader: Berk Hess ()
Change-Id: I6777f9c18dfcdaee0e4fe3e4609704fb48b5c138
Gerrit URL: https://gerrit.gromacs.org/5986

#6 Updated by Berk Hess over 3 years ago

  • Status changed from New to Fix uploaded
  • Assignee set to Berk Hess
  • Target version set to 2016

I can't reproduce the issue, but I have uploaded a fix that certainly fixes this (and turns on buffer calculation in grompp with nstlist=1).

#7 Updated by Mark Abraham over 3 years ago

gmx mdrun -s MdrunTerminationTest_WritesCheckpointAfterMaxhTerminationAndThenRestarts.tpr -deffnm debug -nstlist 1 with the attached .tpr produces a NaN value in drift (eventually). Apparently that is flagged as a FP exception in the test binary, but not the real gmx. That tpr is just two waters in a decent box with v-rescale.

#8 Updated by Mark Abraham over 3 years ago

  • Status changed from Fix uploaded to Resolved

#9 Updated by Berk Hess over 3 years ago

#10 Updated by Mark Abraham over 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF