Fix ref error in constraint pull code
authorRoland Schulz <roland@utk.edu>
Wed, 14 May 2014 22:08:16 +0000 (18:08 -0400)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Thu, 19 Jun 2014 20:14:55 +0000 (22:14 +0200)
With multiple pull constraints, the convergence check would use
the reference distance of the last constraint for all constraints.

Change-Id: Ic15d5dd618acc6d3aa5ca0f1e009c6f8096ed0d1

src/mdlib/pull.c

index a06f7440aa6baf65bb1a8bbe9182f80f969a42e1..ce5961e86546e9cf846f903d8499038d039e0a68 100644 (file)
@@ -688,6 +688,21 @@ static void do_constraint(t_pull *pull, t_mdatoms *md, t_pbc *pbc,
         {
             pgrp = &pull->grp[g];
 
+            if (pull->eGeom == epullgPOS)
+            {
+                for (m = 0; m < DIM; m++)
+                {
+                    ref[m] = pgrp->init[m] + pgrp->rate*t*pgrp->vec[m];
+                }
+            }
+            else
+            {
+                ref[0] = pgrp->init[0] + pgrp->rate*t;
+                /* Keep the compiler happy */
+                ref[1] = 0;
+                ref[2] = 0;
+            }
+
             get_pullgrps_dr(pull, pbc, g, t, rinew[g], rjnew[PULL_CYL(pull) ? g : 0],
                             -1, unc_ij);