Project

General

Profile

Bug #1408

Incorrect dvdlambda : posres() in gmxlib/bondfree.c (4.6.* & 4.5.2+)

Added by teruhisa komatsu over 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
mdrun
Target version:
Affected version - extra info:
4.5.2+
Affected version:
Difficulty:
uncategorized
Close

Description

I think I found a simple (three year old) BUG in the line 2290 of gmxlib/bondfree.c (ver 4.6.5),

-fm*dpdl[m];

which should be

+fm*dpdl[m];

if I understand correctly the notation etc.
Comparing this code, which calculates dvdlambda, with the code at the line 431 of the same file,

dvdlambda = half*(kB-kA)*dx2 + (xA-xB)*kk*dx;

which is inside the real function hamonic(), one may notice the inconsistency.
(c.f. fm=-kk*dx[m], dpdl[m] = posB - posA)

Associated revisions

Revision 239fe4f4 (diff)
Added by Berk Hess about 3 years ago

Fixed sign error in posres dvdl

For position restraints the sign of the contribution of the change
in reference location was incorrect. Note that the contribution of
the change in force constant was and is correct.

Fixes #1408.

Change-Id: I75210c3855d13fdd58e0a698d6c5d7c7116f456b

History

#1 Updated by Berk Hess about 3 years ago

  • Category set to mdrun
  • Status changed from New to Closed
  • Assignee set to Berk Hess

This code is correct. The code on line 431 uses xA-xB, whereas dpdl=posB-posA. So we need a minus sign because of this difference.

#2 Updated by Gerrit Code Review Bot about 3 years ago

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

#3 Updated by Berk Hess about 3 years ago

  • Status changed from Closed to Fix uploaded
  • Priority changed from Normal to High
  • Target version changed from 4.6.x to 4.6.6

Sorry, I missed that the force fm also had a minus sign in it. So indeed the sign is incorrect!

#4 Updated by Berk Hess about 3 years ago

  • Status changed from Fix uploaded to Resolved
  • % Done changed from 0 to 100

#5 Updated by Erik Lindahl about 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF