Merge "g_sans - tool to compute SANS spectra" into release-4-6
authorDavid van der Spoel <davidvanderspoel@gmail.com>
Wed, 1 Feb 2012 16:28:33 +0000 (17:28 +0100)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Wed, 1 Feb 2012 16:28:33 +0000 (17:28 +0100)
src/kernel/convparm.c
src/kernel/toppush.c
src/tools/gmx_dist.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];
index e025c5ae9e5d171cb6079c22be5286d637c3870b..11a7e6c41adc50126d7dcbf16b84510750cd5d81 100644 (file)
@@ -77,7 +77,12 @@ int gmx_dist(int argc,char *argv[])
     "With options [TT]-lt[tt] and [TT]-dist[tt] the number of contacts",
     "of all atoms in group 2 that are closer than a certain distance",
     "to the center of mass of group 1 are plotted as a function of the time",
-    "that the contact was continuously present.[PAR]",
+    "that the contact was continuously present. The [TT]-intra[tt] switch enables",
+    "calculations of intramolecular distances avoiding distance calculation to its",
+    "periodic images. For a proper function, the molecule in the input trajectory",
+    "should be whole (e.g. by preprocessing with [TT]trjconv -pbc[tt]) or a matching",
+    "topology should be provided. The [TT]-intra[tt] switch will only give",
+    "meaningful results for intramolecular and not intermolecular distances.[PAR]",
     "Other programs that calculate distances are [TT]g_mindist[tt]",
     "and [TT]g_bond[tt]."
   };
@@ -100,7 +105,7 @@ int gmx_dist(int argc,char *argv[])
   rvec    *com;
   real    *mass;
   FILE    *fp=NULL,*fplt=NULL;
-  gmx_bool    bCutoff,bPrintDist,bLifeTime;
+  gmx_bool    bCutoff,bPrintDist,bLifeTime,bIntra=FALSE;
   t_pbc   *pbc;
   int     *contact_time=NULL,*ccount=NULL,ccount_nalloc=0,sum;
   char    buf[STRLEN];
@@ -111,7 +116,9 @@ int gmx_dist(int argc,char *argv[])
 
   static real cut=0;
   
-  static t_pargs pa[] = {
+  t_pargs pa[] = {
+    { "-intra",      FALSE, etBOOL, {&bIntra},
+      "Calculate distances without considering periodic boundaries, e.g. intramolecular." },
     { "-dist",      FALSE, etREAL, {&cut},
       "Print all atoms in group 2 closer than dist to the center of mass of group 1" }
   };
@@ -209,7 +216,7 @@ int gmx_dist(int argc,char *argv[])
       /* write to output */
       fprintf(fp,"%12.7f ",t);
       for(g=0;(g<ngrps/2);g++) {
-       if (pbc)
+       if (pbc && (!bIntra))
          pbc_dx(pbc,com[2*g],com[2*g+1],dx);
        else
          rvec_sub(com[2*g],com[2*g+1],dx);
@@ -221,7 +228,7 @@ int gmx_dist(int argc,char *argv[])
     } else {
       for(i=0;(i<isize[1]);i++) { 
        j=index[1][i];
-       if (pbc)
+       if (pbc && (!bIntra))
          pbc_dx(pbc,x[j],com[0],dx);
        else
          rvec_sub(x[j],com[0],dx);