grompp now retains the order of bonds converted to constraints
authorBerk Hess <hess@kth.se>
Mon, 21 May 2012 17:07:09 +0000 (19:07 +0200)
committerBerk Hess <hess@kth.se>
Mon, 21 May 2012 17:07:09 +0000 (19:07 +0200)
With the constraint mdp option grompp used to write tpr files where
the order of the constraints was reversed with respect to the order
of the bonds. This reordering has been removed.

Change-Id: I094c5001ccad1e80f46b61c4fbcfa400fd5c1e74

src/kernel/topshake.c

index 4094559d9c363ba6af837a7cd3584ea96d3b010b..78961c5ea8cb5e98b5a1ea9350be032504e8c7dd 100644 (file)
@@ -193,7 +193,8 @@ void make_shake (t_params plist[],t_atoms *atoms,gpp_atomtype_t at,int nshake)
     for (ftype=0; (ftype < F_NRE); ftype++) {
       if (interaction_function[ftype].flags & IF_BTYPE) {
        pr = &(plist[ftype]);
-       for (i=0; (i < pr->nr); ) {
+        j = 0;
+       for(i=0; i<pr->nr; i++) {
          if ( (nshake != eshHBONDS) || 
               (count_hydrogens (info,2,pr->param[i].a) > 0) ) {
            /* append this bond to the shake list */
@@ -202,16 +203,11 @@ void make_shake (t_params plist[],t_atoms *atoms,gpp_atomtype_t at,int nshake)
            p.C0 = pr->param[i].C0;
            p.C1 = pr->param[i].C2;
            add_param_to_list (&(plist[F_CONSTR]),&p);
-           
-           /* move the last bond to this position */
-           copy_bond (pr,i,pr->nr-1);
-           
-           /* should free memory here!! */
-           pr->nr--;
+         } else {
+             copy_bond(pr,j++,i); 
          }
-         else
-           i++;
        }
+       pr->nr = j;
       }
     }
   }