From: Mark Abraham Date: Wed, 2 Jan 2019 14:02:14 +0000 (+0100) Subject: Improve use of gmxpreprocess headers X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=7a1945d8759439beb52e9f8572f28e0642fea377;p=alexxy%2Fgromacs.git Improve use of gmxpreprocess headers Less use of typedef struct so that we can have more use of forward declarations of types. Less inclusion of headers from headers Updated stdio.h to cstdio Localized definition of t_nbparam to the single file it needs to be in. Change-Id: I92d2d4e1a9a1bc8062627af45dc606903254803c --- diff --git a/src/gromacs/gmxpreprocess/add_par.h b/src/gromacs/gmxpreprocess/add_par.h index f96cf02a1f..8fd883d4bf 100644 --- a/src/gromacs/gmxpreprocess/add_par.h +++ b/src/gromacs/gmxpreprocess/add_par.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2018,2019, 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. @@ -38,10 +38,11 @@ #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/utility/real.h" +struct t_params; +struct t_restp; + void add_param(t_params *ps, int ai, int aj, const real *c, char *s); void add_imp_param(t_params *ps, int ai, int aj, int ak, int al, diff --git a/src/gromacs/gmxpreprocess/convparm.cpp b/src/gromacs/gmxpreprocess/convparm.cpp index 91fd43c7ee..ee73c32e20 100644 --- a/src/gromacs/gmxpreprocess/convparm.cpp +++ b/src/gromacs/gmxpreprocess/convparm.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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. @@ -45,6 +45,7 @@ #include "gromacs/compat/make_unique.h" #include "gromacs/gmxpreprocess/gpp_atomtype.h" +#include "gromacs/gmxpreprocess/grompp-impl.h" #include "gromacs/gmxpreprocess/topio.h" #include "gromacs/gmxpreprocess/toputil.h" #include "gromacs/math/functions.h" diff --git a/src/gromacs/gmxpreprocess/convparm.h b/src/gromacs/gmxpreprocess/convparm.h index 78d84b296f..496d866d3d 100644 --- a/src/gromacs/gmxpreprocess/convparm.h +++ b/src/gromacs/gmxpreprocess/convparm.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2019, 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. @@ -38,10 +38,11 @@ #ifndef GMX_GMXPREPROCESS_CONVPARM_H #define GMX_GMXPREPROCESS_CONVPARM_H -#include "gromacs/gmxpreprocess/grompp-impl.h" #include "gromacs/utility/real.h" struct gmx_mtop_t; +struct t_molinfo; +struct t_params; void convert_params(int atnr, t_params nbtypes[], t_molinfo *mi, diff --git a/src/gromacs/gmxpreprocess/fflibutil.h b/src/gromacs/gmxpreprocess/fflibutil.h index 6aeae89ce0..c608183a40 100644 --- a/src/gromacs/gmxpreprocess/fflibutil.h +++ b/src/gromacs/gmxpreprocess/fflibutil.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2014,2015,2018, by the GROMACS development team, led by + * Copyright (c) 2010,2014,2015,2018,2019, 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. @@ -36,7 +36,7 @@ #ifndef GMX_GMXPREPROCESS_FFLIBUTIL_H #define GMX_GMXPREPROCESS_FFLIBUTIL_H -#include +#include #include #include diff --git a/src/gromacs/gmxpreprocess/gen_ad.cpp b/src/gromacs/gmxpreprocess/gen_ad.cpp index 464fc80348..c77553fb31 100644 --- a/src/gromacs/gmxpreprocess/gen_ad.cpp +++ b/src/gromacs/gmxpreprocess/gen_ad.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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. @@ -48,6 +48,8 @@ #include "gromacs/fileio/confio.h" #include "gromacs/gmxpreprocess/gpp_nextnb.h" +#include "gromacs/gmxpreprocess/grompp-impl.h" +#include "gromacs/gmxpreprocess/hackblock.h" #include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/pgutil.h" #include "gromacs/gmxpreprocess/resall.h" diff --git a/src/gromacs/gmxpreprocess/gen_ad.h b/src/gromacs/gmxpreprocess/gen_ad.h index 15d6e17dae..6be288a493 100644 --- a/src/gromacs/gmxpreprocess/gen_ad.h +++ b/src/gromacs/gmxpreprocess/gen_ad.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2014,2015,2018, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2018,2019, 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. @@ -38,9 +38,12 @@ #ifndef GMX_GMXPREPROCESS_GEN_AD_H #define GMX_GMXPREPROCESS_GEN_AD_H -#include "gromacs/gmxpreprocess/gpp_nextnb.h" -#include "gromacs/gmxpreprocess/resall.h" -#include "gromacs/gmxpreprocess/toputil.h" +struct t_atoms; +struct t_excls; +struct t_hackblock; +struct t_nextnb; +struct t_params; +struct t_restp; 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_vsite.cpp b/src/gromacs/gmxpreprocess/gen_vsite.cpp index 6e4c36802f..49f965d073 100644 --- a/src/gromacs/gmxpreprocess/gen_vsite.cpp +++ b/src/gromacs/gmxpreprocess/gen_vsite.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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. @@ -50,6 +50,8 @@ #include "gromacs/gmxpreprocess/add_par.h" #include "gromacs/gmxpreprocess/fflibutil.h" #include "gromacs/gmxpreprocess/gpp_atomtype.h" +#include "gromacs/gmxpreprocess/grompp-impl.h" +#include "gromacs/gmxpreprocess/hackblock.h" #include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/resall.h" #include "gromacs/gmxpreprocess/toputil.h" @@ -71,7 +73,8 @@ #define OPENDIR '[' /* starting sign for directive */ #define CLOSEDIR ']' /* ending sign for directive */ -typedef struct { +struct t_vsiteconf +{ char atomtype[MAXNAME]; /* Type for the XH3/XH2 atom */ bool isplanar; /* If true, the atomtype above and the three connected * ones are in a planar geometry. The two next entries @@ -80,7 +83,7 @@ typedef struct { int nhydrogens; /* number of connected hydrogens */ char nextheavytype[MAXNAME]; /* Type for the heavy atom bonded to XH2/XH3 */ char dummymass[MAXNAME]; /* The type of MNH* or MCH3* dummy mass to use */ -} t_vsiteconf; +}; /* Structure to represent average bond and angles values in vsite aromatic @@ -88,22 +91,25 @@ typedef struct { * forcefield; many forcefields (like Amber, OPLS) have some inherent strain in * 5-rings (i.e. the sum of angles is !=540, but impropers keep it planar) */ -typedef struct { +struct t_vsitetop +{ char resname[MAXNAME]; int nbonds; int nangles; - struct vsitetop_bond { + struct vsitetop_bond + { char atom1[MAXNAME]; char atom2[MAXNAME]; float value; } *bond; /* list of bonds */ - struct vsitetop_angle { + struct vsitetop_angle + { char atom1[MAXNAME]; char atom2[MAXNAME]; char atom3[MAXNAME]; float value; } *angle; /* list of angles */ -} t_vsitetop; +}; enum { @@ -557,7 +563,7 @@ static int get_atype(int atom, t_atoms *at, int nrtp, t_restp rtp[], return type; } -static int vsite_nm2type(const char *name, gpp_atomtype_t atype) +static int vsite_nm2type(const char *name, gpp_atomtype *atype) { int tp; @@ -861,7 +867,7 @@ static void calc_vsite3_param(real xd, real yd, real xi, real yi, real xj, real } -static int gen_vsites_trp(gpp_atomtype_t atype, rvec *newx[], +static int gen_vsites_trp(gpp_atomtype *atype, rvec *newx[], t_atom *newatom[], char ***newatomname[], int *o2n[], int *newvsite_type[], int *newcgnr[], t_symtab *symtab, int *nadd, rvec x[], int *cgnr[], @@ -1133,7 +1139,7 @@ static int gen_vsites_trp(gpp_atomtype_t atype, rvec *newx[], } -static int gen_vsites_tyr(gpp_atomtype_t atype, rvec *newx[], +static int gen_vsites_tyr(gpp_atomtype *atype, rvec *newx[], t_atom *newatom[], char ***newatomname[], int *o2n[], int *newvsite_type[], int *newcgnr[], t_symtab *symtab, int *nadd, rvec x[], int *cgnr[], @@ -1533,7 +1539,7 @@ static bool is_vsite(int vsite_type) static char atomnamesuffix[] = "1234"; -void do_vsites(int nrtp, t_restp rtp[], gpp_atomtype_t atype, +void do_vsites(int nrtp, t_restp rtp[], gpp_atomtype *atype, t_atoms *at, t_symtab *symtab, rvec *x[], t_params plist[], int *vsite_type[], int *cgnr[], real mHmult, bool bVsiteAromatics, diff --git a/src/gromacs/gmxpreprocess/gen_vsite.h b/src/gromacs/gmxpreprocess/gen_vsite.h index efa351924a..a852a88fc9 100644 --- a/src/gromacs/gmxpreprocess/gen_vsite.h +++ b/src/gromacs/gmxpreprocess/gen_vsite.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2018,2019, 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. @@ -38,15 +38,19 @@ #ifndef GMX_GMXPREPROCESS_GEN_VSITE_H #define GMX_GMXPREPROCESS_GEN_VSITE_H -#include "gromacs/gmxpreprocess/gpp_atomtype.h" -#include "gromacs/gmxpreprocess/grompp-impl.h" -#include "gromacs/gmxpreprocess/hackblock.h" +#include "gromacs/math/vectypes.h" #include "gromacs/utility/real.h" +struct gpp_atomtype; +struct t_atoms; +struct t_params; +struct t_restp; +struct t_symtab; + /* stuff for pdb2gmx */ -void do_vsites(int nrtp, t_restp rtp[], gpp_atomtype_t atype, - t_atoms *at, struct t_symtab *symtab, rvec *x[], +void do_vsites(int nrtp, t_restp rtp[], gpp_atomtype *atype, + t_atoms *at, t_symtab *symtab, rvec *x[], t_params plist[], int *dummy_type[], int *cgnr[], real mHmult, bool bVSiteAromatics, const char *ffdir); diff --git a/src/gromacs/gmxpreprocess/genhydro.cpp b/src/gromacs/gmxpreprocess/genhydro.cpp index e47c79e588..abe0b48e94 100644 --- a/src/gromacs/gmxpreprocess/genhydro.cpp +++ b/src/gromacs/gmxpreprocess/genhydro.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2017,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017,2018,2019, 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. @@ -45,11 +45,13 @@ #include "gromacs/gmxlib/network.h" #include "gromacs/gmxpreprocess/calch.h" #include "gromacs/gmxpreprocess/h_db.h" +#include "gromacs/gmxpreprocess/hackblock.h" #include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/pgutil.h" #include "gromacs/gmxpreprocess/resall.h" #include "gromacs/gmxpreprocess/ter_db.h" #include "gromacs/math/vec.h" +#include "gromacs/topology/atoms.h" #include "gromacs/topology/symtab.h" #include "gromacs/utility/cstringutil.h" #include "gromacs/utility/fatalerror.h" diff --git a/src/gromacs/gmxpreprocess/genhydro.h b/src/gromacs/gmxpreprocess/genhydro.h index 79d0fd826d..b2ff682ab8 100644 --- a/src/gromacs/gmxpreprocess/genhydro.h +++ b/src/gromacs/gmxpreprocess/genhydro.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2018,2019, 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. @@ -38,8 +38,11 @@ #ifndef GMX_GMXPREPROCESS_GENHYDRO_H #define GMX_GMXPREPROCESS_GENHYDRO_H -#include "gromacs/fileio/pdbio.h" -#include "gromacs/gmxpreprocess/hackblock.h" +#include "gromacs/math/vectypes.h" + +struct t_atoms; +struct t_hack; +struct t_hackblock; int add_h(t_atoms **pdbaptr, rvec *xptr[], int nah, t_hackblock ah[], diff --git a/src/gromacs/gmxpreprocess/gpp_atomtype.cpp b/src/gromacs/gmxpreprocess/gpp_atomtype.cpp index ca489fcb46..a5b905f6ef 100644 --- a/src/gromacs/gmxpreprocess/gpp_atomtype.cpp +++ b/src/gromacs/gmxpreprocess/gpp_atomtype.cpp @@ -42,6 +42,7 @@ #include #include +#include "gromacs/gmxpreprocess/grompp-impl.h" #include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/topdirs.h" #include "gromacs/gmxpreprocess/toputil.h" @@ -52,16 +53,17 @@ #include "gromacs/utility/fatalerror.h" #include "gromacs/utility/smalloc.h" -typedef struct gpp_atomtype { +struct gpp_atomtype +{ int nr; /* The number of atomtypes */ t_atom *atom; /* Array of atoms */ char ***atomname; /* Names of the atomtypes */ t_param *nb; /* Nonbonded force default params */ int *bondatomtype; /* The bond_atomtype for each atomtype */ int *atomnumber; /* Atomic number, used for QM/MM */ -} t_gpp_atomtype; +}; -int get_atomtype_type(const char *str, gpp_atomtype_t ga) +int get_atomtype_type(const char *str, gpp_atomtype *ga) { int i; @@ -77,12 +79,12 @@ int get_atomtype_type(const char *str, gpp_atomtype_t ga) return NOTSET; } -int get_atomtype_ntypes(gpp_atomtype_t ga) +int get_atomtype_ntypes(gpp_atomtype *ga) { return ga->nr; } -char *get_atomtype_name(int nt, gpp_atomtype_t ga) +char *get_atomtype_name(int nt, gpp_atomtype *ga) { if ((nt < 0) || (nt >= ga->nr)) { @@ -92,7 +94,7 @@ char *get_atomtype_name(int nt, gpp_atomtype_t ga) return *(ga->atomname[nt]); } -real get_atomtype_massA(int nt, gpp_atomtype_t ga) +real get_atomtype_massA(int nt, gpp_atomtype *ga) { if ((nt < 0) || (nt >= ga->nr)) { @@ -102,7 +104,7 @@ real get_atomtype_massA(int nt, gpp_atomtype_t ga) return ga->atom[nt].m; } -real get_atomtype_massB(int nt, gpp_atomtype_t ga) +real get_atomtype_massB(int nt, gpp_atomtype *ga) { if ((nt < 0) || (nt >= ga->nr)) { @@ -112,7 +114,7 @@ real get_atomtype_massB(int nt, gpp_atomtype_t ga) return ga->atom[nt].mB; } -real get_atomtype_qA(int nt, gpp_atomtype_t ga) +real get_atomtype_qA(int nt, gpp_atomtype *ga) { if ((nt < 0) || (nt >= ga->nr)) { @@ -122,7 +124,7 @@ real get_atomtype_qA(int nt, gpp_atomtype_t ga) return ga->atom[nt].q; } -real get_atomtype_qB(int nt, gpp_atomtype_t ga) +real get_atomtype_qB(int nt, gpp_atomtype *ga) { if ((nt < 0) || (nt >= ga->nr)) { @@ -132,7 +134,7 @@ real get_atomtype_qB(int nt, gpp_atomtype_t ga) return ga->atom[nt].qB; } -int get_atomtype_ptype(int nt, gpp_atomtype_t ga) +int get_atomtype_ptype(int nt, gpp_atomtype *ga) { if ((nt < 0) || (nt >= ga->nr)) { @@ -152,7 +154,7 @@ int get_atomtype_batype(int nt, const gpp_atomtype* ga) return ga->bondatomtype[nt]; } -int get_atomtype_atomnumber(int nt, gpp_atomtype_t ga) +int get_atomtype_atomnumber(int nt, gpp_atomtype *ga) { if ((nt < 0) || (nt >= ga->nr)) { @@ -162,7 +164,7 @@ int get_atomtype_atomnumber(int nt, gpp_atomtype_t ga) return ga->atomnumber[nt]; } -real get_atomtype_nbparam(int nt, int param, gpp_atomtype_t ga) +real get_atomtype_nbparam(int nt, int param, gpp_atomtype *ga) { if ((nt < 0) || (nt >= ga->nr)) { @@ -175,9 +177,9 @@ real get_atomtype_nbparam(int nt, int param, gpp_atomtype_t ga) return ga->nb[nt].c[param]; } -gpp_atomtype_t init_atomtype() +gpp_atomtype *init_atomtype() { - gpp_atomtype_t ga; + gpp_atomtype *ga; snew(ga, 1); @@ -191,7 +193,7 @@ gpp_atomtype_t init_atomtype() return ga; } -int set_atomtype(int nt, gpp_atomtype_t ga, t_symtab *tab, +int set_atomtype(int nt, gpp_atomtype *ga, t_symtab *tab, t_atom *a, const char *name, t_param *nb, int bondatomtype, int atomnumber) { @@ -209,7 +211,7 @@ int set_atomtype(int nt, gpp_atomtype_t ga, t_symtab *tab, return nt; } -int add_atomtype(gpp_atomtype_t ga, t_symtab *tab, +int add_atomtype(gpp_atomtype *ga, t_symtab *tab, t_atom *a, const char *name, t_param *nb, int bondatomtype, int atomnumber) { @@ -239,7 +241,7 @@ int add_atomtype(gpp_atomtype_t ga, t_symtab *tab, } } -void print_at (FILE * out, gpp_atomtype_t ga) +void print_at (FILE * out, gpp_atomtype *ga) { int i; t_atom *atom = ga->atom; @@ -258,7 +260,7 @@ void print_at (FILE * out, gpp_atomtype_t ga) fprintf (out, "\n"); } -void done_atomtype(gpp_atomtype_t ga) +void done_atomtype(gpp_atomtype *ga) { sfree(ga->atom); sfree(ga->atomname); @@ -269,7 +271,7 @@ void done_atomtype(gpp_atomtype_t ga) sfree(ga); } -static int search_atomtypes(gpp_atomtype_t ga, int *n, int typelist[], +static int search_atomtypes(gpp_atomtype *ga, int *n, int typelist[], int thistype, t_param param[], int ftype) { @@ -326,7 +328,7 @@ static int search_atomtypes(gpp_atomtype_t ga, int *n, int typelist[], void renum_atype(t_params plist[], gmx_mtop_t *mtop, int *wall_atomtype, - gpp_atomtype_t ga, bool bVerbose) + gpp_atomtype *ga, bool bVerbose) { int i, j, k, l, mi, mj, nat, nrfp, ftype, ntype; t_atoms *atoms; @@ -437,7 +439,7 @@ void renum_atype(t_params plist[], gmx_mtop_t *mtop, sfree(typelist); } -void copy_atomtype_atomtypes(gpp_atomtype_t ga, t_atomtypes *atomtypes) +void copy_atomtype_atomtypes(gpp_atomtype *ga, t_atomtypes *atomtypes) { int i, ntype; diff --git a/src/gromacs/gmxpreprocess/gpp_atomtype.h b/src/gromacs/gmxpreprocess/gpp_atomtype.h index 20af27744e..38bc3c0824 100644 --- a/src/gromacs/gmxpreprocess/gpp_atomtype.h +++ b/src/gromacs/gmxpreprocess/gpp_atomtype.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2011,2014,2015,2018, by the GROMACS development team, led by + * Copyright (c) 2011,2014,2015,2018,2019, 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. @@ -38,63 +38,67 @@ #ifndef GMX_GMXPREPROCESS_GPP_ATOMTYPE_H #define GMX_GMXPREPROCESS_GPP_ATOMTYPE_H -#include +#include -#include "gromacs/gmxpreprocess/grompp-impl.h" +#include "gromacs/utility/real.h" struct gmx_mtop_t; - -typedef struct gpp_atomtype *gpp_atomtype_t; - -int get_atomtype_type(const char *str, gpp_atomtype_t at); +struct gpp_atomtype; +struct t_atom; +struct t_atomtypes; +struct t_param; +struct t_params; +struct t_symtab; + +int get_atomtype_type(const char *str, gpp_atomtype *at); /* Return atomtype corresponding to case-insensitive str or NOTSET if not found */ -int get_atomtype_ntypes(gpp_atomtype_t at); +int get_atomtype_ntypes(gpp_atomtype *at); /* Return number of atomtypes */ -char *get_atomtype_name(int nt, gpp_atomtype_t at); +char *get_atomtype_name(int nt, gpp_atomtype *at); /* Return name corresponding to atomtype nt, or NULL if not found */ -real get_atomtype_massA(int nt, gpp_atomtype_t at); -real get_atomtype_massB(int nt, gpp_atomtype_t at); -real get_atomtype_qA(int nt, gpp_atomtype_t at); -real get_atomtype_qB(int nt, gpp_atomtype_t at); -int get_atomtype_ptype(int nt, gpp_atomtype_t at); +real get_atomtype_massA(int nt, gpp_atomtype *at); +real get_atomtype_massB(int nt, gpp_atomtype *at); +real get_atomtype_qA(int nt, gpp_atomtype *at); +real get_atomtype_qB(int nt, gpp_atomtype *at); +int get_atomtype_ptype(int nt, gpp_atomtype *at); int get_atomtype_batype(int nt, const gpp_atomtype* at); -int get_atomtype_atomnumber(int nt, gpp_atomtype_t at); +int get_atomtype_atomnumber(int nt, gpp_atomtype *at); /* Return the above variable for atomtype nt, or NOTSET if not found */ -real get_atomtype_nbparam(int nt, int param, gpp_atomtype_t at); +real get_atomtype_nbparam(int nt, int param, gpp_atomtype *at); /* Similar to the previous but returns the paramth parameter or NOTSET */ -gpp_atomtype_t init_atomtype(); +gpp_atomtype *init_atomtype(); /* Return a new atomtype structure */ -void done_atomtype(gpp_atomtype_t at); +void done_atomtype(gpp_atomtype *at); /* Free the memory in the structure */ -int set_atomtype(int nt, gpp_atomtype_t at, struct t_symtab *tab, +int set_atomtype(int nt, gpp_atomtype *at, t_symtab *tab, t_atom *a, const char *name, t_param *nb, int bondatomtype, int atomnumber); /* Set the values of an existing atom type nt. Returns nt on success or NOTSET on error. */ -int add_atomtype(gpp_atomtype_t at, struct t_symtab *tab, +int add_atomtype(gpp_atomtype *at, t_symtab *tab, t_atom *a, const char *name, t_param *nb, int bondatomtype, int atomnumber); /* Add a complete new atom type to an existing atomtype structure. Returns the number of the atom type. */ -void print_at (FILE * out, gpp_atomtype_t at); +void print_at (FILE * out, gpp_atomtype *at); /* Print an atomtype record to a text file */ void renum_atype(t_params plist[], gmx_mtop_t *mtop, int *wall_atomtype, - gpp_atomtype_t at, bool bVerbose); + gpp_atomtype *at, bool bVerbose); -void copy_atomtype_atomtypes(gpp_atomtype_t atype, t_atomtypes *atypes); +void copy_atomtype_atomtypes(gpp_atomtype *atype, t_atomtypes *atypes); /* Copy from one structure to another */ #endif diff --git a/src/gromacs/gmxpreprocess/gpp_bond_atomtype.cpp b/src/gromacs/gmxpreprocess/gpp_bond_atomtype.cpp index 48ac1c4f67..d6d7e99d90 100644 --- a/src/gromacs/gmxpreprocess/gpp_bond_atomtype.cpp +++ b/src/gromacs/gmxpreprocess/gpp_bond_atomtype.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2011,2014,2015,2017,2018, by the GROMACS development team, led by + * Copyright (c) 2011,2014,2015,2017,2018,2019, 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. @@ -45,21 +45,18 @@ #include "gromacs/utility/cstringutil.h" #include "gromacs/utility/smalloc.h" -typedef struct { +struct gpp_bond_atomtype +{ int nr; /* The number of atomtypes */ char ***atomname; /* Names of the atomtypes */ -} gpp_bond_atomtype; +}; -int get_bond_atomtype_type(char *str, t_bond_atomtype at) +int get_bond_atomtype_type(const char *str, gpp_bond_atomtype *at) { - gpp_bond_atomtype *ga = reinterpret_cast(at); - - int i; - - for (i = 0; (i < ga->nr); i++) + for (int i = 0; (i < at->nr); i++) { /* Atom types are always case sensitive */ - if (strcmp(str, *(ga->atomname[i])) == 0) + if (strcmp(str, *(at->atomname[i])) == 0) { return i; } @@ -68,44 +65,38 @@ int get_bond_atomtype_type(char *str, t_bond_atomtype at) return NOTSET; } -char *get_bond_atomtype_name(int nt, t_bond_atomtype at) +char *get_bond_atomtype_name(int nt, gpp_bond_atomtype *at) { - gpp_bond_atomtype *ga = reinterpret_cast(at); - - if ((nt < 0) || (nt >= ga->nr)) + if ((nt < 0) || (nt >= at->nr)) { return nullptr; } - return *(ga->atomname[nt]); + return *(at->atomname[nt]); } -t_bond_atomtype init_bond_atomtype() +gpp_bond_atomtype *init_bond_atomtype() { gpp_bond_atomtype *ga; snew(ga, 1); - return reinterpret_cast(ga); + return ga; } -void add_bond_atomtype(t_bond_atomtype at, t_symtab *tab, +void add_bond_atomtype(gpp_bond_atomtype *at, t_symtab *tab, char *name) { - gpp_bond_atomtype *ga = reinterpret_cast(at); - - ga->nr++; - srenew(ga->atomname, ga->nr); - ga->atomname[ga->nr-1] = put_symtab(tab, name); + at->nr++; + srenew(at->atomname, at->nr); + at->atomname[at->nr-1] = put_symtab(tab, name); } -void done_bond_atomtype(t_bond_atomtype *at) +void done_bond_atomtype(gpp_bond_atomtype **at) { - gpp_bond_atomtype *ga = reinterpret_cast(*at); - - sfree(ga->atomname); - ga->nr = 0; - sfree(ga); + sfree((*at)->atomname); + (*at)->nr = 0; + sfree(*at); *at = nullptr; } diff --git a/src/gromacs/gmxpreprocess/gpp_bond_atomtype.h b/src/gromacs/gmxpreprocess/gpp_bond_atomtype.h index 4f0b6b2677..abd418f2e2 100644 --- a/src/gromacs/gmxpreprocess/gpp_bond_atomtype.h +++ b/src/gromacs/gmxpreprocess/gpp_bond_atomtype.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2011,2014,2015,2018, by the GROMACS development team, led by + * Copyright (c) 2011,2014,2015,2018,2019, 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,27 +35,28 @@ * the research papers on the package. Check out http://www.gromacs.org. */ -#ifndef GMX_GMXPREPROCESS_GPP_BONDATOMTYPE_H -#define GMX_GMXPREPROCESS_GPP_BONDATOMTYPE_H +#ifndef GMX_GMXPREPROCESS_GPP_BOND_ATOMTYPE_H +#define GMX_GMXPREPROCESS_GPP_BOND_ATOMTYPE_H -#include +#include -typedef struct gpp_bondatomtype *t_bond_atomtype; +struct gpp_bond_atomtype; +struct t_symtab; -int get_bond_atomtype_type(char *str, t_bond_atomtype at); +int get_bond_atomtype_type(const char *str, gpp_bond_atomtype *at); /* Return atomtype corresponding to case-insensitive str or NOTSET if not found */ -char *get_bond_atomtype_name(int nt, t_bond_atomtype at); +char *get_bond_atomtype_name(int nt, gpp_bond_atomtype *at); /* Return name corresponding to atomtype nt, or NULL if not found */ -t_bond_atomtype init_bond_atomtype(); +gpp_bond_atomtype *init_bond_atomtype(); /* Return a new atomtype structure */ -void done_bond_atomtype(t_bond_atomtype *at); +void done_bond_atomtype(gpp_bond_atomtype **at); /* Free the memory in the structure */ -void add_bond_atomtype(t_bond_atomtype at, struct t_symtab *tab, +void add_bond_atomtype(gpp_bond_atomtype *at, t_symtab *tab, char *name); /* Add a complete new atom type to an existing atomtype structure */ diff --git a/src/gromacs/gmxpreprocess/gpp_nextnb.cpp b/src/gromacs/gmxpreprocess/gpp_nextnb.cpp index 1e445b6c99..66ef693a6b 100644 --- a/src/gromacs/gmxpreprocess/gpp_nextnb.cpp +++ b/src/gromacs/gmxpreprocess/gpp_nextnb.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2011,2014,2015,2018, by the GROMACS development team, led by + * Copyright (c) 2011,2014,2015,2018,2019, 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. @@ -41,6 +41,7 @@ #include +#include "gromacs/gmxpreprocess/grompp-impl.h" #include "gromacs/gmxpreprocess/toputil.h" #include "gromacs/topology/ifunc.h" #include "gromacs/utility/fatalerror.h" diff --git a/src/gromacs/gmxpreprocess/gpp_nextnb.h b/src/gromacs/gmxpreprocess/gpp_nextnb.h index 93f35d634a..569c079e8e 100644 --- a/src/gromacs/gmxpreprocess/gpp_nextnb.h +++ b/src/gromacs/gmxpreprocess/gpp_nextnb.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2010,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2010,2014,2015,2019, 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. @@ -38,9 +38,11 @@ #ifndef GMX_GMXPREPROCESS_GPP_NEXTNB_H #define GMX_GMXPREPROCESS_GPP_NEXTNB_H -#include "gromacs/gmxpreprocess/grompp-impl.h" +struct t_blocka; +struct t_params; -typedef struct { +struct t_nextnb +{ int nr; /* nr atoms (0 <= i < nr) (atoms->nr) */ int nrex; /* with nrex lists of neighbours */ /* respectively containing zeroth, first */ @@ -48,7 +50,7 @@ typedef struct { int **nrexcl; /* with (0 <= nrx < nrexcl[i][nre]) neigbours */ /* per list stored in one 2d array of lists */ int ***a; /* like this: a[i][nre][nrx] */ -} t_nextnb; +}; void init_nnb(t_nextnb *nnb, int nr, int nrex); /* Initiate the arrays for nnb (see above) */ diff --git a/src/gromacs/gmxpreprocess/grompp-impl.h b/src/gromacs/gmxpreprocess/grompp-impl.h index d2e0ac62df..bf4f03866d 100644 --- a/src/gromacs/gmxpreprocess/grompp-impl.h +++ b/src/gromacs/gmxpreprocess/grompp-impl.h @@ -44,42 +44,33 @@ #include "gromacs/utility/basedefinitions.h" #include "gromacs/utility/real.h" -struct t_block; -struct t_blocka; - #define MAXSLEN 32 -typedef struct { - bool bSet; /* Has this combination been set */ - real c[4]; /* The non-bonded parameters */ -} t_nbparam; -/* The t_nbparam struct is used to temporary store the explicit - * non-bonded parameter combinations, which will be copied to t_params. - */ - -typedef struct { +struct t_param +{ int a[MAXATOMLIST]; /* The atom list (eg. bonds: particle */ /* i = a[0] (ai), j = a[1] (aj)) */ real c[MAXFORCEPARAM]; /* Force parameters (eg. b0 = c[0]) */ char s[MAXSLEN]; /* A string (instead of parameters), * * read from the .rtp file in pdb2gmx */ const int &ai() const { return a[0]; } - int &ai() { return a[0]; } + int &ai() { return a[0]; } const int &aj() const { return a[1]; } - int &aj() { return a[1]; } + int &aj() { return a[1]; } const int &ak() const { return a[2]; } - int &ak() { return a[2]; } + int &ak() { return a[2]; } const int &al() const { return a[3]; } - int &al() { return a[3]; } + int &al() { return a[3]; } const int &am() const { return a[4]; } - int &am() { return a[4]; } + int &am() { return a[4]; } real &c0() { return c[0]; } real &c1() { return c[1]; } real &c2() { return c[2]; } -} t_param; +}; -typedef struct { // NOLINT (clang-analyzer-optin.performance.Padding) +struct t_params +{ // NOLINT (clang-analyzer-optin.performance.Padding) int nr; /* The number of bonds in this record */ int maxnr; /* The amount of elements in the array */ t_param *param; /* Array of parameters (dim: nr or nr*nr) */ @@ -93,15 +84,16 @@ typedef struct { // NOLINT (clang-analyzer-optin.performance.Padding) int *cmap_types; /* Store the five atomtypes followed by a number that identifies the type */ int nct; /* Number of allocated elements in cmap_types */ +}; -} t_params; - -typedef struct { +struct t_excls +{ int nr; /* The number of exclusions */ int *e; /* The excluded atoms */ -} t_excls; +}; -typedef struct { +struct t_molinfo +{ char **name; int nrexcl; /* Number of exclusions per atom */ bool excl_set; /* Have exclusions been generated? */ @@ -111,12 +103,13 @@ typedef struct { t_block mols; /* Molecules */ t_blocka excls; /* Exclusions */ t_params plist[F_NRE]; /* Parameters in old style */ -} t_molinfo; +}; -typedef struct { +struct t_mols +{ char *name; int nr; -} t_mols; +}; bool is_int(double x); /* Returns TRUE when x is integer */ diff --git a/src/gromacs/gmxpreprocess/grompp.cpp b/src/gromacs/gmxpreprocess/grompp.cpp index 970ae5c140..1f9da061a6 100644 --- a/src/gromacs/gmxpreprocess/grompp.cpp +++ b/src/gromacs/gmxpreprocess/grompp.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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. @@ -196,7 +196,7 @@ static void check_eg_vs_cg(gmx_mtop_t *mtop) } } -static void check_cg_sizes(const char *topfn, const t_block *cgs, warninp_t wi) +static void check_cg_sizes(const char *topfn, const t_block *cgs, warninp *wi) { int maxsize, cg; char warn_buf[STRLEN]; @@ -224,7 +224,7 @@ static void check_cg_sizes(const char *topfn, const t_block *cgs, warninp_t wi) } } -static void check_bonds_timestep(const gmx_mtop_t *mtop, double dt, warninp_t wi) +static void check_bonds_timestep(const gmx_mtop_t *mtop, double dt, warninp *wi) { /* This check is not intended to ensure accurate integration, * rather it is to signal mistakes in the mdp settings. @@ -381,7 +381,7 @@ static void check_vel(gmx_mtop_t *mtop, rvec v[]) static void check_shells_inputrec(gmx_mtop_t *mtop, t_inputrec *ir, - warninp_t wi) + warninp *wi) { gmx_mtop_atomloop_all_t aloop; const t_atom *atom; @@ -499,12 +499,12 @@ static void new_status(const char *topfile, const char *topppfile, const char *confin, t_gromppopts *opts, t_inputrec *ir, gmx_bool bZero, bool bGenVel, bool bVerbose, t_state *state, - gpp_atomtype_t atype, gmx_mtop_t *sys, + gpp_atomtype *atype, gmx_mtop_t *sys, int *nmi, t_molinfo **mi, t_molinfo **intermolecular_interactions, t_params plist[], int *comb, double *reppow, real *fudgeQQ, gmx_bool bMorse, - warninp_t wi) + warninp *wi) { t_molinfo *molinfo = nullptr; std::vector molblock; @@ -820,7 +820,7 @@ static void read_posres(gmx_mtop_t *mtop, t_molinfo *molinfo, gmx_bool bTopB, const char *fn, int rc_scaling, int ePBC, rvec com, - warninp_t wi) + warninp *wi) { gmx_bool *hadAtom; rvec *x, *v; @@ -997,7 +997,7 @@ static void gen_posres(gmx_mtop_t *mtop, t_molinfo *mi, const char *fnA, const char *fnB, int rc_scaling, int ePBC, rvec com, rvec comB, - warninp_t wi) + warninp *wi) { read_posres (mtop, mi, FALSE, fnA, rc_scaling, ePBC, com, wi); /* It is safer to simply read the b-state posres rather than trying @@ -1006,8 +1006,8 @@ static void gen_posres(gmx_mtop_t *mtop, t_molinfo *mi, read_posres(mtop, mi, TRUE, fnB, rc_scaling, ePBC, comB, wi); } -static void set_wall_atomtype(gpp_atomtype_t at, t_gromppopts *opts, - t_inputrec *ir, warninp_t wi) +static void set_wall_atomtype(gpp_atomtype *at, t_gromppopts *opts, + t_inputrec *ir, warninp *wi) { int i; char warn_buf[STRLEN]; @@ -1197,7 +1197,7 @@ static void init_cmap_grid(gmx_cmap_t *cmap_grid, int ngrid, int grid_spacing) } -static int count_constraints(const gmx_mtop_t *mtop, t_molinfo *mi, warninp_t wi) +static int count_constraints(const gmx_mtop_t *mtop, t_molinfo *mi, warninp *wi) { int count, count_mol, i; t_params *plist; @@ -1261,7 +1261,7 @@ static real calc_temp(const gmx_mtop_t *mtop, } static real get_max_reference_temp(const t_inputrec *ir, - warninp_t wi) + warninp *wi) { real ref_t; int i; @@ -1298,7 +1298,7 @@ static real get_max_reference_temp(const t_inputrec *ir, */ static void checkForUnboundAtoms(const gmx_moltype_t *molt, gmx_bool bVerbose, - warninp_t wi) + warninp *wi) { const t_atoms *atoms = &molt->atoms; @@ -1356,7 +1356,7 @@ static void checkForUnboundAtoms(const gmx_moltype_t *molt, /* Checks all moleculetypes for unbound atoms */ static void checkForUnboundAtoms(const gmx_mtop_t *mtop, gmx_bool bVerbose, - warninp_t wi) + warninp *wi) { for (const gmx_moltype_t &molt : mtop->moltype) { @@ -1456,7 +1456,7 @@ static bool haveDecoupledModeInMol(const gmx_moltype_t &molt, */ static void checkDecoupledModeAccuracy(const gmx_mtop_t *mtop, const t_inputrec *ir, - warninp_t wi) + warninp *wi) { /* We only have issues with decoupled modes with normal MD. * With stochastic dynamics equipartitioning is enforced strongly. @@ -1542,7 +1542,7 @@ static void set_verlet_buffer(const gmx_mtop_t *mtop, t_inputrec *ir, real buffer_temp, matrix box, - warninp_t wi) + warninp *wi) { real rlist_1x1; int n_nonlin_vsite; @@ -1689,7 +1689,7 @@ int gmx_grompp(int argc, char *argv[]) t_gromppopts *opts; int nmi; t_molinfo *mi, *intermolecular_interactions; - gpp_atomtype_t atype; + gpp_atomtype *atype; int nvsite, comb; t_params *plist; real fudgeQQ; @@ -1700,7 +1700,7 @@ int gmx_grompp(int argc, char *argv[]) gmx_bool have_atomnumber; gmx_output_env_t *oenv; gmx_bool bVerbose = FALSE; - warninp_t wi; + warninp *wi; char warn_buf[STRLEN]; t_filenm fnm[] = { @@ -2231,7 +2231,7 @@ int gmx_grompp(int argc, char *argv[]) } } - struct pull_t *pull = nullptr; + pull_t *pull = nullptr; if (ir->bPull) { diff --git a/src/gromacs/gmxpreprocess/h_db.cpp b/src/gromacs/gmxpreprocess/h_db.cpp index 71da9aece8..b968c5f3a7 100644 --- a/src/gromacs/gmxpreprocess/h_db.cpp +++ b/src/gromacs/gmxpreprocess/h_db.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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. @@ -46,6 +46,7 @@ #include #include "gromacs/gmxpreprocess/fflibutil.h" +#include "gromacs/gmxpreprocess/hackblock.h" #include "gromacs/gmxpreprocess/notset.h" #include "gromacs/utility/arraysize.h" #include "gromacs/utility/cstringutil.h" diff --git a/src/gromacs/gmxpreprocess/h_db.h b/src/gromacs/gmxpreprocess/h_db.h index c8e2df6f04..2b8d8f6bfc 100644 --- a/src/gromacs/gmxpreprocess/h_db.h +++ b/src/gromacs/gmxpreprocess/h_db.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2011,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2011,2014,2015,2019, 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. @@ -38,9 +38,10 @@ #ifndef GMX_GMXPREPROCESS_H_DB_H #define GMX_GMXPREPROCESS_H_DB_H -#include +#include -#include "gromacs/gmxpreprocess/hackblock.h" +struct t_hack; +struct t_hackblock; /* functions for the h-database */ diff --git a/src/gromacs/gmxpreprocess/hackblock.cpp b/src/gromacs/gmxpreprocess/hackblock.cpp index 7a300f1775..20ea7cb5a8 100644 --- a/src/gromacs/gmxpreprocess/hackblock.cpp +++ b/src/gromacs/gmxpreprocess/hackblock.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2011,2014,2015,2017,2018, by the GROMACS development team, led by + * Copyright (c) 2011,2014,2015,2017,2018,2019, 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. @@ -44,6 +44,7 @@ #include "gromacs/gmxpreprocess/notset.h" #include "gromacs/math/vec.h" #include "gromacs/mdtypes/md_enums.h" +#include "gromacs/topology/atoms.h" #include "gromacs/utility/cstringutil.h" #include "gromacs/utility/fatalerror.h" #include "gromacs/utility/smalloc.h" diff --git a/src/gromacs/gmxpreprocess/hackblock.h b/src/gromacs/gmxpreprocess/hackblock.h index c8553b6bcc..e131452749 100644 --- a/src/gromacs/gmxpreprocess/hackblock.h +++ b/src/gromacs/gmxpreprocess/hackblock.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2018,2019, 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. @@ -38,9 +38,11 @@ #ifndef GMX_GMXPREPROCESS_HACKBLOCK_H #define GMX_GMXPREPROCESS_HACKBLOCK_H -#include "gromacs/gmxpreprocess/gpp_atomtype.h" -#include "gromacs/gmxpreprocess/grompp-impl.h" -#include "gromacs/topology/symtab.h" +#include + +#include "gromacs/topology/ifunc.h" + +struct t_atom; /* Used for reading .rtp/.tdb */ /* ebtsBONDS must be the first, new types can be added to the end */ @@ -55,27 +57,30 @@ extern const int btsNiatoms[ebtsNR]; free/clear/copy/merge_t_* functions stay updated */ /* BONDEDS */ -typedef struct { +struct t_rbonded +{ char *a[MAXATOMLIST]; /* atom names */ char *s; /* optional define string which gets copied from .rtp/.tdb to .top and will be parsed by cpp during grompp */ - bool match; /* boolean to mark that the entry has been found */ + bool match; /* boolean to mark that the entry has been found */ char* &ai() { return a[0]; } char* &aj() { return a[1]; } char* &ak() { return a[2]; } char* &al() { return a[3]; } char* &am() { return a[4]; } -} t_rbonded; +}; -typedef struct { +struct t_rbondeds +{ int type; /* The type of bonded interaction */ int nb; /* number of bondeds */ t_rbonded *b; /* bondeds */ -} t_rbondeds; +}; /* RESIDUES (rtp) */ -typedef struct { +struct t_restp +{ char *resname; /* The base file name this rtp entry was read from */ char *filebase; @@ -91,10 +96,11 @@ typedef struct { bool bRemoveDihedralIfWithImproper; /* list of bonded interactions to add */ t_rbondeds rb[ebtsNR]; -} t_restp; +}; /* Block to hack residues */ -typedef struct { +struct t_hack +{ int nr; /* Number of atoms to hack */ char *oname; /* Old name */ char *nname; /* New name */ @@ -116,9 +122,10 @@ typedef struct { char* &aj() { return a[1]; } char* &ak() { return a[2]; } char* &al() { return a[3]; } -} t_hack; +}; -typedef struct { +struct t_hackblock +{ char *name; /* Name of hack block (residue or terminus) */ char *filebase; /* The base file name this entry was read from */ int nhack; /* Number of atoms to hack */ @@ -126,18 +133,7 @@ typedef struct { t_hack *hack; /* Hack list */ /* list of bonded interactions to add */ t_rbondeds rb[ebtsNR]; -} t_hackblock; - -typedef struct { - char *res1, *res2; - char *atom1, *atom2; - char *newres1, *newres2; - int nbond1, nbond2; - real length; -} t_specbond; - -t_specbond *get_specbonds(int *nspecbond); -void done_specbonds(int nsb, t_specbond sb[]); +}; void free_t_restp(int nrtp, t_restp **rtp); void free_t_hack(int nh, t_hack **h); diff --git a/src/gromacs/gmxpreprocess/hizzie.h b/src/gromacs/gmxpreprocess/hizzie.h index 7de66843a9..4f70d6f49f 100644 --- a/src/gromacs/gmxpreprocess/hizzie.h +++ b/src/gromacs/gmxpreprocess/hizzie.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017,2019, 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. @@ -39,7 +39,9 @@ #define GMX_GMXPREPROCESS_HIZZIE_H #include "gromacs/math/vectypes.h" -#include "gromacs/topology/atoms.h" +#include "gromacs/utility/real.h" + +struct t_atoms; void set_histp(t_atoms *pdba, rvec *x, real angle, real distance); /* calculate HIStidine protonation state */ diff --git a/src/gromacs/gmxpreprocess/nm2type.cpp b/src/gromacs/gmxpreprocess/nm2type.cpp index a952ee5d1c..836cec2227 100644 --- a/src/gromacs/gmxpreprocess/nm2type.cpp +++ b/src/gromacs/gmxpreprocess/nm2type.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2008, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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. @@ -49,6 +49,7 @@ #include "gromacs/gmxpreprocess/fflibutil.h" #include "gromacs/gmxpreprocess/gpp_atomtype.h" #include "gromacs/gmxpreprocess/gpp_nextnb.h" +#include "gromacs/gmxpreprocess/grompp-impl.h" #include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/pdb2top.h" #include "gromacs/gmxpreprocess/toppush.h" @@ -190,8 +191,8 @@ static int match_str(const char *atom, const char *template_string) } } -int nm2type(int nnm, t_nm2type nm2t[], struct t_symtab *tab, t_atoms *atoms, - gpp_atomtype_t atype, int *nbonds, t_params *bonds) +int nm2type(int nnm, t_nm2type nm2t[], t_symtab *tab, t_atoms *atoms, + gpp_atomtype *atype, int *nbonds, t_params *bonds) { int cur = 0; #define prev (1-cur) diff --git a/src/gromacs/gmxpreprocess/nm2type.h b/src/gromacs/gmxpreprocess/nm2type.h index e86af8228d..d9973d57ee 100644 --- a/src/gromacs/gmxpreprocess/nm2type.h +++ b/src/gromacs/gmxpreprocess/nm2type.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2008, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2019, 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. @@ -37,19 +37,21 @@ #ifndef GMX_GMX_NM2TYPE_H #define GMX_GMX_NM2TYPE_H -#include +#include -#include "gromacs/gmxpreprocess/gpp_atomtype.h" -#include "gromacs/gmxpreprocess/grompp-impl.h" -#include "gromacs/topology/atoms.h" +struct gpp_atomtype; +struct t_atoms; +struct t_params; +struct t_symtab; -typedef struct { +struct t_nm2type +{ char *elem, *type; double q, m; int nbonds; char **bond; double *blen; -} t_nm2type; +}; t_nm2type *rd_nm2type(const char *ffdir, int *nnm); /* Read the name 2 type database. nnm is the number of entries @@ -59,8 +61,8 @@ t_nm2type *rd_nm2type(const char *ffdir, int *nnm); void dump_nm2type(FILE *fp, int nnm, t_nm2type nm2t[]); /* Dump the database for debugging. Can be reread by the program */ -int nm2type(int nnm, t_nm2type nm2t[], struct t_symtab *tab, t_atoms *atoms, - gpp_atomtype_t atype, int *nbonds, t_params *bond); +int nm2type(int nnm, t_nm2type nm2t[], t_symtab *tab, t_atoms *atoms, + gpp_atomtype *atype, int *nbonds, t_params *bond); /* Try to determine the atomtype (force field dependent) for the atoms * with help of the bond list */ diff --git a/src/gromacs/gmxpreprocess/pdb2gmx.cpp b/src/gromacs/gmxpreprocess/pdb2gmx.cpp index 3173e36291..db4ab8b0c5 100644 --- a/src/gromacs/gmxpreprocess/pdb2gmx.cpp +++ b/src/gromacs/gmxpreprocess/pdb2gmx.cpp @@ -56,7 +56,9 @@ #include "gromacs/gmxlib/conformation-utilities.h" #include "gromacs/gmxpreprocess/fflibutil.h" #include "gromacs/gmxpreprocess/genhydro.h" +#include "gromacs/gmxpreprocess/grompp-impl.h" #include "gromacs/gmxpreprocess/h_db.h" +#include "gromacs/gmxpreprocess/hackblock.h" #include "gromacs/gmxpreprocess/hizzie.h" #include "gromacs/gmxpreprocess/pdb2top.h" #include "gromacs/gmxpreprocess/pgutil.h" @@ -1967,7 +1969,7 @@ int pdb2gmx::run() check_occupancy(&pdba_all, inputConfFile_.c_str(), bVerbose_); /* Read atomtypes... */ - gpp_atomtype_t atype = read_atype(ffdir_, &symtab); + gpp_atomtype *atype = read_atype(ffdir_, &symtab); /* read residue database */ printf("Reading residue database... (%s)\n", forcefield_); diff --git a/src/gromacs/gmxpreprocess/pdb2top.cpp b/src/gromacs/gmxpreprocess/pdb2top.cpp index 34d23a85c4..b1a28cc152 100644 --- a/src/gromacs/gmxpreprocess/pdb2top.cpp +++ b/src/gromacs/gmxpreprocess/pdb2top.cpp @@ -53,10 +53,13 @@ #include "gromacs/gmxpreprocess/gen_ad.h" #include "gromacs/gmxpreprocess/gen_vsite.h" #include "gromacs/gmxpreprocess/gpp_nextnb.h" +#include "gromacs/gmxpreprocess/grompp-impl.h" #include "gromacs/gmxpreprocess/h_db.h" +#include "gromacs/gmxpreprocess/hackblock.h" #include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/pgutil.h" #include "gromacs/gmxpreprocess/resall.h" +#include "gromacs/gmxpreprocess/specbond.h" #include "gromacs/gmxpreprocess/topdirs.h" #include "gromacs/gmxpreprocess/topio.h" #include "gromacs/gmxpreprocess/toputil.h" @@ -673,7 +676,7 @@ void print_top_mols(FILE *out, void write_top(FILE *out, const char *pr, const char *molname, t_atoms *at, bool bRTPresname, int bts[], t_params plist[], t_excls excls[], - gpp_atomtype_t atype, int *cgnr, int nrexcl) + gpp_atomtype *atype, int *cgnr, int nrexcl) /* NOTE: nrexcl is not the size of *excl! */ { if (at && atype && cgnr) @@ -1502,7 +1505,7 @@ scrub_charge_groups(int *cgnr, int natoms) void pdb2top(FILE *top_file, const char *posre_fn, const char *molname, - t_atoms *atoms, rvec **x, gpp_atomtype_t atype, t_symtab *tab, + t_atoms *atoms, rvec **x, gpp_atomtype *atype, t_symtab *tab, int nrtp, t_restp rtp[], t_restp *restp, t_hackblock *hb, bool bAllowMissing, diff --git a/src/gromacs/gmxpreprocess/pdb2top.h b/src/gromacs/gmxpreprocess/pdb2top.h index e20b973ffa..ea29fe1ded 100644 --- a/src/gromacs/gmxpreprocess/pdb2top.h +++ b/src/gromacs/gmxpreprocess/pdb2top.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2018,2019, 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. @@ -38,10 +38,20 @@ #ifndef GMX_GMXPREPROCESS_PDB2TOP_H #define GMX_GMXPREPROCESS_PDB2TOP_H -#include "gromacs/gmxpreprocess/gpp_atomtype.h" -#include "gromacs/gmxpreprocess/grompp-impl.h" -#include "gromacs/gmxpreprocess/hackblock.h" -#include "gromacs/gmxpreprocess/toputil.h" +#include + +#include "gromacs/math/vectypes.h" + +struct gpp_atomtype; +struct t_atoms; +struct t_excls; +struct t_hackblock; +struct t_mols; +struct t_params; +struct t_resinfo; +struct t_restp; +struct t_ssbond; +struct t_symtab; /* this *MUST* correspond to array in pdb2top.c */ enum { @@ -49,11 +59,6 @@ enum { }; extern const char *hh[ehisNR]; -typedef struct { - int res1, res2; - char *a1, *a2; -} t_ssbond; - void choose_ff(const char *ffsel, char *forcefield, int ff_maxlen, char *ffdir, int ffdir_maxlen); @@ -101,12 +106,12 @@ void print_top_mols(FILE *out, void write_top(FILE *out, const char *pr, const char *molname, t_atoms *at, bool bRTPresname, int bts[], t_params plist[], t_excls excls[], - gpp_atomtype_t atype, int *cgnr, int nrexcl); + gpp_atomtype *atype, int *cgnr, int nrexcl); /* NOTE: nrexcl is not the size of *excl! */ void pdb2top(FILE *top_file, const char *posre_fn, const char *molname, t_atoms *atoms, rvec **x, - gpp_atomtype_t atype, struct t_symtab *tab, + gpp_atomtype *atype, t_symtab *tab, int nrtp, t_restp rtp[], t_restp *restp, t_hackblock *hb, bool bAllowMissing, diff --git a/src/gromacs/gmxpreprocess/readir.h b/src/gromacs/gmxpreprocess/readir.h index 963f16dddd..e5508a3996 100644 --- a/src/gromacs/gmxpreprocess/readir.h +++ b/src/gromacs/gmxpreprocess/readir.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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. @@ -39,7 +39,8 @@ #define GMX_GMXPREPROCESS_READIR_H #include "gromacs/fileio/readinp.h" -#include "gromacs/gmxpreprocess/grompp-impl.h" +#include "gromacs/math/vectypes.h" +#include "gromacs/utility/real.h" namespace gmx { @@ -51,6 +52,7 @@ struct gmx_mtop_t; struct gmx_output_env_t; struct pull_params_t; struct pull_t; +struct t_blocka; struct t_grpopts; struct t_inpfile; struct t_inputrec; diff --git a/src/gromacs/gmxpreprocess/resall.cpp b/src/gromacs/gmxpreprocess/resall.cpp index a2294135cd..0c67d5abd6 100644 --- a/src/gromacs/gmxpreprocess/resall.cpp +++ b/src/gromacs/gmxpreprocess/resall.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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. @@ -47,8 +47,12 @@ #include #include "gromacs/gmxpreprocess/fflibutil.h" +#include "gromacs/gmxpreprocess/gpp_atomtype.h" +#include "gromacs/gmxpreprocess/grompp-impl.h" +#include "gromacs/gmxpreprocess/hackblock.h" #include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/pgutil.h" +#include "gromacs/topology/atoms.h" #include "gromacs/topology/symtab.h" #include "gromacs/utility/cstringutil.h" #include "gromacs/utility/fatalerror.h" @@ -56,13 +60,13 @@ #include "gromacs/utility/smalloc.h" #include "gromacs/utility/strdb.h" -gpp_atomtype_t read_atype(const char *ffdir, t_symtab *tab) +gpp_atomtype *read_atype(const char *ffdir, t_symtab *tab) { FILE *in; char buf[STRLEN], name[STRLEN]; double m; int nratt = 0; - gpp_atomtype_t at; + gpp_atomtype *at; t_atom *a; t_param *nb; @@ -106,7 +110,7 @@ gpp_atomtype_t read_atype(const char *ffdir, t_symtab *tab) return at; } -static void print_resatoms(FILE *out, gpp_atomtype_t atype, t_restp *rtp) +static void print_resatoms(FILE *out, gpp_atomtype *atype, t_restp *rtp) { int j, tp; char *tpnm; @@ -130,7 +134,7 @@ static void print_resatoms(FILE *out, gpp_atomtype_t atype, t_restp *rtp) } static bool read_atoms(FILE *in, char *line, - t_restp *r0, t_symtab *tab, gpp_atomtype_t atype) + t_restp *r0, t_symtab *tab, gpp_atomtype *atype) { int i, j, cg, maxentries; char buf[256], buf1[256]; @@ -294,7 +298,7 @@ static void print_resall_header(FILE *out, t_restp rtp[]) } void print_resall(FILE *out, int nrtp, t_restp rtp[], - gpp_atomtype_t atype) + gpp_atomtype *atype) { int i, bt; @@ -319,7 +323,7 @@ void print_resall(FILE *out, int nrtp, t_restp rtp[], } void read_resall(const char *rrdb, int *nrtpptr, t_restp **rtp, - gpp_atomtype_t atype, t_symtab *tab, + gpp_atomtype *atype, t_symtab *tab, bool bAllowOverrideRTP) { FILE *in; diff --git a/src/gromacs/gmxpreprocess/resall.h b/src/gromacs/gmxpreprocess/resall.h index df7bc35f91..8a59c0a773 100644 --- a/src/gromacs/gmxpreprocess/resall.h +++ b/src/gromacs/gmxpreprocess/resall.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2010,2014,2015,2018, by the GROMACS development team, led by + * Copyright (c) 2010,2014,2015,2018,2019, 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. @@ -38,9 +38,11 @@ #ifndef GMX_GMXPREPROCESS_RESALL_H #define GMX_GMXPREPROCESS_RESALL_H -#include "gromacs/gmxpreprocess/gpp_atomtype.h" -#include "gromacs/gmxpreprocess/grompp-impl.h" -#include "gromacs/gmxpreprocess/hackblock.h" +#include + +struct gpp_atomtype; +struct t_restp; +struct t_symtab; char *search_rtp(const char *key, int nrtp, t_restp rtp[]); /* Search for an entry in the rtp database, returns the rtp residue name. @@ -53,16 +55,16 @@ t_restp *get_restp(const char *rtpname, int nrtp, t_restp rtp[]); * Generates a fatal error when rtpname is not found. */ -gpp_atomtype_t read_atype(const char *ffdir, struct t_symtab *tab); +gpp_atomtype *read_atype(const char *ffdir, t_symtab *tab); /* read atom type database(s) */ void read_resall(const char *resdb, int *nrtp, t_restp **rtp, - gpp_atomtype_t atype, struct t_symtab *tab, + gpp_atomtype *atype, t_symtab *tab, bool bAllowOverrideRTP); /* read rtp database, append to the existing database */ void print_resall(FILE *out, int nrtp, t_restp rtp[], - gpp_atomtype_t atype); + gpp_atomtype *atype); /* write rtp database */ #endif diff --git a/src/gromacs/gmxpreprocess/specbond.cpp b/src/gromacs/gmxpreprocess/specbond.cpp index a7e9ee784a..e4f303244d 100644 --- a/src/gromacs/gmxpreprocess/specbond.cpp +++ b/src/gromacs/gmxpreprocess/specbond.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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. @@ -52,6 +52,15 @@ #include "gromacs/utility/smalloc.h" #include "gromacs/utility/strdb.h" +struct t_specbond +{ + char *res1, *res2; + char *atom1, *atom2; + char *newres1, *newres2; + int nbond1, nbond2; + real length; +}; + bool yesno() { char c; diff --git a/src/gromacs/gmxpreprocess/specbond.h b/src/gromacs/gmxpreprocess/specbond.h index fc0de3519f..10eb17839f 100644 --- a/src/gromacs/gmxpreprocess/specbond.h +++ b/src/gromacs/gmxpreprocess/specbond.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2018,2019, 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. @@ -38,11 +38,23 @@ #ifndef GMX_GMXPREPROCESS_SPECBOND_H #define GMX_GMXPREPROCESS_SPECBOND_H -#include "gromacs/gmxpreprocess/pdb2top.h" +#include "gromacs/math/vectypes.h" + +struct t_atoms; +struct t_specbond; + +struct t_ssbond +{ + int res1, res2; + char *a1, *a2; +}; int mk_specbonds(t_atoms *pdba, rvec x[], bool bInteractive, t_ssbond **specbonds, bool bVerbose); +t_specbond *get_specbonds(int *nspecbond); +void done_specbonds(int nsb, t_specbond sb[]); + bool yesno(); #endif diff --git a/src/gromacs/gmxpreprocess/ter_db.cpp b/src/gromacs/gmxpreprocess/ter_db.cpp index eb2f80a066..866f810368 100644 --- a/src/gromacs/gmxpreprocess/ter_db.cpp +++ b/src/gromacs/gmxpreprocess/ter_db.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2017,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017,2018,2019, 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. @@ -46,7 +46,10 @@ #include "gromacs/fileio/gmxfio.h" #include "gromacs/gmxpreprocess/fflibutil.h" +#include "gromacs/gmxpreprocess/gpp_atomtype.h" +#include "gromacs/gmxpreprocess/grompp-impl.h" #include "gromacs/gmxpreprocess/h_db.h" +#include "gromacs/gmxpreprocess/hackblock.h" #include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/resall.h" #include "gromacs/gmxpreprocess/toputil.h" @@ -90,7 +93,7 @@ static int find_kw(char *keyw) #define FATAL() gmx_fatal(FARGS, "Reading Termini Database: not enough items on line\n%s", line) static void read_atom(char *line, bool bAdd, - char **nname, t_atom *a, gpp_atomtype_t atype, int *cgnr) + char **nname, t_atom *a, gpp_atomtype *atype, int *cgnr) { int nr, i; char buf[5][30]; @@ -143,14 +146,14 @@ static void read_atom(char *line, bool bAdd, } } -static void print_atom(FILE *out, t_atom *a, gpp_atomtype_t atype) +static void print_atom(FILE *out, t_atom *a, gpp_atomtype *atype) { fprintf(out, "\t%s\t%g\t%g\n", get_atomtype_name(a->type, atype), a->m, a->q); } static void print_ter_db(const char *ff, char C, int nb, t_hackblock tb[], - gpp_atomtype_t atype) + gpp_atomtype *atype) { FILE *out; int i, j, k, bt, nrepl, nadd, ndel; @@ -247,7 +250,7 @@ static void print_ter_db(const char *ff, char C, int nb, t_hackblock tb[], static void read_ter_db_file(const char *fn, int *ntbptr, t_hackblock **tbptr, - gpp_atomtype_t atype) + gpp_atomtype *atype) { char filebase[STRLEN], *ptr; FILE *in; @@ -403,7 +406,7 @@ static void read_ter_db_file(const char *fn, } int read_ter_db(const char *ffdir, char ter, - t_hackblock **tbptr, gpp_atomtype_t atype) + t_hackblock **tbptr, gpp_atomtype *atype) { char ext[STRLEN]; int ntb; diff --git a/src/gromacs/gmxpreprocess/ter_db.h b/src/gromacs/gmxpreprocess/ter_db.h index 50ef9bf6ca..c30d616c6a 100644 --- a/src/gromacs/gmxpreprocess/ter_db.h +++ b/src/gromacs/gmxpreprocess/ter_db.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2011,2014,2015,2018, by the GROMACS development team, led by + * Copyright (c) 2011,2014,2015,2018,2019, 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. @@ -38,12 +38,11 @@ #ifndef GMX_GMXPREPROCESS_TER_DB_H #define GMX_GMXPREPROCESS_TER_DB_H -#include "gromacs/gmxpreprocess/grompp-impl.h" -#include "gromacs/gmxpreprocess/hackblock.h" - +struct gpp_atomtype; +struct t_hackblock; int read_ter_db(const char *ffdir, char ter, - t_hackblock **tbptr, gpp_atomtype_t atype); + t_hackblock **tbptr, gpp_atomtype *atype); /* Read database for N&C terminal hacking */ t_hackblock **filter_ter(int nb, t_hackblock tb[], diff --git a/src/gromacs/gmxpreprocess/tomorse.cpp b/src/gromacs/gmxpreprocess/tomorse.cpp index 7f732196be..7cef8dfee7 100644 --- a/src/gromacs/gmxpreprocess/tomorse.cpp +++ b/src/gromacs/gmxpreprocess/tomorse.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2017,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017,2018,2019, 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. @@ -187,7 +187,7 @@ static real search_e_diss(int n2m, t_2morse t2m[], char *ai, char *aj) } } -void convert_harmonics(int nrmols, t_molinfo mols[], gpp_atomtype_t atype) +void convert_harmonics(int nrmols, t_molinfo mols[], gpp_atomtype *atype) { int n2m; t_2morse *t2m; diff --git a/src/gromacs/gmxpreprocess/tomorse.h b/src/gromacs/gmxpreprocess/tomorse.h index 7d94dc29c6..778e477cbc 100644 --- a/src/gromacs/gmxpreprocess/tomorse.h +++ b/src/gromacs/gmxpreprocess/tomorse.h @@ -3,7 +3,7 @@ * * 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) 2012,2013,2014,2015,2019, 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. @@ -38,11 +38,9 @@ #ifndef GMX_GMXPREPROCESS_TOMORSE_H #define GMX_GMXPREPROCESS_TOMORSE_H -#include +struct gpp_atomtype; +struct t_molinfo; -#include "gromacs/gmxpreprocess/gpp_atomtype.h" -#include "gromacs/gmxpreprocess/grompp-impl.h" - -void convert_harmonics(int nrmols, t_molinfo mols[], gpp_atomtype_t atype); +void convert_harmonics(int nrmols, t_molinfo mols[], gpp_atomtype *atype); #endif diff --git a/src/gromacs/gmxpreprocess/topdirs.h b/src/gromacs/gmxpreprocess/topdirs.h index 641d9114d7..e869439aca 100644 --- a/src/gromacs/gmxpreprocess/topdirs.h +++ b/src/gromacs/gmxpreprocess/topdirs.h @@ -85,10 +85,11 @@ enum class Directive : int Count }; -typedef struct tagDirStack { +struct DirStack +{ Directive d; - struct tagDirStack *prev; -} DirStack; + DirStack *prev; +}; int ifunc_index(Directive d, int type); diff --git a/src/gromacs/gmxpreprocess/topio.cpp b/src/gromacs/gmxpreprocess/topio.cpp index 459f771cd0..c6b541c00c 100644 --- a/src/gromacs/gmxpreprocess/topio.cpp +++ b/src/gromacs/gmxpreprocess/topio.cpp @@ -54,6 +54,7 @@ #include "gromacs/fileio/gmxfio.h" #include "gromacs/fileio/warninp.h" #include "gromacs/gmxpreprocess/gmxcpp.h" +#include "gromacs/gmxpreprocess/gpp_atomtype.h" #include "gromacs/gmxpreprocess/gpp_bond_atomtype.h" #include "gromacs/gmxpreprocess/gpp_nextnb.h" #include "gromacs/gmxpreprocess/grompp-impl.h" @@ -83,47 +84,6 @@ #define OPENDIR '[' /* starting sign for directive */ #define CLOSEDIR ']' /* ending sign for directive */ -static void free_nbparam(t_nbparam **param, int nr) -{ - int i; - - assert(param); - for (i = 0; i < nr; i++) - { - assert(param[i]); - sfree(param[i]); - } - sfree(param); -} - -static int copy_nbparams(t_nbparam **param, int ftype, t_params *plist, int nr) -{ - int i, j, f; - int nrfp, ncopy; - - nrfp = NRFP(ftype); - - ncopy = 0; - for (i = 0; i < nr; i++) - { - for (j = 0; j <= i; j++) - { - assert(param); - if (param[i][j].bSet) - { - for (f = 0; f < nrfp; f++) - { - plist->param[nr*i+j].c[f] = param[i][j].c[f]; - plist->param[nr*j+i].c[f] = param[i][j].c[f]; - } - ncopy++; - } - } - } - - return ncopy; -} - static void gen_pairs(t_params *nbs, t_params *pairs, real fudge, int comb) { int i, j, ntp, nrfp, nrfpA, nrfpB, nnn; @@ -177,7 +137,7 @@ static void gen_pairs(t_params *nbs, t_params *pairs, real fudge, int comb) } } -double check_mol(const gmx_mtop_t *mtop, warninp_t wi) +double check_mol(const gmx_mtop_t *mtop, warninp *wi) { char buf[256]; int i, ri, pt; @@ -283,7 +243,7 @@ static void sum_q(const t_atoms *atoms, int numMols, } static void get_nbparm(char *nb_str, char *comb_str, int *nb, int *comb, - warninp_t wi) + warninp *wi) { int i; char warn_buf[STRLEN]; @@ -329,7 +289,7 @@ static void get_nbparm(char *nb_str, char *comb_str, int *nb, int *comb, } static char ** cpp_opts(const char *define, const char *include, - warninp_t wi) + warninp *wi) { int n, len; int ncppopts = 0; @@ -416,7 +376,7 @@ static void make_atoms_sys(const std::vector &molblock, static char **read_topol(const char *infile, const char *outfile, const char *define, const char *include, t_symtab *symtab, - gpp_atomtype_t atype, + gpp_atomtype *atype, int *nrmols, t_molinfo **molinfo, t_molinfo **intermolecular_interactions, @@ -430,7 +390,7 @@ static char **read_topol(const char *infile, const char *outfile, bool bFEP, bool bZero, bool usingFullRangeElectrostatics, - warninp_t wi) + warninp *wi) { FILE *out; int i, sl, nb_funct; @@ -448,7 +408,7 @@ static char **read_topol(const char *infile, const char *outfile, real fudgeLJ = -1; /* Multiplication factor to generate 1-4 from LJ */ bool bReadDefaults, bReadMolType, bGenPairs, bWarn_copy_A_B; double qt = 0, qBt = 0; /* total charge */ - t_bond_atomtype batype; + gpp_bond_atomtype *batype; int lastcg = -1; int dcatt = -1, nmol_couple; /* File handling variables */ @@ -992,14 +952,14 @@ char **do_top(bool bVerbose, int *combination_rule, double *repulsion_power, real *fudgeQQ, - gpp_atomtype_t atype, + gpp_atomtype *atype, int *nrmols, t_molinfo **molinfo, t_molinfo **intermolecular_interactions, const t_inputrec *ir, std::vector *molblock, bool *ffParametrizedWithHBondConstraints, - warninp_t wi) + warninp *wi) { /* Tmpfile might contain a long path */ const char *tmpfile; @@ -1356,7 +1316,7 @@ static void generate_qmexcl_moltype(gmx_moltype_t *molt, const unsigned char *gr free(blink); } /* generate_qmexcl */ -void generate_qmexcl(gmx_mtop_t *sys, t_inputrec *ir, warninp_t wi, GmxQmmmMode qmmmMode) +void generate_qmexcl(gmx_mtop_t *sys, t_inputrec *ir, warninp *wi, GmxQmmmMode qmmmMode) { /* This routine expects molt->molt[m].ilist to be of size F_NRE and ordered. */ diff --git a/src/gromacs/gmxpreprocess/topio.h b/src/gromacs/gmxpreprocess/topio.h index fd9c620cd5..c3ec5d5ff3 100644 --- a/src/gromacs/gmxpreprocess/topio.h +++ b/src/gromacs/gmxpreprocess/topio.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2014,2015,2016,2018, by the GROMACS development team, led by + * Copyright (c) 2012,2014,2015,2016,2018,2019, 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. @@ -40,13 +40,16 @@ #include -#include "gromacs/gmxpreprocess/gpp_atomtype.h" -#include "gromacs/gmxpreprocess/grompp-impl.h" +#include "gromacs/utility/real.h" struct gmx_molblock_t; struct gmx_mtop_t; +struct gpp_atomtype; struct t_gromppopts; struct t_inputrec; +struct t_molinfo; +struct t_params; +struct t_symtab; struct warninp; enum struct GmxQmmmMode; typedef warninp *warninp_t; @@ -59,12 +62,12 @@ char **do_top(bool bVerbose, const char *topppfile, t_gromppopts *opts, bool bZero, - struct t_symtab *symtab, + t_symtab *symtab, t_params plist[], int *combination_rule, double *repulsion_power, real *fudgeQQ, - gpp_atomtype_t atype, + gpp_atomtype *atype, int *nrmols, t_molinfo **molinfo, t_molinfo **intermolecular_interactions, diff --git a/src/gromacs/gmxpreprocess/toppush.cpp b/src/gromacs/gmxpreprocess/toppush.cpp index 7b959406f6..6828bb0703 100644 --- a/src/gromacs/gmxpreprocess/toppush.cpp +++ b/src/gromacs/gmxpreprocess/toppush.cpp @@ -49,6 +49,7 @@ #include "gromacs/fileio/warninp.h" #include "gromacs/gmxpreprocess/gpp_atomtype.h" #include "gromacs/gmxpreprocess/gpp_bond_atomtype.h" +#include "gromacs/gmxpreprocess/grompp-impl.h" #include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/readir.h" #include "gromacs/gmxpreprocess/topdirs.h" @@ -65,8 +66,8 @@ #include "gromacs/utility/smalloc.h" #include "gromacs/utility/stringutil.h" -void generate_nbparams(int comb, int ftype, t_params *plist, gpp_atomtype_t atype, - warninp_t wi) +void generate_nbparams(int comb, int ftype, t_params *plist, gpp_atomtype *atype, + warninp *wi) { int i, j, k = -1, nf; int nr, nrfp; @@ -190,7 +191,17 @@ void generate_nbparams(int comb, int ftype, t_params *plist, gpp_atomtype_t atyp } } -static void realloc_nb_params(gpp_atomtype_t at, +/*! \brief Used to temporarily store the explicit non-bonded parameter + * combinations, which will be copied to t_params. */ +struct t_nbparam +{ + //! Has this combination been set. + bool bSet; + //! The non-bonded parameters + real c[4]; +}; + +static void realloc_nb_params(gpp_atomtype *at, t_nbparam ***nbparam, t_nbparam ***pair) { /* Add space in the non-bonded parameters matrix */ @@ -204,6 +215,47 @@ static void realloc_nb_params(gpp_atomtype_t at, } } +int copy_nbparams(t_nbparam **param, int ftype, t_params *plist, int nr) +{ + int i, j, f; + int nrfp, ncopy; + + nrfp = NRFP(ftype); + + ncopy = 0; + for (i = 0; i < nr; i++) + { + for (j = 0; j <= i; j++) + { + GMX_RELEASE_ASSERT(param, "Must have valid parameters"); + if (param[i][j].bSet) + { + for (f = 0; f < nrfp; f++) + { + plist->param[nr*i+j].c[f] = param[i][j].c[f]; + plist->param[nr*j+i].c[f] = param[i][j].c[f]; + } + ncopy++; + } + } + } + + return ncopy; +} + +void free_nbparam(t_nbparam **param, int nr) +{ + int i; + + GMX_RELEASE_ASSERT(param, "Must have valid parameters"); + for (i = 0; i < nr; i++) + { + GMX_RELEASE_ASSERT(param[i], "Must have valid parameters"); + sfree(param[i]); + } + sfree(param); +} + static void copy_B_from_A(int ftype, double *c) { int nrfpA, nrfpB, i; @@ -218,10 +270,10 @@ static void copy_B_from_A(int ftype, double *c) } } -void push_at (t_symtab *symtab, gpp_atomtype_t at, t_bond_atomtype bat, +void push_at (t_symtab *symtab, gpp_atomtype *at, gpp_bond_atomtype *bat, char *line, int nb_funct, t_nbparam ***nbparam, t_nbparam ***pair, - warninp_t wi) + warninp *wi) { typedef struct { const char *entry; @@ -535,7 +587,7 @@ static void push_bondtype(t_params * bt, int ftype, bool bAllowRepeat, const char * line, - warninp_t wi) + warninp *wi) { int nr = bt->nr; int nrfp = NRFP(ftype); @@ -664,9 +716,9 @@ static void push_bondtype(t_params * bt, } void push_bt(Directive d, t_params bt[], int nral, - gpp_atomtype_t at, - t_bond_atomtype bat, char *line, - warninp_t wi) + gpp_atomtype *at, + gpp_bond_atomtype *bat, char *line, + warninp *wi) { const char *formal[MAXATOMLIST+1] = { "%s", @@ -764,8 +816,8 @@ void push_bt(Directive d, t_params bt[], int nral, void push_dihedraltype(Directive d, t_params bt[], - t_bond_atomtype bat, char *line, - warninp_t wi) + gpp_bond_atomtype *bat, char *line, + warninp *wi) { const char *formal[MAXATOMLIST+1] = { "%s", @@ -932,9 +984,9 @@ void push_dihedraltype(Directive d, t_params bt[], } -void push_nbt(Directive d, t_nbparam **nbt, gpp_atomtype_t atype, +void push_nbt(Directive d, t_nbparam **nbt, gpp_atomtype *atype, char *pline, int nb_funct, - warninp_t wi) + warninp *wi) { /* swap the atoms */ const char *form3 = "%*s%*s%*s%lf%lf%lf"; @@ -1059,9 +1111,9 @@ void push_nbt(Directive d, t_nbparam **nbt, gpp_atomtype_t atype, } void -push_cmaptype(Directive d, t_params bt[], int nral, gpp_atomtype_t at, - t_bond_atomtype bat, char *line, - warninp_t wi) +push_cmaptype(Directive d, t_params bt[], int nral, gpp_atomtype *at, + gpp_bond_atomtype *bat, char *line, + warninp *wi) { const char *formal = "%s%s%s%s%s%s%s%s%n"; @@ -1210,7 +1262,7 @@ static void push_atom_now(t_symtab *symtab, t_atoms *at, int atomnr, char *resnumberic, char *resname, char *name, real m0, real q0, int typeB, char *ctypeB, real mB, real qB, - warninp_t wi) + warninp *wi) { int j, resind = 0, resnr; unsigned char ric; @@ -1306,8 +1358,8 @@ static void push_cg(t_block *block, int *lastindex, int index, int a) } void push_atom(t_symtab *symtab, t_block *cgs, - t_atoms *at, gpp_atomtype_t atype, char *line, int *lastcg, - warninp_t wi) + t_atoms *at, gpp_atomtype *atype, char *line, int *lastcg, + warninp *wi) { int nr, ptype; int cgnumber, atomnr, type, typeB, nscan; @@ -1386,7 +1438,7 @@ void push_atom(t_symtab *symtab, t_block *cgs, } void push_molt(t_symtab *symtab, int *nmol, t_molinfo **mol, char *line, - warninp_t wi) + warninp *wi) { char type[STRLEN]; int nrexcl, i; @@ -1516,10 +1568,10 @@ static bool default_nb_params(int ftype, t_params bt[], t_atoms *at, } static bool default_cmap_params(t_params bondtype[], - t_atoms *at, gpp_atomtype_t atype, + t_atoms *at, gpp_atomtype *atype, t_param *p, bool bB, int *cmap_type, int *nparam_def, - warninp_t wi) + warninp *wi) { int i, nparam_found; int ct; @@ -1591,7 +1643,7 @@ static int natom_match(t_param *pi, } static bool default_params(int ftype, t_params bt[], - t_atoms *at, gpp_atomtype_t atype, + t_atoms *at, gpp_atomtype *atype, t_param *p, bool bB, t_param **param_def, int *nparam_def) @@ -1710,10 +1762,10 @@ static bool default_params(int ftype, t_params bt[], void push_bond(Directive d, t_params bondtype[], t_params bond[], - t_atoms *at, gpp_atomtype_t atype, char *line, + t_atoms *at, gpp_atomtype *atype, char *line, bool bBonded, bool bGenPairs, real fudgeQQ, bool bZero, bool *bWarn_copy_A_B, - warninp_t wi) + warninp *wi) { const char *aaformat[MAXATOMLIST] = { "%d%d", @@ -2118,8 +2170,8 @@ void push_bond(Directive d, t_params bondtype[], t_params bond[], } void push_cmap(Directive d, t_params bondtype[], t_params bond[], - t_atoms *at, gpp_atomtype_t atype, char *line, - warninp_t wi) + t_atoms *at, gpp_atomtype *atype, char *line, + warninp *wi) { const char *aaformat[MAXATOMLIST+1] = { @@ -2212,7 +2264,7 @@ void push_cmap(Directive d, t_params bondtype[], t_params bond[], void push_vsitesn(Directive d, t_params bond[], t_atoms *at, char *line, - warninp_t wi) + warninp *wi) { char *ptr; int type, ftype, j, n, ret, nj, a; @@ -2321,7 +2373,7 @@ void push_vsitesn(Directive d, t_params bond[], void push_mol(int nrmols, t_molinfo mols[], char *pline, int *whichmol, int *nrcopies, - warninp_t wi) + warninp *wi) { char type[STRLEN]; @@ -2385,7 +2437,7 @@ void push_mol(int nrmols, t_molinfo mols[], char *pline, int *whichmol, } } -void push_excl(char *line, gmx::ExclusionBlocks *b2, warninp_t wi) +void push_excl(char *line, gmx::ExclusionBlocks *b2, warninp *wi) { int i, j; int n; @@ -2432,7 +2484,7 @@ void push_excl(char *line, gmx::ExclusionBlocks *b2, warninp_t wi) while (n == 1); } -int add_atomtype_decoupled(t_symtab *symtab, gpp_atomtype_t at, +int add_atomtype_decoupled(t_symtab *symtab, gpp_atomtype *at, t_nbparam ***nbparam, t_nbparam ***pair) { t_atom atom; @@ -2524,7 +2576,7 @@ static void convert_pairs_to_pairsQ(t_params *plist, plist[F_LJ14].param = nullptr; } -static void generate_LJCpairsNB(t_molinfo *mol, int nb_funct, t_params *nbp, warninp_t wi) +static void generate_LJCpairsNB(t_molinfo *mol, int nb_funct, t_params *nbp, warninp *wi) { int n, ntype, i, j, k; t_atom *atom; @@ -2604,7 +2656,7 @@ static void set_excl_all(t_blocka *excl) static void decouple_atoms(t_atoms *atoms, int atomtype_decouple, int couple_lam0, int couple_lam1, - const char *mol_name, warninp_t wi) + const char *mol_name, warninp *wi) { int i; @@ -2647,7 +2699,7 @@ static void decouple_atoms(t_atoms *atoms, int atomtype_decouple, void convert_moltype_couple(t_molinfo *mol, int atomtype_decouple, real fudgeQQ, int couple_lam0, int couple_lam1, bool bCoupleIntra, int nb_funct, t_params *nbp, - warninp_t wi) + warninp *wi) { convert_pairs_to_pairsQ(mol->plist, fudgeQQ, &mol->atoms); if (!bCoupleIntra) diff --git a/src/gromacs/gmxpreprocess/toppush.h b/src/gromacs/gmxpreprocess/toppush.h index a1e8baea18..798769271c 100644 --- a/src/gromacs/gmxpreprocess/toppush.h +++ b/src/gromacs/gmxpreprocess/toppush.h @@ -38,11 +38,19 @@ #ifndef GMX_GMXPREPROCESS_TOPPUSH_H #define GMX_GMXPREPROCESS_TOPPUSH_H -#include "gromacs/fileio/warninp.h" -#include "gromacs/gmxpreprocess/gpp_atomtype.h" -#include "gromacs/gmxpreprocess/gpp_bond_atomtype.h" +#include "gromacs/utility/real.h" enum class Directive : int; +struct gpp_atomtype; +struct gpp_bond_atomtype; +struct t_atoms; +struct t_block; +struct t_molinfo; +struct t_nbparam; +struct t_param; +struct t_params; +struct t_restp; +struct warninp; namespace gmx { @@ -50,62 +58,66 @@ struct ExclusionBlocks; } // namespace gmx void generate_nbparams(int comb, int funct, t_params plist[], - gpp_atomtype_t atype, - warninp_t wi); + gpp_atomtype *atype, + warninp *wi); -void push_at (struct t_symtab *symtab, gpp_atomtype_t at, - t_bond_atomtype bat, char *line, int nb_funct, +void push_at (struct t_symtab *symtab, gpp_atomtype *at, + gpp_bond_atomtype *bat, char *line, int nb_funct, t_nbparam ***nbparam, t_nbparam ***pair, - warninp_t wi); + warninp *wi); void push_bt(Directive d, t_params bt[], int nral, - gpp_atomtype_t at, t_bond_atomtype bat, char *line, - warninp_t wi); + gpp_atomtype *at, gpp_bond_atomtype *bat, char *line, + warninp *wi); void push_dihedraltype(Directive d, t_params bt[], - t_bond_atomtype bat, char *line, - warninp_t wi); + gpp_bond_atomtype *bat, char *line, + warninp *wi); -void push_cmaptype(Directive d, t_params bt[], int nral, gpp_atomtype_t at, - t_bond_atomtype bat, char *line, - warninp_t wi); +void push_cmaptype(Directive d, t_params bt[], int nral, gpp_atomtype *at, + gpp_bond_atomtype *bat, char *line, + warninp *wi); -void push_nbt(Directive d, t_nbparam **nbt, gpp_atomtype_t atype, +void push_nbt(Directive d, t_nbparam **nbt, gpp_atomtype *atype, char *plines, int nb_funct, - warninp_t wi); + warninp *wi); void push_atom(struct t_symtab *symtab, t_block *cgs, t_atoms *at, - gpp_atomtype_t atype, + gpp_atomtype *atype, char *line, int *lastcg, - warninp_t wi); + warninp *wi); void push_bond(Directive d, t_params bondtype[], t_params bond[], - t_atoms *at, gpp_atomtype_t atype, char *line, + t_atoms *at, gpp_atomtype *atype, char *line, bool bBonded, bool bGenPairs, real fudgeQQ, bool bZero, bool *bWarn_copy_A_B, - warninp_t wi); + warninp *wi); void push_cmap(Directive d, t_params bondtype[], t_params bond[], - t_atoms *at, gpp_atomtype_t atype, char *line, - warninp_t wi); + t_atoms *at, gpp_atomtype *atype, char *line, + warninp *wi); void push_vsitesn(Directive d, t_params bond[], t_atoms *at, char *line, - warninp_t wi); + warninp *wi); void push_mol(int nrmols, t_molinfo mols[], char *pline, int *whichmol, int *nrcopies, - warninp_t wi); + warninp *wi); void push_molt(struct t_symtab *symtab, int *nmol, t_molinfo **mol, char *line, - warninp_t wi); + warninp *wi); -void push_excl(char *line, gmx::ExclusionBlocks *b2, warninp_t wi); +void push_excl(char *line, gmx::ExclusionBlocks *b2, warninp *wi); -int add_atomtype_decoupled(struct t_symtab *symtab, gpp_atomtype_t at, +int copy_nbparams(t_nbparam **param, int ftype, t_params *plist, int nr); + +void free_nbparam(t_nbparam **param, int nr); + +int add_atomtype_decoupled(struct t_symtab *symtab, gpp_atomtype *at, t_nbparam ***nbparam, t_nbparam ***pair); /* Add an atom type with all parameters set to zero (no interactions). * Returns the atom type number. @@ -116,7 +128,7 @@ void convert_moltype_couple(t_molinfo *mol, int atomtype_decouple, int couple_lam0, int couple_lam1, bool bCoupleIntra, int nb_funct, t_params *nbp, - warninp_t wi); + warninp *wi); /* Setup mol such that the B-state has no interaction with the rest * of the system, but full interaction with itself. */ diff --git a/src/gromacs/gmxpreprocess/topshake.cpp b/src/gromacs/gmxpreprocess/topshake.cpp index cf48da1d8a..93ae99953c 100644 --- a/src/gromacs/gmxpreprocess/topshake.cpp +++ b/src/gromacs/gmxpreprocess/topshake.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2018,2019, 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. @@ -42,6 +42,7 @@ #include #include +#include "gromacs/gmxpreprocess/grompp-impl.h" #include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/readir.h" #include "gromacs/gmxpreprocess/topdirs.h" diff --git a/src/gromacs/gmxpreprocess/topshake.h b/src/gromacs/gmxpreprocess/topshake.h index f232d56206..6573aed28c 100644 --- a/src/gromacs/gmxpreprocess/topshake.h +++ b/src/gromacs/gmxpreprocess/topshake.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2019, 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. @@ -38,7 +38,8 @@ #ifndef GMX_GMXPREPROCESS_TOPSHAKE_H #define GMX_GMXPREPROCESS_TOPSHAKE_H -#include "gromacs/gmxpreprocess/topio.h" +struct t_atoms; +struct t_params; void make_shake (t_params plist[], t_atoms *atoms, int nshake); diff --git a/src/gromacs/gmxpreprocess/toputil.cpp b/src/gromacs/gmxpreprocess/toputil.cpp index 8fb8c15020..facc152e5a 100644 --- a/src/gromacs/gmxpreprocess/toputil.cpp +++ b/src/gromacs/gmxpreprocess/toputil.cpp @@ -45,6 +45,7 @@ #include #include "gromacs/gmxpreprocess/gpp_atomtype.h" +#include "gromacs/gmxpreprocess/grompp-impl.h" #include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/topdirs.h" #include "gromacs/topology/block.h" @@ -202,7 +203,7 @@ void done_mi(t_molinfo *mi) /* PRINTING STRUCTURES */ -static void print_bt(FILE *out, Directive d, gpp_atomtype_t at, +static void print_bt(FILE *out, Directive d, gpp_atomtype *at, int ftype, int fsubtype, t_params plist[], bool bFullDih) { @@ -430,7 +431,7 @@ static double get_residue_charge(const t_atoms *atoms, int at) return q; } -void print_atoms(FILE *out, gpp_atomtype_t atype, t_atoms *at, int *cgnr, +void print_atoms(FILE *out, gpp_atomtype *atype, t_atoms *at, int *cgnr, bool bRTPresname) { int i, ri; @@ -526,7 +527,7 @@ void print_bondeds(FILE *out, int natoms, Directive d, int ftype, int fsubtype, t_params plist[]) { t_symtab stab; - gpp_atomtype_t atype; + gpp_atomtype *atype; t_param *param; t_atom *a; int i; diff --git a/src/gromacs/gmxpreprocess/toputil.h b/src/gromacs/gmxpreprocess/toputil.h index 859554fefe..e581c81272 100644 --- a/src/gromacs/gmxpreprocess/toputil.h +++ b/src/gromacs/gmxpreprocess/toputil.h @@ -38,9 +38,16 @@ #ifndef GMX_GMXPREPROCESS_TOPUTIL_H #define GMX_GMXPREPROCESS_TOPUTIL_H -#include "gromacs/gmxpreprocess/gpp_atomtype.h" +#include enum class Directive : int; +struct gpp_atomtype; +struct t_atoms; +struct t_blocka; +struct t_excls; +struct t_molinfo; +struct t_param; +struct t_params; /* UTILITIES */ @@ -69,7 +76,7 @@ void done_mi(t_molinfo *mi); void print_blocka(FILE *out, const char *szName, const char *szIndex, const char *szA, t_blocka *block); -void print_atoms(FILE *out, gpp_atomtype_t atype, t_atoms *at, int *cgnr, +void print_atoms(FILE *out, gpp_atomtype *atype, t_atoms *at, int *cgnr, bool bRTPresname); void print_bondeds(FILE *out, int natoms, Directive d, diff --git a/src/gromacs/gmxpreprocess/vsite_parm.cpp b/src/gromacs/gmxpreprocess/vsite_parm.cpp index 5caf15877d..9917af8b91 100644 --- a/src/gromacs/gmxpreprocess/vsite_parm.cpp +++ b/src/gromacs/gmxpreprocess/vsite_parm.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2017,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017,2018,2019, 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. @@ -45,6 +45,8 @@ #include #include "gromacs/gmxpreprocess/add_par.h" +#include "gromacs/gmxpreprocess/gpp_atomtype.h" +#include "gromacs/gmxpreprocess/grompp-impl.h" #include "gromacs/gmxpreprocess/notset.h" #include "gromacs/gmxpreprocess/resall.h" #include "gromacs/gmxpreprocess/toputil.h" @@ -390,7 +392,7 @@ static real get_angle(int nrang, t_mybonded angles[], return angle; } -static char *get_atomtype_name_AB(t_atom *atom, gpp_atomtype_t atype) +static char *get_atomtype_name_AB(t_atom *atom, gpp_atomtype *atype) { char *name; @@ -414,7 +416,7 @@ static char *get_atomtype_name_AB(t_atom *atom, gpp_atomtype_t atype) return name; } -static bool calc_vsite3_param(gpp_atomtype_t atype, +static bool calc_vsite3_param(gpp_atomtype *atype, t_param *param, t_atoms *at, int nrbond, t_mybonded *bonds, int nrang, t_mybonded *angles ) @@ -552,7 +554,7 @@ static bool calc_vsite3fad_param(t_param *param, return bError; } -static bool calc_vsite3out_param(gpp_atomtype_t atype, +static bool calc_vsite3out_param(gpp_atomtype *atype, t_param *param, t_atoms *at, int nrbond, t_mybonded *bonds, int nrang, t_mybonded *angles) @@ -764,7 +766,7 @@ calc_vsite4fdn_param(t_param *param, -int set_vsites(bool bVerbose, t_atoms *atoms, gpp_atomtype_t atype, +int set_vsites(bool bVerbose, t_atoms *atoms, gpp_atomtype *atype, t_params plist[]) { int i, j, ftype; diff --git a/src/gromacs/gmxpreprocess/vsite_parm.h b/src/gromacs/gmxpreprocess/vsite_parm.h index 682f97a54d..986908ebaf 100644 --- a/src/gromacs/gmxpreprocess/vsite_parm.h +++ b/src/gromacs/gmxpreprocess/vsite_parm.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2018,2019, 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. @@ -38,12 +38,12 @@ #ifndef GMX_GMXPREPROCESS_VSITE_PARM_H #define GMX_GMXPREPROCESS_VSITE_PARM_H -#include "gromacs/gmxpreprocess/gpp_atomtype.h" -#include "gromacs/gmxpreprocess/grompp-impl.h" - +struct gpp_atomtype; struct gmx_moltype_t; +struct t_atoms; +struct t_params; -int set_vsites(bool bVerbose, t_atoms *atoms, gpp_atomtype_t atype, +int set_vsites(bool bVerbose, t_atoms *atoms, gpp_atomtype *atype, t_params plist[]); /* set parameters for virtual sites, return number of virtual sites */ diff --git a/src/gromacs/gmxpreprocess/x2top.cpp b/src/gromacs/gmxpreprocess/x2top.cpp index 44d9061861..568f88540e 100644 --- a/src/gromacs/gmxpreprocess/x2top.cpp +++ b/src/gromacs/gmxpreprocess/x2top.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2008, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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. @@ -45,12 +45,15 @@ #include "gromacs/fileio/confio.h" #include "gromacs/fileio/gmxfio.h" #include "gromacs/gmxpreprocess/gen_ad.h" +#include "gromacs/gmxpreprocess/gpp_atomtype.h" #include "gromacs/gmxpreprocess/gpp_nextnb.h" +#include "gromacs/gmxpreprocess/grompp-impl.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/gmxpreprocess/toputil.h" #include "gromacs/listed-forces/bonded.h" #include "gromacs/math/units.h" #include "gromacs/math/utilities.h" @@ -174,10 +177,10 @@ static int *set_cgnr(t_atoms *atoms, bool bUsePDBcharge, real *qtot, real *mtot) return cgnr; } -static gpp_atomtype_t set_atom_type(t_symtab *tab, t_atoms *atoms, t_params *bonds, - int *nbonds, int nnm, t_nm2type nm2t[]) +static gpp_atomtype *set_atom_type(t_symtab *tab, t_atoms *atoms, t_params *bonds, + int *nbonds, int nnm, t_nm2type nm2t[]) { - gpp_atomtype_t atype; + gpp_atomtype *atype; int nresolved; atype = init_atomtype(); @@ -333,7 +336,7 @@ static void print_pl(FILE *fp, t_params plist[], int ftp, const char *name, } static void print_rtp(const char *filenm, const char *title, t_atoms *atoms, - t_params plist[], gpp_atomtype_t atype, int cgnr[]) + t_params plist[], gpp_atomtype *atype, int cgnr[]) { FILE *fp; int i, tp; @@ -396,7 +399,7 @@ int gmx_x2top(int argc, char *argv[]) FILE *fp; t_params plist[F_NRE]; t_excls *excls; - gpp_atomtype_t atype; + gpp_atomtype *atype; t_nextnb nnb; t_nm2type *nm2t; t_mols mymol; diff --git a/src/gromacs/gmxpreprocess/xlate.cpp b/src/gromacs/gmxpreprocess/xlate.cpp index 4897e89f45..9039f2468a 100644 --- a/src/gromacs/gmxpreprocess/xlate.cpp +++ b/src/gromacs/gmxpreprocess/xlate.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2017,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017,2018,2019, 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. @@ -45,6 +45,7 @@ #include #include "gromacs/gmxpreprocess/fflibutil.h" +#include "gromacs/gmxpreprocess/grompp-impl.h" #include "gromacs/gmxpreprocess/hackblock.h" #include "gromacs/topology/residuetypes.h" #include "gromacs/topology/symtab.h" diff --git a/src/gromacs/gmxpreprocess/xlate.h b/src/gromacs/gmxpreprocess/xlate.h index f11c17caee..78b11b8c70 100644 --- a/src/gromacs/gmxpreprocess/xlate.h +++ b/src/gromacs/gmxpreprocess/xlate.h @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014,2015,2018, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2018,2019, 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. @@ -38,19 +38,17 @@ #ifndef GMX_GMXPREPROCESS_XLATE_H #define GMX_GMXPREPROCESS_XLATE_H -#include "gromacs/gmxpreprocess/hackblock.h" -#include "gromacs/utility/basedefinitions.h" - struct gmx_residuetype_t; struct t_atoms; +struct t_restp; struct t_symtab; /* If bResname is true renames atoms based on residue names, * otherwise renames atoms based on rtp entry names. */ void rename_atoms(const char* xlfile, const char *ffdir, - struct t_atoms *atoms, struct t_symtab *symtab, const t_restp *restp, - bool bResname, struct gmx_residuetype_t *rt, bool bReorderNum, + t_atoms *atoms, t_symtab *symtab, const t_restp *restp, + bool bResname, gmx_residuetype_t *rt, bool bReorderNum, bool bVerbose); #endif