Incorrect dvdlambda : posres() in gmxlib/bondfree.c (4.6.* & 4.5.2+)
I think I found a simple (three year old) BUG in the line 2290 of gmxlib/bondfree.c (ver 4.6.5),
which should be
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)
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.