Fixes issue with vsiten and Verlet buffers
authorBerk Hess <hess@kth.se>
Fri, 3 Oct 2014 12:00:38 +0000 (14:00 +0200)
committerBerk Hess <hess@kth.se>
Tue, 7 Oct 2014 17:23:01 +0000 (19:23 +0200)
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

index 64a79f753020fe105f857c9d359f385153a00a60..9b1967e44cf1c93e05c316c4165be7a1c4b81464 100644 (file)
@@ -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];