From 2992f54ab9c2d3f64f1068d5029da71dc0872685 Mon Sep 17 00:00:00 2001 From: David van der Spoel Date: Wed, 14 Oct 2015 22:18:14 +0200 Subject: [PATCH] Replaced NOTSET from typedefs.h by local solutions. In a continuing effort to get rid of typedefs.h here the dependence on typedefs.h for the NOTSET variable is removed. In gmxpreprocess a local files notset.h defines NOTSET as an int and to make this work all references to typedefs.h were removed from the header files. Of course this does not change the crappy logic of assigning a value to an int and hope that it will not turn out to be a valid number. Change-Id: Ic598b5a6c9e71106a37d2679aa7522b5ada44247 --- src/gromacs/fileio/groio.cpp | 13 +++++---- src/gromacs/fileio/pdbio.cpp | 34 ++++++++++++++-------- src/gromacs/fileio/tpxio.cpp | 2 +- src/gromacs/fileio/trxio.cpp | 8 +++-- src/gromacs/gmxana/gmx_confrms.cpp | 2 ++ src/gromacs/gmxana/gmx_energy.cpp | 1 + src/gromacs/gmxana/gmx_hbond.cpp | 2 ++ src/gromacs/gmxana/gmx_make_ndx.cpp | 5 ++-- src/gromacs/gmxana/gmx_mindist.cpp | 9 +++--- src/gromacs/gmxana/gmx_rmsdist.cpp | 11 ++++--- src/gromacs/gmxana/gmx_trjcat.cpp | 25 +++++++++++----- src/gromacs/gmxana/gmx_trjconv.cpp | 12 ++++---- src/gromacs/gmxana/gmx_xpm2ps.cpp | 4 +-- src/gromacs/gmxpreprocess/add_par.cpp | 2 +- src/gromacs/gmxpreprocess/add_par.h | 3 +- src/gromacs/gmxpreprocess/calch.cpp | 1 + src/gromacs/gmxpreprocess/calch.h | 2 +- src/gromacs/gmxpreprocess/convparm.h | 4 ++- src/gromacs/gmxpreprocess/gen_ad.cpp | 1 + src/gromacs/gmxpreprocess/gen_ad.h | 1 - .../gmxpreprocess/gen_maxwell_velocities.cpp | 3 +- src/gromacs/gmxpreprocess/gen_maxwell_velocities.h | 7 ++++- src/gromacs/gmxpreprocess/gen_vsite.cpp | 4 +++ src/gromacs/gmxpreprocess/gen_vsite.h | 2 +- src/gromacs/gmxpreprocess/genhydro.cpp | 1 + src/gromacs/gmxpreprocess/gpp_atomtype.cpp | 2 ++ src/gromacs/gmxpreprocess/gpp_atomtype.h | 3 +- src/gromacs/gmxpreprocess/gpp_bond_atomtype.cpp | 1 + src/gromacs/gmxpreprocess/gpp_bond_atomtype.h | 2 -- src/gromacs/gmxpreprocess/grompp-impl.h | 10 ++++++- src/gromacs/gmxpreprocess/grompp.cpp | 1 + src/gromacs/gmxpreprocess/h_db.cpp | 1 + src/gromacs/gmxpreprocess/hackblock.cpp | 1 + src/gromacs/gmxpreprocess/hackblock.h | 2 -- src/gromacs/gmxpreprocess/nm2type.cpp | 1 + src/gromacs/gmxpreprocess/{tomorse.h => notset.h} | 17 ++++------- src/gromacs/gmxpreprocess/pdb2top.cpp | 1 + src/gromacs/gmxpreprocess/pdb2top.h | 1 - src/gromacs/gmxpreprocess/pgutil.cpp | 1 + src/gromacs/gmxpreprocess/pgutil.h | 7 ++++- src/gromacs/gmxpreprocess/readir.h | 4 ++- src/gromacs/gmxpreprocess/resall.cpp | 1 + src/gromacs/gmxpreprocess/resall.h | 1 - src/gromacs/gmxpreprocess/ter_db.cpp | 1 + src/gromacs/gmxpreprocess/tomorse.h | 1 - src/gromacs/gmxpreprocess/topio.h | 3 +- src/gromacs/gmxpreprocess/toppush.cpp | 1 + src/gromacs/gmxpreprocess/toppush.h | 1 - src/gromacs/gmxpreprocess/topshake.cpp | 1 + src/gromacs/gmxpreprocess/toputil.cpp | 2 ++ src/gromacs/gmxpreprocess/vsite_parm.cpp | 1 + src/gromacs/gmxpreprocess/vsite_parm.h | 3 +- src/gromacs/gmxpreprocess/x2top.cpp | 1 + src/gromacs/legacyheaders/typedefs.h | 2 +- src/gromacs/tools/check.cpp | 9 ++++-- src/gromacs/topology/atoms.h | 2 +- src/gromacs/topology/index.cpp | 28 +++++++++--------- src/gromacs/topology/index.h | 9 +++++- src/gromacs/topology/invblock.h | 8 ----- 59 files changed, 180 insertions(+), 109 deletions(-) copy src/gromacs/gmxpreprocess/{tomorse.h => notset.h} (76%) diff --git a/src/gromacs/fileio/groio.cpp b/src/gromacs/fileio/groio.cpp index fe320792a6..6d2435df65 100644 --- a/src/gromacs/fileio/groio.cpp +++ b/src/gromacs/fileio/groio.cpp @@ -88,12 +88,12 @@ static gmx_bool get_w_conf(FILE *in, const char *infile, char *title, double x1, y1, z1, x2, y2, z2; rvec xmin, xmax; int natoms, i, m, resnr, newres, oldres, ddist, c; - gmx_bool bFirst, bVel; + gmx_bool bFirst, bVel, oldResFirst; char *p1, *p2, *p3; - newres = -1; - oldres = -12345; /* Unlikely number for the first residue! */ - ddist = 0; + newres = -1; + oldResFirst = FALSE; + ddist = 0; /* Read the title and number of atoms */ get_coordnum_fp(in, title, &natoms); @@ -165,9 +165,10 @@ static gmx_bool get_w_conf(FILE *in, const char *infile, char *title, sscanf(name, "%d", &resnr); sscanf(line+5, "%5s", resname); - if (resnr != oldres || strncmp(resname, oldresname, sizeof(resname))) + if (!oldResFirst || oldres != resnr || strncmp(resname, oldresname, sizeof(resname))) { - oldres = resnr; + oldres = resnr; + oldResFirst = TRUE; newres++; if (newres >= natoms) { diff --git a/src/gromacs/fileio/pdbio.cpp b/src/gromacs/fileio/pdbio.cpp index f742a9b0b8..07529f7636 100644 --- a/src/gromacs/fileio/pdbio.cpp +++ b/src/gromacs/fileio/pdbio.cpp @@ -45,7 +45,6 @@ #include "gromacs/fileio/gmxfio.h" #include "gromacs/legacyheaders/copyrite.h" -#include "gromacs/legacyheaders/typedefs.h" #include "gromacs/legacyheaders/types/ifunc.h" #include "gromacs/math/units.h" #include "gromacs/math/vec.h" @@ -521,25 +520,27 @@ void get_pdb_atomnumber(t_atoms *atoms, gmx_atomprop_t aps) { std::strcpy(anm, atoms->pdbinfo[i].atomnm); std::strcpy(anm_copy, atoms->pdbinfo[i].atomnm); + bool atomNumberSet = false; len = strlen(anm); - atomnumber = NOTSET; if ((anm[0] != ' ') && ((len <= 2) || ((len > 2) && !std::isdigit(anm[2])))) { anm_copy[2] = nc; if (gmx_atomprop_query(aps, epropElement, "???", anm_copy, &eval)) { - atomnumber = std::round(eval); + atomnumber = std::round(eval); + atomNumberSet = true; } else { anm_copy[1] = nc; if (gmx_atomprop_query(aps, epropElement, "???", anm_copy, &eval)) { - atomnumber = std::round(eval); + atomnumber = std::round(eval); + atomNumberSet = true; } } } - if (atomnumber == NOTSET) + if (!atomNumberSet) { k = 0; while ((k < std::strlen(anm)) && (std::isspace(anm[k]) || std::isdigit(anm[k]))) @@ -550,16 +551,25 @@ void get_pdb_atomnumber(t_atoms *atoms, gmx_atomprop_t aps) anm_copy[1] = nc; if (gmx_atomprop_query(aps, epropElement, "???", anm_copy, &eval)) { - atomnumber = std::round(eval); + atomnumber = std::round(eval); + atomNumberSet = true; } } - atoms->atom[i].atomnumber = atomnumber; - ptr = gmx_atomprop_element(aps, atomnumber); - std::strncpy(atoms->atom[i].elem, ptr == NULL ? "" : ptr, 4); - if (debug) + if (atomNumberSet) { - fprintf(debug, "Atomnumber for atom '%s' is %d\n", anm, atomnumber); + atoms->atom[i].atomnumber = atomnumber; + ptr = gmx_atomprop_element(aps, atomnumber); + if (debug) + { + fprintf(debug, "Atomnumber for atom '%s' is %d\n", + anm, atomnumber); + } } + else + { + ptr = NULL; + } + std::strncpy(atoms->atom[i].elem, ptr == NULL ? "" : ptr, 4); } } @@ -598,7 +608,7 @@ static int read_atom(t_symtab *symtab, anm[k] = nc; std::strcpy(anm_copy, anm); rtrim(anm_copy); - atomnumber = NOTSET; + atomnumber = 0; trim(anm); altloc = line[j]; j++; diff --git a/src/gromacs/fileio/tpxio.cpp b/src/gromacs/fileio/tpxio.cpp index 62060c6a76..018c42f74d 100644 --- a/src/gromacs/fileio/tpxio.cpp +++ b/src/gromacs/fileio/tpxio.cpp @@ -2406,7 +2406,7 @@ static void do_atom(t_fileio *fio, t_atom *atom, int ngrp, gmx_bool bRead, } else if (bRead) { - atom->atomnumber = NOTSET; + atom->atomnumber = 0; } if (file_version < 23) { diff --git a/src/gromacs/fileio/trxio.cpp b/src/gromacs/fileio/trxio.cpp index d7dfbb324d..c7df906d59 100644 --- a/src/gromacs/fileio/trxio.cpp +++ b/src/gromacs/fileio/trxio.cpp @@ -702,7 +702,10 @@ static gmx_bool pdb_next_x(t_trxstatus *status, FILE *fp, t_trxframe *fr) t_atoms atoms; t_symtab *symtab; matrix boxpdb; - int ePBC, model_nr, na; + // Initiate model_nr to -1 rather than NOTSET. + // It is not worthwhile introducing extra variables in the + // read_pdbfile call to verify that a model_nr was read. + int ePBC, model_nr = -1, na; char title[STRLEN], *time; double dbl; @@ -710,7 +713,6 @@ static gmx_bool pdb_next_x(t_trxstatus *status, FILE *fp, t_trxframe *fr) atoms.atom = NULL; atoms.pdbinfo = NULL; /* the other pointers in atoms should not be accessed if these are NULL */ - model_nr = NOTSET; snew(symtab, 1); open_symtab(symtab); na = read_pdbfile(fp, title, &model_nr, &atoms, symtab, fr->x, &ePBC, boxpdb, TRUE, NULL); @@ -730,7 +732,7 @@ static gmx_bool pdb_next_x(t_trxstatus *status, FILE *fp, t_trxframe *fr) copy_mat(boxpdb, fr->box); } - if (model_nr != NOTSET) + if (model_nr != -1) { fr->bStep = TRUE; fr->step = model_nr; diff --git a/src/gromacs/gmxana/gmx_confrms.cpp b/src/gromacs/gmxana/gmx_confrms.cpp index aa049ed92c..2f85c65aea 100644 --- a/src/gromacs/gmxana/gmx_confrms.cpp +++ b/src/gromacs/gmxana/gmx_confrms.cpp @@ -60,6 +60,8 @@ #include "gromacs/utility/futil.h" #include "gromacs/utility/smalloc.h" +static const int NOTSET = -9368163; + void calc_rm_cm(int isize, atom_id index[], t_atoms *atoms, rvec x[], rvec xcm) { int i, d; diff --git a/src/gromacs/gmxana/gmx_energy.cpp b/src/gromacs/gmxana/gmx_energy.cpp index a931da703b..8bf51f4997 100644 --- a/src/gromacs/gmxana/gmx_energy.cpp +++ b/src/gromacs/gmxana/gmx_energy.cpp @@ -67,6 +67,7 @@ #include "gromacs/utility/smalloc.h" static real minthird = -1.0/3.0, minsixth = -1.0/6.0; +static const int NOTSET = -23451; typedef struct { real sum; diff --git a/src/gromacs/gmxana/gmx_hbond.cpp b/src/gromacs/gmxana/gmx_hbond.cpp index f415d04203..261353670a 100644 --- a/src/gromacs/gmxana/gmx_hbond.cpp +++ b/src/gromacs/gmxana/gmx_hbond.cpp @@ -79,6 +79,8 @@ const char *hxtypenames[NRHXTYPES] = {"n-n", "n-n+1", "n-n+2", "n-n+3", "n-n+4", "n-n+5", "n-n>6"}; #define MAXHH 4 +static const int NOTSET = -49297; + #ifdef GMX_OPENMP #define MASTER_THREAD_ONLY(threadNr) ((threadNr) == 0) #else diff --git a/src/gromacs/gmxana/gmx_make_ndx.cpp b/src/gromacs/gmxana/gmx_make_ndx.cpp index 28a70e1ca6..ce3427428f 100644 --- a/src/gromacs/gmxana/gmx_make_ndx.cpp +++ b/src/gromacs/gmxana/gmx_make_ndx.cpp @@ -59,8 +59,9 @@ */ #define MAXNAMES 1024 #define NAME_LEN 1024 +static const int NOTSET = -92637; -gmx_bool bCase = FALSE; +gmx_bool bCase = FALSE; static int or_groups(atom_id nr1, atom_id *at1, atom_id nr2, atom_id *at2, atom_id *nr, atom_id *at) @@ -290,7 +291,7 @@ static gmx_bool parse_string(char **string, int *nr, int ngrps, char **grpname) } } - return (*nr) != NOTSET; + return (*nr) != -1; } static int select_atomnumbers(char **string, t_atoms *atoms, atom_id n1, diff --git a/src/gromacs/gmxana/gmx_mindist.cpp b/src/gromacs/gmxana/gmx_mindist.cpp index ed71d1f4c0..d2e0f97696 100644 --- a/src/gromacs/gmxana/gmx_mindist.cpp +++ b/src/gromacs/gmxana/gmx_mindist.cpp @@ -598,20 +598,21 @@ void dist_plot(const char *fn, const char *afile, const char *dfile, int find_residues(t_atoms *atoms, int n, atom_id index[], atom_id **resindex) { int i; - int nres = 0, resnr, presnr; + int nres = 0, resnr, presnr = 0; + bool presFound = false; int *residx; /* build index of first atom numbers for each residue */ - presnr = NOTSET; snew(residx, atoms->nres+1); for (i = 0; i < n; i++) { resnr = atoms->atom[index[i]].resind; - if (resnr != presnr) + if (!presFound || resnr != presnr) { residx[nres] = i; nres++; - presnr = resnr; + presnr = resnr; + presFound = true; } } if (debug) diff --git a/src/gromacs/gmxana/gmx_rmsdist.cpp b/src/gromacs/gmxana/gmx_rmsdist.cpp index ccbdc41f9a..d5c03f8bf3 100644 --- a/src/gromacs/gmxana/gmx_rmsdist.cpp +++ b/src/gromacs/gmxana/gmx_rmsdist.cpp @@ -163,6 +163,7 @@ typedef struct { } t_noe_gr; typedef struct { + bool set; int rnr; char *nname; char *rname; @@ -195,6 +196,7 @@ static int read_equiv(const char *eq_fn, t_equiv ***equivptr) { /* this is not efficient, but I'm lazy (again) */ srenew(equiv[neq], na+1); + equiv[neq][na].set = true; equiv[neq][na].rnr = resnr-1; equiv[neq][na].rname = gmx_strdup(resname); equiv[neq][na].aname = gmx_strdup(atomname); @@ -208,7 +210,8 @@ static int read_equiv(const char *eq_fn, t_equiv ***equivptr) } /* make empty element as flag for end of array */ srenew(equiv[neq], na+1); - equiv[neq][na].rnr = NOTSET; + equiv[neq][na].set = false; + equiv[neq][na].rnr = 0; equiv[neq][na].rname = NULL; equiv[neq][na].aname = NULL; @@ -230,7 +233,7 @@ static void dump_equiv(FILE *out, int neq, t_equiv **equiv) for (i = 0; i < neq; i++) { fprintf(out, "%s", equiv[i][0].nname); - for (j = 0; equiv[i][j].rnr != NOTSET; j++) + for (j = 0; equiv[i][j].set; j++) { fprintf(out, " %d %s %s", equiv[i][j].rnr, equiv[i][j].rname, equiv[i][j].aname); @@ -251,7 +254,7 @@ static gmx_bool is_equiv(int neq, t_equiv **equiv, char **nname, for (i = 0; i < neq && !bFound; i++) { /* find first atom */ - for (j = 0; equiv[i][j].rnr != NOTSET && !bFound; j++) + for (j = 0; equiv[i][j].set && !bFound; j++) { bFound = ( equiv[i][j].rnr == rnr1 && std::strcmp(equiv[i][j].rname, rname1) == 0 && @@ -261,7 +264,7 @@ static gmx_bool is_equiv(int neq, t_equiv **equiv, char **nname, { /* find second atom */ bFound = FALSE; - for (j = 0; equiv[i][j].rnr != NOTSET && !bFound; j++) + for (j = 0; equiv[i][j].set && !bFound; j++) { bFound = ( equiv[i][j].rnr == rnr2 && std::strcmp(equiv[i][j].rname, rname2) == 0 && diff --git a/src/gromacs/gmxana/gmx_trjcat.cpp b/src/gromacs/gmxana/gmx_trjcat.cpp index 85961695b1..30971680fd 100644 --- a/src/gromacs/gmxana/gmx_trjcat.cpp +++ b/src/gromacs/gmxana/gmx_trjcat.cpp @@ -483,7 +483,8 @@ int gmx_trjcat(int argc, char *argv[]) gmx_bool bNewFile, bIndex, bWrite; int nfile_in, nfile_out, *cont_type; real *readtime, *timest, *settime; - real first_time = 0, lasttime = NOTSET, last_ok_t = -1, timestep; + real first_time = 0, lasttime, last_ok_t = -1, timestep; + gmx_bool lastTimeSet = FALSE; real last_frame_time, searchtime; int isize = 0, j; atom_id *index = NULL, imax; @@ -701,6 +702,7 @@ int gmx_trjcat(int argc, char *argv[]) } lasttime = fr.time; } + lastTimeSet = TRUE; bKeepLastAppend = TRUE; close_trj(status); trxout = open_trx(out_file, "a"); @@ -735,8 +737,9 @@ int gmx_trjcat(int argc, char *argv[]) gmx_fatal(FARGS, "Error seeking: attempted to seek to %f but got %f.", searchtime, fr.time); } - lasttime = fr.time; - fpos = gmx_fio_ftell(stfio); + lasttime = fr.time; + lastTimeSet = TRUE; + fpos = gmx_fio_ftell(stfio); close_trj(status); trxout = open_trx(out_file, "r+"); if (gmx_fio_seek(trx_get_fileio(trxout), fpos)) @@ -744,7 +747,10 @@ int gmx_trjcat(int argc, char *argv[]) gmx_fatal(FARGS, "Error seeking to append position."); } } - printf("\n Will append after %f \n", lasttime); + if (lastTimeSet) + { + printf("\n Will append after %f \n", lasttime); + } frout = fr; } /* Lets stitch up some files */ @@ -827,11 +833,13 @@ int gmx_trjcat(int argc, char *argv[]) bNewFile = TRUE; - printf("\n"); - if (lasttime != NOTSET) + if (!lastTimeSet) { - printf("lasttime %g\n", lasttime); + lasttime = 0; + lastTimeSet = true; } + printf("\n"); + printf("lasttime %g\n", lasttime); do { @@ -873,7 +881,8 @@ int gmx_trjcat(int argc, char *argv[]) { first_time = frout.time; } - lasttime = frout.time; + lasttime = frout.time; + lastTimeSet = TRUE; if (dt == 0 || bRmod(frout.time, first_time, dt)) { frame_out++; diff --git a/src/gromacs/gmxana/gmx_trjconv.cpp b/src/gromacs/gmxana/gmx_trjconv.cpp index d17a81132e..ef2bf12c8d 100644 --- a/src/gromacs/gmxana/gmx_trjconv.cpp +++ b/src/gromacs/gmxana/gmx_trjconv.cpp @@ -334,12 +334,12 @@ static void put_residue_com_in_box(int unitcell_enum, int ecenter, int natoms, t_atom atom[], int ePBC, matrix box, rvec x[]) { - atom_id i, j, res_start, res_end; - int d, presnr; - real m; - double mtot; - rvec box_center, com, new_com, shift; - + atom_id i, j, res_start, res_end; + int d, presnr; + real m; + double mtot; + rvec box_center, com, new_com, shift; + static const int NOTSET = -12347; calc_box_center(ecenter, box, box_center); presnr = NOTSET; diff --git a/src/gromacs/gmxana/gmx_xpm2ps.cpp b/src/gromacs/gmxana/gmx_xpm2ps.cpp index 410b16a612..aa411890e9 100644 --- a/src/gromacs/gmxana/gmx_xpm2ps.cpp +++ b/src/gromacs/gmxana/gmx_xpm2ps.cpp @@ -148,8 +148,8 @@ void get_params(const char *mpin, const char *mpout, t_psrec *psr) RTYPE("ticklinewidth", psr->ticklinewidth, psr->linewidth); RTYPE("zerolinewidth", psr->zerolinewidth, psr->ticklinewidth); ETYPE("x-lineat0value", psr->X.lineatzero, colors); - RTYPE("x-major", psr->X.major, NOTSET); - RTYPE("x-minor", psr->X.minor, NOTSET); + RTYPE("x-major", psr->X.major, 1); + RTYPE("x-minor", psr->X.minor, 1); RTYPE("x-firstmajor", psr->X.offset, 0.0); ETYPE("x-majorat0", psr->X.first, gmx_bools); RTYPE("x-majorticklen", psr->X.majorticklen, 8.0); diff --git a/src/gromacs/gmxpreprocess/add_par.cpp b/src/gromacs/gmxpreprocess/add_par.cpp index 9e34dcff2a..e8ace961c3 100644 --- a/src/gromacs/gmxpreprocess/add_par.cpp +++ b/src/gromacs/gmxpreprocess/add_par.cpp @@ -43,8 +43,8 @@ #include "gromacs/gmxpreprocess/grompp-impl.h" #include "gromacs/gmxpreprocess/hackblock.h" +#include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/toputil.h" -#include "gromacs/legacyheaders/typedefs.h" #include "gromacs/utility/cstringutil.h" #include "gromacs/utility/fatalerror.h" #include "gromacs/utility/smalloc.h" diff --git a/src/gromacs/gmxpreprocess/add_par.h b/src/gromacs/gmxpreprocess/add_par.h index 0ed13041fd..925a321f59 100644 --- a/src/gromacs/gmxpreprocess/add_par.h +++ b/src/gromacs/gmxpreprocess/add_par.h @@ -38,8 +38,9 @@ #ifndef GMX_GMXPREPROCESS_ADD_PAR_H #define GMX_GMXPREPROCESS_ADD_PAR_H +#include "gromacs/gmxpreprocess/grompp-impl.h" #include "gromacs/gmxpreprocess/pdb2top.h" -#include "gromacs/legacyheaders/typedefs.h" +#include "gromacs/utility/real.h" void add_param(t_params *ps, int ai, int aj, real *c, char *s); diff --git a/src/gromacs/gmxpreprocess/calch.cpp b/src/gromacs/gmxpreprocess/calch.cpp index 4b4b323368..97e288ff74 100644 --- a/src/gromacs/gmxpreprocess/calch.cpp +++ b/src/gromacs/gmxpreprocess/calch.cpp @@ -40,6 +40,7 @@ #include +#include "gromacs/gmxpreprocess/notset.h" #include "gromacs/math/units.h" #include "gromacs/math/utilities.h" #include "gromacs/math/vec.h" diff --git a/src/gromacs/gmxpreprocess/calch.h b/src/gromacs/gmxpreprocess/calch.h index 31cdeecd6e..dc86564c8c 100644 --- a/src/gromacs/gmxpreprocess/calch.h +++ b/src/gromacs/gmxpreprocess/calch.h @@ -37,7 +37,7 @@ #ifndef GMX_PREPROCESS_CALCH_H #define GMX_PREPROCESS_CALCH_H -#include "gromacs/legacyheaders/typedefs.h" +#include "gromacs/math/vectypes.h" void calc_h_pos(int nht, rvec xa[], rvec xh[], int *l); /* diff --git a/src/gromacs/gmxpreprocess/convparm.h b/src/gromacs/gmxpreprocess/convparm.h index 23f233cdba..78d84b296f 100644 --- a/src/gromacs/gmxpreprocess/convparm.h +++ b/src/gromacs/gmxpreprocess/convparm.h @@ -39,7 +39,9 @@ #define GMX_GMXPREPROCESS_CONVPARM_H #include "gromacs/gmxpreprocess/grompp-impl.h" -#include "gromacs/legacyheaders/typedefs.h" +#include "gromacs/utility/real.h" + +struct gmx_mtop_t; void convert_params(int atnr, t_params nbtypes[], t_molinfo *mi, diff --git a/src/gromacs/gmxpreprocess/gen_ad.cpp b/src/gromacs/gmxpreprocess/gen_ad.cpp index 08305e8b51..941bd94834 100644 --- a/src/gromacs/gmxpreprocess/gen_ad.cpp +++ b/src/gromacs/gmxpreprocess/gen_ad.cpp @@ -49,6 +49,7 @@ #include "gromacs/fileio/confio.h" #include "gromacs/gmxpreprocess/gpp_nextnb.h" +#include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/pgutil.h" #include "gromacs/gmxpreprocess/resall.h" #include "gromacs/gmxpreprocess/topio.h" diff --git a/src/gromacs/gmxpreprocess/gen_ad.h b/src/gromacs/gmxpreprocess/gen_ad.h index af4c037288..de9cad98bf 100644 --- a/src/gromacs/gmxpreprocess/gen_ad.h +++ b/src/gromacs/gmxpreprocess/gen_ad.h @@ -41,7 +41,6 @@ #include "gromacs/gmxpreprocess/gpp_nextnb.h" #include "gromacs/gmxpreprocess/resall.h" #include "gromacs/gmxpreprocess/toputil.h" -#include "gromacs/legacyheaders/typedefs.h" void generate_excls(t_nextnb *nnb, int nrexcl, t_excls excls[]); void clean_excls(t_nextnb *nnb, int nrexcl, t_excls excls[]); diff --git a/src/gromacs/gmxpreprocess/gen_maxwell_velocities.cpp b/src/gromacs/gmxpreprocess/gen_maxwell_velocities.cpp index 8296c5deef..3cd22af253 100644 --- a/src/gromacs/gmxpreprocess/gen_maxwell_velocities.cpp +++ b/src/gromacs/gmxpreprocess/gen_maxwell_velocities.cpp @@ -40,11 +40,12 @@ #include -#include "gromacs/legacyheaders/typedefs.h" #include "gromacs/math/units.h" #include "gromacs/math/vec.h" +#include "gromacs/math/vectypes.h" #include "gromacs/random/random.h" #include "gromacs/topology/mtop_util.h" +#include "gromacs/topology/topology.h" #include "gromacs/utility/fatalerror.h" #include "gromacs/utility/smalloc.h" diff --git a/src/gromacs/gmxpreprocess/gen_maxwell_velocities.h b/src/gromacs/gmxpreprocess/gen_maxwell_velocities.h index b4f65cd3c3..63d64d51c0 100644 --- a/src/gromacs/gmxpreprocess/gen_maxwell_velocities.h +++ b/src/gromacs/gmxpreprocess/gen_maxwell_velocities.h @@ -38,7 +38,12 @@ #ifndef GMX_MAXWELL_VELOCITIES #define GMX_MAXWELL_VELOCITIES -#include "gromacs/legacyheaders/typedefs.h" +#include + +#include "gromacs/math/vectypes.h" +#include "gromacs/utility/real.h" + +struct gmx_mtop_t; /*! \brief * Generate Maxwellian velocities. diff --git a/src/gromacs/gmxpreprocess/gen_vsite.cpp b/src/gromacs/gmxpreprocess/gen_vsite.cpp index b1821f8a57..d7164b6b71 100644 --- a/src/gromacs/gmxpreprocess/gen_vsite.cpp +++ b/src/gromacs/gmxpreprocess/gen_vsite.cpp @@ -44,9 +44,11 @@ #include +#include "gromacs/fileio/pdbio.h" #include "gromacs/gmxpreprocess/add_par.h" #include "gromacs/gmxpreprocess/fflibutil.h" #include "gromacs/gmxpreprocess/gpp_atomtype.h" +#include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/resall.h" #include "gromacs/gmxpreprocess/toputil.h" #include "gromacs/legacyheaders/names.h" @@ -55,9 +57,11 @@ #include "gromacs/math/vec.h" #include "gromacs/topology/residuetypes.h" #include "gromacs/topology/symtab.h" +#include "gromacs/utility/basedefinitions.h" #include "gromacs/utility/cstringutil.h" #include "gromacs/utility/fatalerror.h" #include "gromacs/utility/futil.h" +#include "gromacs/utility/real.h" #include "gromacs/utility/smalloc.h" #define MAXNAME 32 diff --git a/src/gromacs/gmxpreprocess/gen_vsite.h b/src/gromacs/gmxpreprocess/gen_vsite.h index 4ece47f91e..ad90107ccf 100644 --- a/src/gromacs/gmxpreprocess/gen_vsite.h +++ b/src/gromacs/gmxpreprocess/gen_vsite.h @@ -41,7 +41,7 @@ #include "gromacs/gmxpreprocess/gpp_atomtype.h" #include "gromacs/gmxpreprocess/grompp-impl.h" #include "gromacs/gmxpreprocess/hackblock.h" -#include "gromacs/legacyheaders/typedefs.h" +#include "gromacs/utility/real.h" /* stuff for pdb2gmx */ diff --git a/src/gromacs/gmxpreprocess/genhydro.cpp b/src/gromacs/gmxpreprocess/genhydro.cpp index 7fe5cbb68d..7e6ae0dba8 100644 --- a/src/gromacs/gmxpreprocess/genhydro.cpp +++ b/src/gromacs/gmxpreprocess/genhydro.cpp @@ -44,6 +44,7 @@ #include "gromacs/fileio/confio.h" #include "gromacs/gmxpreprocess/calch.h" #include "gromacs/gmxpreprocess/h_db.h" +#include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/pgutil.h" #include "gromacs/gmxpreprocess/resall.h" #include "gromacs/gmxpreprocess/ter_db.h" diff --git a/src/gromacs/gmxpreprocess/gpp_atomtype.cpp b/src/gromacs/gmxpreprocess/gpp_atomtype.cpp index 7c5601ed5a..67bf8da643 100644 --- a/src/gromacs/gmxpreprocess/gpp_atomtype.cpp +++ b/src/gromacs/gmxpreprocess/gpp_atomtype.cpp @@ -40,8 +40,10 @@ #include +#include #include +#include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/topdirs.h" #include "gromacs/gmxpreprocess/toputil.h" #include "gromacs/legacyheaders/txtdump.h" diff --git a/src/gromacs/gmxpreprocess/gpp_atomtype.h b/src/gromacs/gmxpreprocess/gpp_atomtype.h index 19d345c650..8197540305 100644 --- a/src/gromacs/gmxpreprocess/gpp_atomtype.h +++ b/src/gromacs/gmxpreprocess/gpp_atomtype.h @@ -41,7 +41,8 @@ #include #include "gromacs/gmxpreprocess/grompp-impl.h" -#include "gromacs/legacyheaders/typedefs.h" + +struct gmx_mtop_t; typedef struct gpp_atomtype *gpp_atomtype_t; diff --git a/src/gromacs/gmxpreprocess/gpp_bond_atomtype.cpp b/src/gromacs/gmxpreprocess/gpp_bond_atomtype.cpp index d051d161bc..0b26182b75 100644 --- a/src/gromacs/gmxpreprocess/gpp_bond_atomtype.cpp +++ b/src/gromacs/gmxpreprocess/gpp_bond_atomtype.cpp @@ -40,6 +40,7 @@ #include +#include "gromacs/gmxpreprocess/notset.h" #include "gromacs/topology/symtab.h" #include "gromacs/utility/cstringutil.h" #include "gromacs/utility/smalloc.h" diff --git a/src/gromacs/gmxpreprocess/gpp_bond_atomtype.h b/src/gromacs/gmxpreprocess/gpp_bond_atomtype.h index 6fc4635bab..cd3d3c60d1 100644 --- a/src/gromacs/gmxpreprocess/gpp_bond_atomtype.h +++ b/src/gromacs/gmxpreprocess/gpp_bond_atomtype.h @@ -40,8 +40,6 @@ #include -#include "gromacs/legacyheaders/typedefs.h" - typedef struct gpp_bondatomtype *t_bond_atomtype; int get_bond_atomtype_type(char *str, t_bond_atomtype at); diff --git a/src/gromacs/gmxpreprocess/grompp-impl.h b/src/gromacs/gmxpreprocess/grompp-impl.h index 08e2db60b9..0e5f68d77d 100644 --- a/src/gromacs/gmxpreprocess/grompp-impl.h +++ b/src/gromacs/gmxpreprocess/grompp-impl.h @@ -38,7 +38,15 @@ #ifndef GMX_GMXPREPROCESS_GROMPP_IMPL_H #define GMX_GMXPREPROCESS_GROMPP_IMPL_H -#include "gromacs/legacyheaders/typedefs.h" +#include "gromacs/topology/atom_id.h" +#include "gromacs/topology/atoms.h" +#include "gromacs/topology/block.h" +#include "gromacs/topology/idef.h" +#include "gromacs/utility/basedefinitions.h" +#include "gromacs/utility/real.h" + +struct t_block; +struct t_blocka; #define MAXSLEN 32 diff --git a/src/gromacs/gmxpreprocess/grompp.cpp b/src/gromacs/gmxpreprocess/grompp.cpp index 0c620336fb..f01c5e8453 100644 --- a/src/gromacs/gmxpreprocess/grompp.cpp +++ b/src/gromacs/gmxpreprocess/grompp.cpp @@ -62,6 +62,7 @@ #include "gromacs/gmxpreprocess/gen_maxwell_velocities.h" #include "gromacs/gmxpreprocess/gpp_atomtype.h" #include "gromacs/gmxpreprocess/grompp-impl.h" +#include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/readir.h" #include "gromacs/gmxpreprocess/tomorse.h" #include "gromacs/gmxpreprocess/topio.h" diff --git a/src/gromacs/gmxpreprocess/h_db.cpp b/src/gromacs/gmxpreprocess/h_db.cpp index 03d269f93f..61cb60f705 100644 --- a/src/gromacs/gmxpreprocess/h_db.cpp +++ b/src/gromacs/gmxpreprocess/h_db.cpp @@ -43,6 +43,7 @@ #include #include "gromacs/gmxpreprocess/fflibutil.h" +#include "gromacs/gmxpreprocess/notset.h" #include "gromacs/utility/arraysize.h" #include "gromacs/utility/cstringutil.h" #include "gromacs/utility/fatalerror.h" diff --git a/src/gromacs/gmxpreprocess/hackblock.cpp b/src/gromacs/gmxpreprocess/hackblock.cpp index b735f6c8bb..cca6fe70a4 100644 --- a/src/gromacs/gmxpreprocess/hackblock.cpp +++ b/src/gromacs/gmxpreprocess/hackblock.cpp @@ -41,6 +41,7 @@ #include +#include "gromacs/gmxpreprocess/notset.h" #include "gromacs/legacyheaders/names.h" #include "gromacs/math/vec.h" #include "gromacs/utility/cstringutil.h" diff --git a/src/gromacs/gmxpreprocess/hackblock.h b/src/gromacs/gmxpreprocess/hackblock.h index 11cf86da9c..67b6b62579 100644 --- a/src/gromacs/gmxpreprocess/hackblock.h +++ b/src/gromacs/gmxpreprocess/hackblock.h @@ -38,10 +38,8 @@ #ifndef GMX_GMXPREPROCESS_HACKBLOCK_H #define GMX_GMXPREPROCESS_HACKBLOCK_H -#include "gromacs/fileio/pdbio.h" #include "gromacs/gmxpreprocess/gpp_atomtype.h" #include "gromacs/gmxpreprocess/grompp-impl.h" -#include "gromacs/legacyheaders/typedefs.h" #include "gromacs/topology/symtab.h" /* Used for reading .rtp/.tdb */ diff --git a/src/gromacs/gmxpreprocess/nm2type.cpp b/src/gromacs/gmxpreprocess/nm2type.cpp index 6e9344cca4..314b4c3e6d 100644 --- a/src/gromacs/gmxpreprocess/nm2type.cpp +++ b/src/gromacs/gmxpreprocess/nm2type.cpp @@ -48,6 +48,7 @@ #include "gromacs/gmxpreprocess/fflibutil.h" #include "gromacs/gmxpreprocess/gpp_atomtype.h" #include "gromacs/gmxpreprocess/gpp_nextnb.h" +#include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/pdb2top.h" #include "gromacs/gmxpreprocess/toppush.h" #include "gromacs/legacyheaders/names.h" diff --git a/src/gromacs/gmxpreprocess/tomorse.h b/src/gromacs/gmxpreprocess/notset.h similarity index 76% copy from src/gromacs/gmxpreprocess/tomorse.h copy to src/gromacs/gmxpreprocess/notset.h index cb098869de..53802c4888 100644 --- a/src/gromacs/gmxpreprocess/tomorse.h +++ b/src/gromacs/gmxpreprocess/notset.h @@ -1,9 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 1991-2000, University of Groningen, The Netherlands. - * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2015, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -35,15 +33,10 @@ * the research papers on the package. Check out http://www.gromacs.org. */ -#ifndef GMX_GMXPREPROCESS_TOMORSE_H -#define GMX_GMXPREPROCESS_TOMORSE_H +#ifndef GMX_GMXPREPROCESS_NOTSET_H +#define GMX_GMXPREPROCESS_NOTSET_H -#include - -#include "gromacs/gmxpreprocess/gpp_atomtype.h" -#include "gromacs/gmxpreprocess/grompp-impl.h" -#include "gromacs/legacyheaders/typedefs.h" - -void convert_harmonics(int nrmols, t_molinfo mols[], gpp_atomtype_t atype); +// TODO: Remove this whole file and make a proper implementation of uninitialized vars. +static const int NOTSET = -409203; #endif diff --git a/src/gromacs/gmxpreprocess/pdb2top.cpp b/src/gromacs/gmxpreprocess/pdb2top.cpp index 05592f9ed7..7347a56216 100644 --- a/src/gromacs/gmxpreprocess/pdb2top.cpp +++ b/src/gromacs/gmxpreprocess/pdb2top.cpp @@ -57,6 +57,7 @@ #include "gromacs/gmxpreprocess/gen_vsite.h" #include "gromacs/gmxpreprocess/gpp_nextnb.h" #include "gromacs/gmxpreprocess/h_db.h" +#include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/pgutil.h" #include "gromacs/gmxpreprocess/resall.h" #include "gromacs/gmxpreprocess/topdirs.h" diff --git a/src/gromacs/gmxpreprocess/pdb2top.h b/src/gromacs/gmxpreprocess/pdb2top.h index a5e468106c..1a40d1010d 100644 --- a/src/gromacs/gmxpreprocess/pdb2top.h +++ b/src/gromacs/gmxpreprocess/pdb2top.h @@ -42,7 +42,6 @@ #include "gromacs/gmxpreprocess/grompp-impl.h" #include "gromacs/gmxpreprocess/hackblock.h" #include "gromacs/gmxpreprocess/toputil.h" -#include "gromacs/legacyheaders/typedefs.h" /* this *MUST* correspond to array in pdb2top.c */ enum { diff --git a/src/gromacs/gmxpreprocess/pgutil.cpp b/src/gromacs/gmxpreprocess/pgutil.cpp index 8c84e98d41..e6771ead78 100644 --- a/src/gromacs/gmxpreprocess/pgutil.cpp +++ b/src/gromacs/gmxpreprocess/pgutil.cpp @@ -42,6 +42,7 @@ #include +#include "gromacs/topology/atoms.h" #include "gromacs/utility/cstringutil.h" #include "gromacs/utility/fatalerror.h" #include "gromacs/utility/snprintf.h" diff --git a/src/gromacs/gmxpreprocess/pgutil.h b/src/gromacs/gmxpreprocess/pgutil.h index 1c5b46d2ca..ec605c57c0 100644 --- a/src/gromacs/gmxpreprocess/pgutil.h +++ b/src/gromacs/gmxpreprocess/pgutil.h @@ -38,7 +38,12 @@ #ifndef GMX_GMXPREPROCESS_PGUTIL_H #define GMX_GMXPREPROCESS_PGUTIL_H -#include "gromacs/legacyheaders/typedefs.h" +#include "gromacs/topology/atom_id.h" +#include "gromacs/utility/basedefinitions.h" +#include "gromacs/utility/real.h" + +struct t_atom; +struct t_atoms; /* Search an atom in array of pointers to strings, starting from start * if type starts with '-' then searches backwards from start. diff --git a/src/gromacs/gmxpreprocess/readir.h b/src/gromacs/gmxpreprocess/readir.h index 1093ccd80a..b8f4ef628f 100644 --- a/src/gromacs/gmxpreprocess/readir.h +++ b/src/gromacs/gmxpreprocess/readir.h @@ -40,12 +40,14 @@ #include "gromacs/gmxlib/readinp.h" #include "gromacs/gmxpreprocess/grompp-impl.h" -#include "gromacs/legacyheaders/typedefs.h" +struct gmx_groups_t; +struct gmx_mtop_t; struct gmx_output_env_t; struct pull_params_t; struct t_adress; struct t_grpopts; +struct t_inputrec; struct t_rot; enum { diff --git a/src/gromacs/gmxpreprocess/resall.cpp b/src/gromacs/gmxpreprocess/resall.cpp index bdbc1b2386..b769138ed3 100644 --- a/src/gromacs/gmxpreprocess/resall.cpp +++ b/src/gromacs/gmxpreprocess/resall.cpp @@ -46,6 +46,7 @@ #include "gromacs/fileio/strdb.h" #include "gromacs/gmxpreprocess/fflibutil.h" +#include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/pgutil.h" #include "gromacs/topology/symtab.h" #include "gromacs/utility/cstringutil.h" diff --git a/src/gromacs/gmxpreprocess/resall.h b/src/gromacs/gmxpreprocess/resall.h index 463f982ef7..669ef7c9a8 100644 --- a/src/gromacs/gmxpreprocess/resall.h +++ b/src/gromacs/gmxpreprocess/resall.h @@ -41,7 +41,6 @@ #include "gromacs/gmxpreprocess/gpp_atomtype.h" #include "gromacs/gmxpreprocess/grompp-impl.h" #include "gromacs/gmxpreprocess/hackblock.h" -#include "gromacs/legacyheaders/typedefs.h" char *search_rtp(const char *key, int nrtp, t_restp rtp[]); /* Search for an entry in the rtp database, returns the rtp residue name. diff --git a/src/gromacs/gmxpreprocess/ter_db.cpp b/src/gromacs/gmxpreprocess/ter_db.cpp index eca3a323f0..426b0e1871 100644 --- a/src/gromacs/gmxpreprocess/ter_db.cpp +++ b/src/gromacs/gmxpreprocess/ter_db.cpp @@ -45,6 +45,7 @@ #include "gromacs/fileio/strdb.h" #include "gromacs/gmxpreprocess/fflibutil.h" #include "gromacs/gmxpreprocess/h_db.h" +#include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/resall.h" #include "gromacs/gmxpreprocess/toputil.h" #include "gromacs/legacyheaders/typedefs.h" diff --git a/src/gromacs/gmxpreprocess/tomorse.h b/src/gromacs/gmxpreprocess/tomorse.h index cb098869de..7d94dc29c6 100644 --- a/src/gromacs/gmxpreprocess/tomorse.h +++ b/src/gromacs/gmxpreprocess/tomorse.h @@ -42,7 +42,6 @@ #include "gromacs/gmxpreprocess/gpp_atomtype.h" #include "gromacs/gmxpreprocess/grompp-impl.h" -#include "gromacs/legacyheaders/typedefs.h" void convert_harmonics(int nrmols, t_molinfo mols[], gpp_atomtype_t atype); diff --git a/src/gromacs/gmxpreprocess/topio.h b/src/gromacs/gmxpreprocess/topio.h index 124503492f..d03fc5db29 100644 --- a/src/gromacs/gmxpreprocess/topio.h +++ b/src/gromacs/gmxpreprocess/topio.h @@ -41,7 +41,8 @@ #include "gromacs/gmxpreprocess/gpp_atomtype.h" #include "gromacs/gmxpreprocess/grompp-impl.h" #include "gromacs/gmxpreprocess/readir.h" -#include "gromacs/legacyheaders/typedefs.h" + +struct gmx_molblock_t; double check_mol(gmx_mtop_t *mtop, warninp_t wi); /* Check mass and charge */ diff --git a/src/gromacs/gmxpreprocess/toppush.cpp b/src/gromacs/gmxpreprocess/toppush.cpp index 24401bab6a..fc552f09a1 100644 --- a/src/gromacs/gmxpreprocess/toppush.cpp +++ b/src/gromacs/gmxpreprocess/toppush.cpp @@ -48,6 +48,7 @@ #include "gromacs/gmxlib/warninp.h" #include "gromacs/gmxpreprocess/gpp_atomtype.h" #include "gromacs/gmxpreprocess/gpp_bond_atomtype.h" +#include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/readir.h" #include "gromacs/gmxpreprocess/topdirs.h" #include "gromacs/gmxpreprocess/toputil.h" diff --git a/src/gromacs/gmxpreprocess/toppush.h b/src/gromacs/gmxpreprocess/toppush.h index f6c7398a1c..088aafd26a 100644 --- a/src/gromacs/gmxpreprocess/toppush.h +++ b/src/gromacs/gmxpreprocess/toppush.h @@ -42,7 +42,6 @@ #include "gromacs/gmxpreprocess/gpp_atomtype.h" #include "gromacs/gmxpreprocess/gpp_bond_atomtype.h" #include "gromacs/gmxpreprocess/toputil.h" -#include "gromacs/legacyheaders/typedefs.h" typedef struct { int nr; /* The number of entries in the list */ diff --git a/src/gromacs/gmxpreprocess/topshake.cpp b/src/gromacs/gmxpreprocess/topshake.cpp index 587cce4dbe..8904a8bb55 100644 --- a/src/gromacs/gmxpreprocess/topshake.cpp +++ b/src/gromacs/gmxpreprocess/topshake.cpp @@ -43,6 +43,7 @@ #include +#include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/readir.h" #include "gromacs/gmxpreprocess/topdirs.h" #include "gromacs/gmxpreprocess/toppush.h" diff --git a/src/gromacs/gmxpreprocess/toputil.cpp b/src/gromacs/gmxpreprocess/toputil.cpp index 010bbf1c92..d0aaa4cf88 100644 --- a/src/gromacs/gmxpreprocess/toputil.cpp +++ b/src/gromacs/gmxpreprocess/toputil.cpp @@ -40,11 +40,13 @@ #include +#include #include #include #include "gromacs/gmxpreprocess/gpp_atomtype.h" +#include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/topdirs.h" #include "gromacs/legacyheaders/types/ifunc.h" #include "gromacs/topology/block.h" diff --git a/src/gromacs/gmxpreprocess/vsite_parm.cpp b/src/gromacs/gmxpreprocess/vsite_parm.cpp index 328c0e1d79..47860ab691 100644 --- a/src/gromacs/gmxpreprocess/vsite_parm.cpp +++ b/src/gromacs/gmxpreprocess/vsite_parm.cpp @@ -46,6 +46,7 @@ #include #include "gromacs/gmxpreprocess/add_par.h" +#include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/resall.h" #include "gromacs/gmxpreprocess/toputil.h" #include "gromacs/legacyheaders/names.h" diff --git a/src/gromacs/gmxpreprocess/vsite_parm.h b/src/gromacs/gmxpreprocess/vsite_parm.h index 2f87ef71af..d9ed5a0609 100644 --- a/src/gromacs/gmxpreprocess/vsite_parm.h +++ b/src/gromacs/gmxpreprocess/vsite_parm.h @@ -40,7 +40,8 @@ #include "gromacs/gmxpreprocess/gpp_atomtype.h" #include "gromacs/gmxpreprocess/grompp-impl.h" -#include "gromacs/legacyheaders/typedefs.h" + +struct gmx_moltype_t; int set_vsites(gmx_bool bVerbose, t_atoms *atoms, gpp_atomtype_t atype, t_params plist[]); diff --git a/src/gromacs/gmxpreprocess/x2top.cpp b/src/gromacs/gmxpreprocess/x2top.cpp index 508e729ca4..d246711f8c 100644 --- a/src/gromacs/gmxpreprocess/x2top.cpp +++ b/src/gromacs/gmxpreprocess/x2top.cpp @@ -48,6 +48,7 @@ #include "gromacs/gmxpreprocess/gpp_nextnb.h" #include "gromacs/gmxpreprocess/hackblock.h" #include "gromacs/gmxpreprocess/nm2type.h" +#include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/pdb2top.h" #include "gromacs/gmxpreprocess/toppush.h" #include "gromacs/legacyheaders/copyrite.h" diff --git a/src/gromacs/legacyheaders/typedefs.h b/src/gromacs/legacyheaders/typedefs.h index 232c11f896..e122b2b2e7 100644 --- a/src/gromacs/legacyheaders/typedefs.h +++ b/src/gromacs/legacyheaders/typedefs.h @@ -40,7 +40,7 @@ /* DEPRECATED! value for signaling unitialized variables */ -#define NOTSET -12345 +//#define NOTSET -12345 #include "gromacs/legacyheaders/types/state.h" #include "gromacs/topology/topology.h" diff --git a/src/gromacs/tools/check.cpp b/src/gromacs/tools/check.cpp index 12c686f29a..e48062bf19 100644 --- a/src/gromacs/tools/check.cpp +++ b/src/gromacs/tools/check.cpp @@ -649,6 +649,7 @@ void chk_enx(const char *fn) gmx_enxnm_t *enm = NULL; t_enxframe *fr; gmx_bool bShowTStep; + gmx_bool timeSet; real t0, old_t1, old_t2; char buf[22]; @@ -661,7 +662,8 @@ void chk_enx(const char *fn) old_t2 = -2.0; old_t1 = -1.0; fnr = 0; - t0 = NOTSET; + t0 = 0; + timeSet = FALSE; bShowTStep = TRUE; while (do_enx(in, fr)) @@ -678,9 +680,10 @@ void chk_enx(const char *fn) } old_t2 = old_t1; old_t1 = fr->t; - if (t0 == NOTSET) + if (!timeSet) { - t0 = fr->t; + t0 = fr->t; + timeSet = TRUE; } if (fnr == 0) { diff --git a/src/gromacs/topology/atoms.h b/src/gromacs/topology/atoms.h index 54f497c029..9280d09fe0 100644 --- a/src/gromacs/topology/atoms.h +++ b/src/gromacs/topology/atoms.h @@ -59,7 +59,7 @@ typedef struct t_atom unsigned short typeB; /* Atom type for Free Energy calc */ int ptype; /* Particle type */ int resind; /* Index into resinfo (in t_atoms) */ - int atomnumber; /* Atomic Number or NOTSET */ + int atomnumber; /* Atomic Number or 0 */ char elem[4]; /* Element name */ } t_atom; diff --git a/src/gromacs/topology/index.cpp b/src/gromacs/topology/index.cpp index 1475c91d9e..51b95406a9 100644 --- a/src/gromacs/topology/index.cpp +++ b/src/gromacs/topology/index.cpp @@ -833,23 +833,22 @@ static void minstring(char *str) } } -int find_group(char s[], int ngrps, char **grpname) +int find_group(const char *s, int ngrps, char **grpname) { int aa, i, n; char string[STRLEN]; gmx_bool bMultiple; - bMultiple = FALSE; n = strlen(s); - aa = NOTSET; + aa = -1; /* first look for whole name match */ - if (aa == NOTSET) + if (aa == -1) { for (i = 0; i < ngrps; i++) { if (gmx_strcasecmp_min(s, grpname[i]) == 0) { - if (aa != NOTSET) + if (aa != -1) { bMultiple = TRUE; } @@ -858,13 +857,13 @@ int find_group(char s[], int ngrps, char **grpname) } } /* second look for first string match */ - if (aa == NOTSET) + if (aa == -1) { for (i = 0; i < ngrps; i++) { if (gmx_strncasecmp_min(s, grpname[i], n) == 0) { - if (aa != NOTSET) + if (aa != -1) { bMultiple = TRUE; } @@ -873,18 +872,21 @@ int find_group(char s[], int ngrps, char **grpname) } } /* last look for arbitrary substring match */ - if (aa == NOTSET) + if (aa == -1) { - upstring(s); - minstring(s); + char key[STRLEN]; + strncpy(key, s, sizeof(key)-1); + key[STRLEN-1] = '\0'; + upstring(key); + minstring(key); for (i = 0; i < ngrps; i++) { strcpy(string, grpname[i]); upstring(string); minstring(string); - if (strstr(string, s) != NULL) + if (strstr(string, key) != NULL) { - if (aa != NOTSET) + if (aa != -1) { bMultiple = TRUE; } @@ -895,7 +897,7 @@ int find_group(char s[], int ngrps, char **grpname) if (bMultiple) { printf("Error: Multiple groups '%s' selected\n", s); - aa = NOTSET; + aa = -1; } return aa; } diff --git a/src/gromacs/topology/index.h b/src/gromacs/topology/index.h index 95ce402577..ce87595d28 100644 --- a/src/gromacs/topology/index.h +++ b/src/gromacs/topology/index.h @@ -109,7 +109,14 @@ void analyse(struct t_atoms *atoms, struct t_blocka *gb, char ***gn, * bASK=FALSE gives default groups. */ -int find_group(char s[], int ngrps, char **grpname); +/*! \brief Look up a group in a list. + * + * \param[inout] s The string to look up + * \param[in] ngrps The number of groups + * \param[in] grpname The names of the groups + * \return the group number or -1 if not found. + */ +int find_group(const char *s, int ngrps, char **grpname); #ifdef __cplusplus diff --git a/src/gromacs/topology/invblock.h b/src/gromacs/topology/invblock.h index f7a1487f76..225f3beec8 100644 --- a/src/gromacs/topology/invblock.h +++ b/src/gromacs/topology/invblock.h @@ -39,10 +39,6 @@ #include "gromacs/topology/atom_id.h" -#ifdef __cplusplus -extern "C" { -#endif - struct t_block; struct t_blocka; @@ -56,8 +52,4 @@ atom_id *make_invblocka(const struct t_blocka *block, int nr); * array, and therefore the dimension of the returned array */ -#ifdef __cplusplus -} -#endif - #endif -- 2.11.4.GIT