From: Carsten Kutzner Date: Mon, 19 Dec 2011 14:42:29 +0000 (+0100) Subject: Added -dhdl to tpr file list, fixes #855 X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=d98563ba48f502cef8dd5509fafb5e76e0286503;p=alexxy%2Fgromacs.git Added -dhdl to tpr file list, fixes #855 Change-Id: I2621c7bb44daa01e25831e2d44c22cdcf47f58e7 --- diff --git a/src/tools/gmx_tune_pme.c b/src/tools/gmx_tune_pme.c index 5e00f8351d..b017b4bf58 100644 --- a/src/tools/gmx_tune_pme.c +++ b/src/tools/gmx_tune_pme.c @@ -1149,18 +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, "-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, @@ -1222,8 +1210,7 @@ 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)) @@ -1939,6 +1926,49 @@ static void setopt(const char *opt,int nfile,t_filenm fnm[]) } +/* 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; @@ -2309,6 +2339,9 @@ int gmx_tune_pme(int argc,char *argv[]) /* 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);