Changed order of parameters in top file
authorDavid van der Spoel <spoel@xray.bmc.uu.se>
Tue, 31 Jan 2012 15:39:34 +0000 (16:39 +0100)
committerDavid van der Spoel <spoel@xray.bmc.uu.se>
Tue, 31 Jan 2012 15:39:34 +0000 (16:39 +0100)
For linear angles. Now the distance parameter comes
first, and then the force constant, like in other
bonded potentials. In addition, the angle defined by
the same atom types but with the opposite order of
atoms now gets a modified constant (1-a).

Change-Id: I6db408be01b0cbb795edaa9943b72dbe149e3f97

src/kernel/convparm.c
src/kernel/toppush.c

index 1898c24945d3b9f63fe7694fd982e2554d4756a5..bc161b5d8c98eccc8529cb4d1228452af97be13e 100644 (file)
@@ -160,10 +160,10 @@ static void assign_param(t_functype ftype,t_iparams *newparam,
       newparam->qangle.c[i]=old[i+1];
     break;
   case F_LINEAR_ANGLES:
-    newparam->linangle.klinA = old[0];
-    newparam->linangle.aA    = old[1];
-    newparam->linangle.klinB = old[2];
-    newparam->linangle.aB    = old[3];
+    newparam->linangle.aA    = old[0];
+    newparam->linangle.klinA = old[1];
+    newparam->linangle.aB    = old[2];
+    newparam->linangle.klinB = old[3];
     break;
   case F_ANGLES:
   case F_BONDS:
index c5192aaee8a12b5c13019a3b9af2620bdc92aba0..eabb245ce43dd30c30a587403745c5be2b94d8f8 100644 (file)
@@ -547,7 +547,17 @@ static void push_bondtype(t_params *       bt,
         memcpy(bt->param[bt->nr].c,  b->c,sizeof(b->c));
         memcpy(bt->param[bt->nr].a,  b->a,sizeof(b->a));
         memcpy(bt->param[bt->nr+1].c,b->c,sizeof(b->c));
-        
+
+        /* The definitions of linear angles depend on the order of atoms,
+         * that means that for atoms i-j-k, with certain parameter a, the
+         * corresponding k-j-i angle will have parameter 1-a.
+         */        
+        if (ftype == F_LINEAR_ANGLES) 
+        {
+            bt->param[bt->nr+1].c[0] = 1-bt->param[bt->nr+1].c[0];
+            bt->param[bt->nr+1].c[2] = 1-bt->param[bt->nr+1].c[2];
+        }
+                
         for (j=0; (j < nral); j++) 
                {
             bt->param[bt->nr+1].a[j] = b->a[nral-1-j];