From f2007baaf33978684bde92ecc1b43f57d6525666 Mon Sep 17 00:00:00 2001 From: Berk Hess Date: Fri, 3 Oct 2014 14:00:38 +0200 Subject: [PATCH] Fixes issue with vsiten and Verlet buffers Commit 0336ab2d only fixed part of the vsiten issue in the Verlet buffer calculation code. Parameters were read from incorrect memory locations, which could lead to a segmentation fault or incorrect masses for vsiten particles. It unlikely that this affected results. Part of #1579. Change-Id: I76cdb94e34194d2f6d49d98a49486ce1df76d91a --- src/kernel/calc_verletbuf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/kernel/calc_verletbuf.c b/src/kernel/calc_verletbuf.c index 64a79f7530..9b1967e44c 100644 --- a/src/kernel/calc_verletbuf.c +++ b/src/kernel/calc_verletbuf.c @@ -210,8 +210,8 @@ static void get_vsite_masses(const gmx_moltype_t *moltype, for (i = 0; i < il->nr; i += 1+NRAL(ft)) { const t_iparams *ip; - real cam[5], inv_mass, m_aj; - int a1, j, aj, coeff; + real cam[5], inv_mass, coeff, m_aj; + int a1, j, aj; ip = &ffparams->iparams[il->iatoms[i]]; @@ -249,10 +249,10 @@ static void get_vsite_masses(const gmx_moltype_t *moltype, case F_VSITEN: /* Exact */ inv_mass = 0; - for (j = 0; j < 3*ip->vsiten.n; j += 3) + for (j = 0; j < 3*ffparams->iparams[il->iatoms[i]].vsiten.n; j += 3) { aj = il->iatoms[i+j+2]; - coeff = ip[il->iatoms[i+j]].vsiten.a; + coeff = ffparams->iparams[il->iatoms[i+j]].vsiten.a; if (moltype->atoms.atom[aj].ptype == eptVSite) { m_aj = vsite_m[aj]; -- 2.22.0