From 124f95d15239cf78eb666ec7cacd453b2b99e5e6 Mon Sep 17 00:00:00 2001 From: Mark Abraham Date: Sat, 10 Dec 2016 14:59:27 +1100 Subject: [PATCH] Removed support for multiple entries in mdp files This was never used. Refs #2074 Change-Id: If97800cc75b809080abb407ec3f9a885c8f95b5c --- src/gromacs/fileio/readinp.cpp | 78 ++++++++-------------------------------- src/gromacs/mdtypes/md_enums.cpp | 4 --- src/gromacs/mdtypes/md_enums.h | 7 ---- 3 files changed, 15 insertions(+), 74 deletions(-) diff --git a/src/gromacs/fileio/readinp.cpp b/src/gromacs/fileio/readinp.cpp index 413f54dd56..cc99641485 100644 --- a/src/gromacs/fileio/readinp.cpp +++ b/src/gromacs/fileio/readinp.cpp @@ -46,7 +46,6 @@ #include "gromacs/fileio/gmxfio.h" #include "gromacs/fileio/warninp.h" -#include "gromacs/mdtypes/md_enums.h" #include "gromacs/utility/binaryinformation.h" #include "gromacs/utility/cstringutil.h" #include "gromacs/utility/exceptions.h" @@ -65,8 +64,6 @@ t_inpfile *read_inpfile(const char *fn, int *ninp, char *ptr, *cptr; t_inpfile *inp = NULL; int nin, lc, i, j, k; - /* setting cppopts from command-line options would be cooler */ - gmx_bool allow_override = FALSE; if (debug) @@ -141,71 +138,26 @@ t_inpfile *read_inpfile(const char *fn, int *ninp, } else { - /* Now finally something sensible */ - int found_index; + /* Now finally something sensible; check for duplicates */ + int found_index = search_einp(nin, inp, lbuf); - /* first check whether we hit the 'multiple_entries' option */ - if (gmx_strcasecmp_min(eMultentOpt_names[eMultentOptName], lbuf) == 0) + if (found_index == -1) { - /* we now check whether to allow overrides from here or not */ - if (gmx_strcasecmp_min(eMultentOpt_names[eMultentOptNo], rbuf) == 0) - { - allow_override = FALSE; - } - else if (gmx_strcasecmp_min(eMultentOpt_names[eMultentOptLast], rbuf) == 0) - { - allow_override = TRUE; - } - else - { - sprintf(warn_buf, - "Parameter \"%s\" should either be %s or %s\n", - lbuf, - eMultentOpt_names[eMultentOptNo], - eMultentOpt_names[eMultentOptLast]); - warning_error(wi, warn_buf); - } + /* add a new item */ + srenew(inp, ++nin); + inp[nin-1].inp_count = 1; + inp[nin-1].count = 0; + inp[nin-1].bObsolete = FALSE; + inp[nin-1].bSet = FALSE; + inp[nin-1].name = gmx_strdup(lbuf); + inp[nin-1].value = gmx_strdup(rbuf); } else { - /* it is a regular option; check for duplicates */ - found_index = search_einp(nin, inp, lbuf); - - if (found_index == -1) - { - /* add a new item */ - srenew(inp, ++nin); - inp[nin-1].inp_count = 1; - inp[nin-1].count = 0; - inp[nin-1].bObsolete = FALSE; - inp[nin-1].bSet = FALSE; - inp[nin-1].name = gmx_strdup(lbuf); - inp[nin-1].value = gmx_strdup(rbuf); - } - else - { - if (!allow_override) - { - sprintf(warn_buf, - "Parameter \"%s\" doubly defined (and multiple assignments not allowed)\n", - lbuf); - warning_error(wi, warn_buf); - } - else - { - /* override */ - if (!inp) - { - gmx_fatal(FARGS, "Internal inconsistency; inp[] base pointer is NULL"); - } - sfree(inp[found_index].value); - inp[found_index].value = gmx_strdup(rbuf); - sprintf(warn_buf, - "Overriding existing parameter \"%s\" with value \"%s\"\n", - lbuf, rbuf); - warning_note(wi, warn_buf); - } - } + sprintf(warn_buf, + "Parameter \"%s\" doubly defined\n", + lbuf); + warning_error(wi, warn_buf); } } } diff --git a/src/gromacs/mdtypes/md_enums.cpp b/src/gromacs/mdtypes/md_enums.cpp index b3d27edbbf..2b6eb86c62 100644 --- a/src/gromacs/mdtypes/md_enums.cpp +++ b/src/gromacs/mdtypes/md_enums.cpp @@ -247,10 +247,6 @@ const char *eQMMMscheme_names[eQMMMschemeNR+1] = { "normal", "ONIOM", nullptr }; -const char *eMultentOpt_names[eMultentOptNR+1] = { - "multiple_entries", "no", "use_last", nullptr -}; - const char *gmx_nblist_geometry_names[GMX_NBLIST_GEOMETRY_NR+1] = { "Particle-Particle", "Water3-Particle", "Water3-Water3", "Water4-Particle", "Water4-Water4", "CG-CG", nullptr }; diff --git a/src/gromacs/mdtypes/md_enums.h b/src/gromacs/mdtypes/md_enums.h index c0c3baa78d..e2a016e48d 100644 --- a/src/gromacs/mdtypes/md_enums.h +++ b/src/gromacs/mdtypes/md_enums.h @@ -606,13 +606,6 @@ extern const char *eQMMMscheme_names[eQMMMschemeNR+1]; //! Macro to pick QMMMM scheme name #define EQMMMSCHEME(e) enum_name(e, eQMMMschemeNR, eQMMMscheme_names) -//! Internal stuff for multiple value options in mdp files -enum { - eMultentOptName, eMultentOptNo, eMultentOptLast, eMultentOptNR -}; -//! Multiple value option names -extern const char *eMultentOpt_names[eMultentOptNR+1]; - /*! \brief Neighborlist geometry type. * * Kernels will compute interactions between two particles, -- 2.11.4.GIT