Merge remote-tracking branch 'gerrit/release-4-5-patches' into release-4-6
authorRoland Schulz <roland@utk.edu>
Mon, 26 Dec 2011 14:06:22 +0000 (09:06 -0500)
committerRoland Schulz <roland@utk.edu>
Mon, 26 Dec 2011 14:06:22 +0000 (09:06 -0500)
Conflicts:
src/tools/gmx_tune_pme.c

Change-Id: I0cb93d965cd30a6d0e158eac595fac7c8b891492

1  2 
src/tools/gmx_tune_pme.c

diff --combined src/tools/gmx_tune_pme.c
index fe7528170b05221176a0725c3416600bfb62c9d6,b017b4bf5806f5f6a1c9e7a6038bfd3b153c65dd..ce6441e90fed2d99de0cf7591a55a440e78b8720
@@@ -1149,22 -1149,6 +1149,6 @@@ static void make_benchmark_tprs
  }
  
  
- /* Whether these files are written depends on tpr (or mdp) settings,
-  * not on mdrun command line options! */
- static gmx_bool tpr_triggers_file(const char *opt)
- {
-     if ( (0 == strcmp(opt, "-ro"))
-       || (0 == strcmp(opt, "-ra"))
-       || (0 == strcmp(opt, "-rt"))
-       || (0 == strcmp(opt, "-rs"))
-       || (0 == strcmp(opt, "-pf"))
-       || (0 == strcmp(opt, "-px")) )
-         return TRUE;
-     else
-         return FALSE;
- }
  /* Rename the files we want to keep to some meaningful filename and
   * delete the rest */
  static void cleanup(const t_filenm *fnm, int nfile, int k, int nnodes, 
              }
          }
          /* Delete the files which are created for each benchmark run: (options -b*) */
-         else if ( ( (0 == strncmp(opt, "-b", 2)) && (opt2bSet(opt,nfile,fnm) || !is_optional(&fnm[i])) ) 
-                   || tpr_triggers_file(opt) )
+         else if ( (0 == strncmp(opt, "-b", 2)) && (opt2bSet(opt,nfile,fnm) || !is_optional(&fnm[i])) )
          {
              fn = opt2fn(opt, nfile, fnm);
              if (gmx_fexist(fn))
@@@ -1943,6 -1926,49 +1926,49 @@@ static void setopt(const char *opt,int 
  }
  
  
+ /* This routine checks for output files that get triggered by a tpr option.
+  * These output files are marked as set to allow for proper cleanup after 
+  * each tuning run. */
+ static void get_tpr_outfiles(int nfile, t_filenm fnm[])
+ {
+     gmx_bool     bPull;     /* Is pulling requested in .tpr file?             */
+     gmx_bool     bTpi;      /* Is test particle insertion requested?          */
+     gmx_bool     bFree;     /* Is a free energy simulation requested?         */
+     gmx_bool     bNM;       /* Is a normal mode analysis requested?           */
+     t_inputrec   ir;
+     t_state      state;
+     gmx_mtop_t   mtop;
+     /* Check tpr file for options that trigger extra output files */
+     read_tpx_state(opt2fn("-s",nfile,fnm),&ir,&state,NULL,&mtop);
+     bPull = (epullNO != ir.ePull);
+     bFree = (efepNO  != ir.efep );
+     bNM   = (eiNM    == ir.eI   );
+     bTpi  = EI_TPI(ir.eI);
+     /* Set these output files on the tuning command-line */
+     if (bPull)
+     {
+         setopt("-pf"  , nfile, fnm);
+         setopt("-px"  , nfile, fnm);
+     }
+     if (bFree)
+     {
+         setopt("-dhdl", nfile, fnm);
+     }
+     if (bTpi)
+     {
+         setopt("-tpi" , nfile, fnm);
+         setopt("-tpid", nfile, fnm);
+     }
+     if (bNM)
+     {
+         setopt("-mtx" , nfile, fnm);
+     }
+ }
  static void couple_files_options(int nfile, t_filenm fnm[])
  {
      int i;
@@@ -2112,10 -2138,6 +2138,10 @@@ int gmx_tune_pme(int argc,char *argv[]
        { efXVG, "-runav",  "runaver",  ffOPTWR },
        { efXVG, "-px",     "pullx",    ffOPTWR },
        { efXVG, "-pf",     "pullf",    ffOPTWR },
 +      { efXVG, "-ro",     "rotation", ffOPTWR },
 +      { efLOG, "-ra",     "rotangles",ffOPTWR },
 +      { efLOG, "-rs",     "rotslabs", ffOPTWR },
 +      { efLOG, "-rt",     "rottorque",ffOPTWR },
        { efMTX, "-mtx",    "nm",       ffOPTWR },
        { efNDX, "-dn",     "dipole",   ffOPTWR },
        /* Output files that are deleted after each benchmark run */
        { efXVG, "-brunav", "benchrnav",ffOPTWR },
        { efXVG, "-bpx",    "benchpx",  ffOPTWR },
        { efXVG, "-bpf",    "benchpf",  ffOPTWR },
 +      { efXVG, "-bro",    "benchrot", ffOPTWR },
 +      { efLOG, "-bra",    "benchrota",ffOPTWR },
 +      { efLOG, "-brs",    "benchrots",ffOPTWR },
 +      { efLOG, "-brt",    "benchrott",ffOPTWR },
        { efMTX, "-bmtx",   "benchn",   ffOPTWR },
        { efNDX, "-bdn",    "bench",    ffOPTWR }
      };
          /* and now we just set this; a bit of an ugly hack*/
          nnodes=nthreads;
      }
+     /* tpr-triggered output files */
+     get_tpr_outfiles(NFILE,fnm);
      /* Automatically set -beo options if -eo is set etc. */
      couple_files_options(NFILE,fnm);