}
-/* 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, "-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))
}
+/* 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;
/* 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);