Merge remote-tracking branch 'origin/release-5-1' into master
[alexxy/gromacs.git] / src / gromacs / gmxana / gmx_tune_pme.cpp
index c8143b159feb2d745414c4dfbd2d6e6705d9cad9..eaf69856ba4e3ba12cbd088073ed81f8b2556ba0 100644 (file)
@@ -1415,6 +1415,8 @@ static void make_sure_it_runs(char *mdrun_cmd_line, int length, FILE *fp,
     remove_if_exists(opt2fn("-be", nfile, fnm));
     remove_if_exists(opt2fn("-bcpo", nfile, fnm));
     remove_if_exists(opt2fn("-bg", nfile, fnm));
+    remove_if_exists(opt2fn("-bo", nfile, fnm));
+    remove_if_exists(opt2fn("-bx", nfile, fnm));
 
     sfree(command);
     sfree(msg    );
@@ -1940,7 +1942,8 @@ static void create_command_line_snippets(
         t_filenm  fnm[],
         char     *cmd_args_bench[],  /* command line arguments for benchmark runs */
         char     *cmd_args_launch[], /* command line arguments for simulation run */
-        char      extra_args[])      /* Add this to the end of the command line */
+        char      extra_args[],      /* Add this to the end of the command line */
+        char     *deffnm)            /* Default file names, or NULL if not set */
 {
     int         i;
     char       *opt;
@@ -1965,6 +1968,11 @@ static void create_command_line_snippets(
         add_to_string(cmd_args_bench, strbuf);
     }
     /* These switches take effect only at launch time */
+    if (deffnm)
+    {
+        sprintf(strbuf, "-deffnm %s ", deffnm);
+        add_to_string(cmd_args_launch, strbuf);
+    }
     if (FALSE == bAppendFiles)
     {
         add_to_string(cmd_args_launch, "-noappend ");
@@ -2201,6 +2209,7 @@ int gmx_tune_pme(int argc, char *argv[])
     char           *ExtraArgs      = NULL;
     char          **tpr_names      = NULL;
     const char     *simulation_tpr = NULL;
+    char           *deffnm         = NULL;
     int             best_npme, best_tpr;
     int             sim_part = 1; /* For benchmarks with checkpoint files */
     char            bbuf[STRLEN];
@@ -2354,6 +2363,8 @@ int gmx_tune_pme(int argc, char *argv[])
           "Append to previous output files when continuing from checkpoint instead of adding the simulation part number to all file names (for launch only)" },
         { "-cpnum",    FALSE, etBOOL, {&bKeepAndNumCPT},
           "Keep and number checkpoint files (launch only)" },
+        { "-deffnm",   FALSE, etSTR,  {&deffnm},
+          "Set the default filenames (launch only)" },
         { "-resethway", FALSE, etBOOL, {&bResetCountersHalfWay},
           "HIDDENReset the cycle counters after half the number of steps or halfway [TT]-maxh[tt] (launch only)" }
     };
@@ -2426,7 +2437,7 @@ int gmx_tune_pme(int argc, char *argv[])
     cmd_np = bbuf;
 
     create_command_line_snippets(bAppendFiles, bKeepAndNumCPT, bResetCountersHalfWay, presteps,
-                                 NFILE, fnm, &cmd_args_bench, &cmd_args_launch, ExtraArgs);
+                                 NFILE, fnm, &cmd_args_bench, &cmd_args_launch, ExtraArgs, deffnm);
 
     /* Prepare to use checkpoint file if requested */
     sim_part = 1;