X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=blobdiff_plain;f=src%2Fgromacs%2Fgmxana%2Fgmx_tune_pme.c;h=c4a7e6e021b4769d6c1e6063fc8d48f38eb8c13f;hb=19d3c2e5d0c401eb59010960d11a18b6ba2c54c6;hp=a4378039327b2f23e842dc8ec5bb3c1ce79ae3cc;hpb=a349e4beffcbe43be945226384d2a590b27263f0;p=alexxy%2Fgromacs.git diff --git a/src/gromacs/gmxana/gmx_tune_pme.c b/src/gromacs/gmxana/gmx_tune_pme.c index a437803932..c4a7e6e021 100644 --- a/src/gromacs/gmxana/gmx_tune_pme.c +++ b/src/gromacs/gmxana/gmx_tune_pme.c @@ -32,35 +32,36 @@ * To help us fund GROMACS development, we humbly ask that you cite * the research papers on the package. Check out http://www.gromacs.org. */ -#ifdef HAVE_CONFIG_H -#include -#endif +#include "gmxpre.h" + +#include "config.h" +#include #include + #ifdef HAVE_SYS_TIME_H #include #endif #include "gromacs/commandline/pargs.h" -#include "typedefs.h" -#include "types/commrec.h" -#include "gromacs/utility/smalloc.h" -#include "vec.h" -#include "copyrite.h" #include "gromacs/fileio/tpxio.h" -#include "gromacs/utility/cstringutil.h" -#include "readinp.h" -#include "calcgrid.h" -#include "checkpoint.h" -#include "macros.h" -#include "gmx_ana.h" -#include "names.h" -#include "perf_est.h" -#include "inputrec.h" -#include "gromacs/timing/walltime_accounting.h" +#include "gromacs/gmxana/gmx_ana.h" +#include "gromacs/legacyheaders/calcgrid.h" +#include "gromacs/legacyheaders/checkpoint.h" +#include "gromacs/legacyheaders/inputrec.h" +#include "gromacs/legacyheaders/macros.h" +#include "gromacs/legacyheaders/names.h" +#include "gromacs/legacyheaders/perf_est.h" +#include "gromacs/legacyheaders/readinp.h" +#include "gromacs/legacyheaders/typedefs.h" +#include "gromacs/legacyheaders/types/commrec.h" #include "gromacs/math/utilities.h" - -#include "gmx_fatal.h" +#include "gromacs/math/vec.h" +#include "gromacs/timing/walltime_accounting.h" +#include "gromacs/utility/baseversion.h" +#include "gromacs/utility/cstringutil.h" +#include "gromacs/utility/fatalerror.h" +#include "gromacs/utility/smalloc.h" /* Enum for situations that can occur during log file parsing, the * corresponding string entries can be found in do_the_tests() in @@ -143,29 +144,6 @@ static void cleandata(t_perf *perfdata, int test_nr) } -static gmx_bool is_equal(real a, real b) -{ - real diff, eps = 1.0e-7; - - - diff = a - b; - - if (diff < 0.0) - { - diff = -diff; - } - - if (diff < eps) - { - return TRUE; - } - else - { - return FALSE; - } -} - - static void remove_if_exists(const char *fn) { if (gmx_fexist(fn)) @@ -553,8 +531,8 @@ static gmx_bool analyze_data( fprintf(fp, "\n"); /* Only mention settings if they were modified: */ - bRefinedCoul = !is_equal(info->rcoulomb[k_win], info->rcoulomb[0]); - bRefinedVdW = !is_equal(info->rvdw[k_win], info->rvdw[0] ); + bRefinedCoul = !gmx_within_tol(info->rcoulomb[k_win], info->rcoulomb[0], GMX_REAL_EPS); + bRefinedVdW = !gmx_within_tol(info->rvdw[k_win], info->rvdw[0], GMX_REAL_EPS); bRefinedGrid = !(info->nkx[k_win] == info->nkx[0] && info->nky[k_win] == info->nky[0] && info->nkz[k_win] == info->nkz[0]); @@ -616,25 +594,25 @@ static void get_program_paths(gmx_bool bThreads, char *cmd_mpirun[], char *cmd_m { if ( (cp = getenv("MPIRUN")) != NULL) { - *cmd_mpirun = strdup(cp); + *cmd_mpirun = gmx_strdup(cp); } else { - *cmd_mpirun = strdup(def_mpirun); + *cmd_mpirun = gmx_strdup(def_mpirun); } } else { - *cmd_mpirun = strdup(empty_mpirun); + *cmd_mpirun = gmx_strdup(empty_mpirun); } if ( (cp = getenv("MDRUN" )) != NULL) { - *cmd_mdrun = strdup(cp); + *cmd_mdrun = gmx_strdup(cp); } else { - *cmd_mdrun = strdup(def_mdrun); + *cmd_mdrun = gmx_strdup(def_mdrun); } } @@ -986,11 +964,11 @@ static void make_benchmark_tprs( { /* Determine which Coulomb radii rc to use in the benchmarks */ add = (rmax-rmin)/(*ntprs-1); - if (is_equal(rmin, info->rcoulomb[0])) + if (gmx_within_tol(rmin, info->rcoulomb[0], GMX_REAL_EPS)) { ir->rcoulomb = rmin + j*add; } - else if (is_equal(rmax, info->rcoulomb[0])) + else if (gmx_within_tol(rmax, info->rcoulomb[0], GMX_REAL_EPS)) { ir->rcoulomb = rmin + (j-1)*add; } @@ -1090,8 +1068,8 @@ static void make_benchmark_tprs( fprintf(fp, " %-14s\n", fn_bench_tprs[j]); /* Make it clear to the user that some additional settings were modified */ - if (!is_equal(ir->rvdw, info->rvdw[0]) - || !is_equal(ir->rlistlong, info->rlistlong[0]) ) + if (!gmx_within_tol(ir->rvdw, info->rvdw[0], GMX_REAL_EPS) + || !gmx_within_tol(ir->rlistlong, info->rlistlong[0], GMX_REAL_EPS) ) { bNote = TRUE; } @@ -1660,13 +1638,13 @@ static void check_input( /* Add test scenarios if rmin or rmax were set */ if (*ntprs <= 2) { - if (!is_equal(*rmin, rcoulomb) && (*ntprs == 1) ) + if (!gmx_within_tol(*rmin, rcoulomb, GMX_REAL_EPS) && (*ntprs == 1) ) { (*ntprs)++; fprintf(stderr, "NOTE: Setting -rmin to %g changed -ntpr to %d\n", *rmin, *ntprs); } - if (!is_equal(*rmax, rcoulomb) && (*ntprs == 1) ) + if (!gmx_within_tol(*rmax, rcoulomb, GMX_REAL_EPS) && (*ntprs == 1) ) { (*ntprs)++; fprintf(stderr, "NOTE: Setting -rmax to %g changed -ntpr to %d\n", @@ -1675,13 +1653,13 @@ static void check_input( } old = *ntprs; /* If one of rmin, rmax is set, we need 2 tpr files at minimum */ - if (!is_equal(*rmax, rcoulomb) || !is_equal(*rmin, rcoulomb) ) + if (!gmx_within_tol(*rmax, rcoulomb, GMX_REAL_EPS) || !gmx_within_tol(*rmin, rcoulomb, GMX_REAL_EPS) ) { *ntprs = max(*ntprs, 2); } /* If both rmin, rmax are set, we need 3 tpr files at minimum */ - if (!is_equal(*rmax, rcoulomb) && !is_equal(*rmin, rcoulomb) ) + if (!gmx_within_tol(*rmax, rcoulomb, GMX_REAL_EPS) && !gmx_within_tol(*rmin, rcoulomb, GMX_REAL_EPS) ) { *ntprs = max(*ntprs, 3); } @@ -1693,7 +1671,7 @@ static void check_input( if (*ntprs > 1) { - if (is_equal(*rmin, rcoulomb) && is_equal(rcoulomb, *rmax)) /* We have just a single rc */ + if (gmx_within_tol(*rmin, rcoulomb, GMX_REAL_EPS) && gmx_within_tol(rcoulomb, *rmax, GMX_REAL_EPS)) /* We have just a single rc */ { fprintf(stderr, "WARNING: Resetting -ntpr to 1 since no Coulomb radius scaling is requested.\n" "Please set rmin < rmax to test Coulomb radii in the [rmin, rmax] interval\n" @@ -2124,9 +2102,9 @@ int gmx_tune_pme(int argc, char *argv[]) /* g_tune_pme */ { efOUT, "-p", "perf", ffWRITE }, { efLOG, "-err", "bencherr", ffWRITE }, - { efTPX, "-so", "tuned", ffWRITE }, + { efTPR, "-so", "tuned", ffWRITE }, /* mdrun: */ - { efTPX, NULL, NULL, ffREAD }, + { efTPR, NULL, NULL, ffREAD }, { efTRN, "-o", NULL, ffWRITE }, { efCOMPRESSED, "-x", NULL, ffOPTWR }, { efCPT, "-cpi", NULL, ffOPTRD }, @@ -2399,7 +2377,8 @@ int gmx_tune_pme(int argc, char *argv[]) sep_line(fp); fprintf(fp, "\n P E R F O R M A N C E R E S U L T S\n"); sep_line(fp); - fprintf(fp, "%s for Gromacs %s\n", ShortProgram(), GromacsVersion()); + fprintf(fp, "%s for Gromacs %s\n", output_env_get_program_display_name(oenv), + gmx_version()); if (!bThreads) { fprintf(fp, "Number of ranks : %d\n", nnodes);