From: Berk Hess Date: Tue, 24 Jun 2014 14:10:31 +0000 (+0200) Subject: Fixed the sign of mass perturbed contribution X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=07f2d6a944a0059ce1acd15f1659574efe77c9d9;p=alexxy%2Fgromacs.git Fixed the sign of mass perturbed contribution Corrected the sign of the kinetic energy contribution to dHdl and dH. Fixes #1527. Change-Id: Ia1a2f708cdbba9a5a120a2ba8510cc2498f4d054 --- diff --git a/src/mdlib/update.c b/src/mdlib/update.c index d19d6015bb..0ffa5e3fde 100644 --- a/src/mdlib/update.c +++ b/src/mdlib/update.c @@ -1163,7 +1163,12 @@ static void calc_ke_part_visc(matrix box, rvec x[], rvec v[], } if (md->nPerturbed && md->bPerturbed[n]) { - dekindl += 0.5*(md->massB[n] - md->massA[n])*iprod(v_corrt, v_corrt); + /* The minus sign here might be confusing. + * The kinetic contribution from dH/dl doesn't come from + * d m(l)/2 v^2 / dl, but rather from d p^2/2m(l) / dl, + * where p are the momenta. The difference is only a minus sign. + */ + dekindl -= 0.5*(md->massB[n] - md->massA[n])*iprod(v_corrt, v_corrt); } } ekind->dekindl = dekindl;