Merge t_graph definition into mshift.h
authorTeemu Murtola <teemu.murtola@gmail.com>
Mon, 19 May 2014 17:08:59 +0000 (20:08 +0300)
committerTeemu Murtola <teemu.murtola@gmail.com>
Wed, 21 May 2014 17:56:24 +0000 (19:56 +0200)
- Remove types/graph.h, and merge its contents into mshift.h.
  This is a natural place for the structure, as the header already
  contains most functions that operate on the graph.
- Make t_graph forward-declarable, and use that in headers that
  previously got t_graph from typedefs.h.
- Add some missing mshift.h includes to source files that now need it.

Some additional cleanup of mshift.h dependencies will be done in
subsequent commits, when the header itself is moved.

Change-Id: Ia8c5817c11474c857a6845810e5e7f5a75f1c47c

16 files changed:
src/gromacs/gmxlib/disre.c
src/gromacs/gmxlib/nonbonded/nonbonded.c
src/gromacs/gmxlib/orires.c
src/gromacs/gmxlib/pbc.c
src/gromacs/legacyheaders/bondf.h
src/gromacs/legacyheaders/force.h
src/gromacs/legacyheaders/genborn.h
src/gromacs/legacyheaders/mshift.h
src/gromacs/legacyheaders/nonbonded.h
src/gromacs/legacyheaders/pbc.h
src/gromacs/legacyheaders/typedefs.h
src/gromacs/legacyheaders/types/graph.h [deleted file]
src/gromacs/legacyheaders/types/ifunc.h
src/gromacs/legacyheaders/vsite.h
src/gromacs/mdlib/genborn.c
src/gromacs/mdlib/rf_util.c

index d1f6bd0952b93de3bed8f20c07775507e013c1d3..9b58d5ecc7567d5b6ab8ee6d2e29e003bc6ee8ab 100644 (file)
 
 #include "typedefs.h"
 #include "types/commrec.h"
-#include "gromacs/utility/smalloc.h"
 #include "macros.h"
-#include "gromacs/math/vec.h"
 #include "gromacs/utility/futil.h"
-#include "gromacs/utility/fatalerror.h"
 #include "bondf.h"
 #include "copyrite.h"
 #include "disre.h"
 #include "main.h"
 #include "mtop_util.h"
 
+#include "gromacs/math/vec.h"
+#include "mshift.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
+
 void init_disres(FILE *fplog, const gmx_mtop_t *mtop,
                  t_inputrec *ir, const t_commrec *cr,
                  t_fcdata *fcd, t_state *state, gmx_bool bIsREMD)
index 2afb92f62f51084a8c95d1724bf3918065a94ce6..2ef53d511d8765b53082d225c699b6a25f4a3eb6 100644 (file)
@@ -45,7 +45,6 @@
 
 #include "typedefs.h"
 #include "txtdump.h"
-#include "gromacs/utility/smalloc.h"
 #include "ns.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/math/utilities.h"
 #include "gromacs/utility/cstringutil.h"
 #include "force.h"
 #include "names.h"
-#include "gromacs/utility/fatalerror.h"
 #include "force.h"
 #include "bondf.h"
 #include "nrnb.h"
 #include "nonbonded.h"
 #include "gromacs/simd/simd.h"
 
+#include "mshift.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
+
 #include "nb_kernel.h"
 #include "nb_free_energy.h"
 #include "nb_generic.h"
index cdae972a9aa9e3b1564ab63b268a9d0a23aecabd..9fabf4daeeaf58ca3a296b31f5bcbe35302622e8 100644 (file)
@@ -39,8 +39,6 @@
 #endif
 
 #include "typedefs.h"
-#include "gromacs/utility/smalloc.h"
-#include "gromacs/math/vec.h"
 #include "types/commrec.h"
 #include "network.h"
 #include "orires.h"
 
 #include "gromacs/linearalgebra/nrjac.h"
 #include "gromacs/math/do_fit.h"
+#include "gromacs/math/vec.h"
+#include "mshift.h"
 #include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
 
 void init_orires(FILE *fplog, const gmx_mtop_t *mtop,
                  rvec xref[],
index 1f8b98713fcfb7f08b3a779e7fbb137f1e38f821..c0c92e0f8e34d203eef234bca70326bb39c0496d 100644 (file)
@@ -52,6 +52,7 @@
 #include "names.h"
 #include "macros.h"
 #include "gmx_omp_nthreads.h"
+#include "mshift.h"
 
 /* Skip 0 so we have more chance of detecting if we forgot to call set_pbc. */
 enum {
index 793aefe5972c6243152230edcb147f90286aa5ae..7b139ad34783d38ad0c54458471d6441fff61e74 100644 (file)
@@ -49,6 +49,8 @@
 extern "C" {
 #endif
 
+struct t_graph;
+
 int glatnr(int *global_atom_index, int i);
 /* Returns the global topology atom number belonging to local atom index i.
  * This function is intended for writing ascii output
@@ -60,7 +62,7 @@ void calc_bonds(FILE *fplog, const gmx_multisim_t *ms,
                 const t_idef *idef,
                 rvec x[], history_t *hist,
                 rvec f[], t_forcerec *fr,
-                const t_pbc *pbc, const t_graph *g,
+                const t_pbc *pbc, const struct t_graph *g,
                 gmx_enerdata_t *enerd, t_nrnb *nrnb, real *lambda,
                 const t_mdatoms *md,
                 t_fcdata *fcd, int *ddgatindex,
@@ -97,7 +99,7 @@ void calc_bonds_lambda(FILE *fplog,
                        const t_idef *idef,
                        rvec x[],
                        t_forcerec *fr,
-                       const t_pbc *pbc, const t_graph *g,
+                       const t_pbc *pbc, const struct t_graph *g,
                        gmx_grppairener_t *grpp, real *epot, t_nrnb *nrnb,
                        real *lambda,
                        const t_mdatoms *md,
@@ -137,7 +139,7 @@ real dih_angle(const rvec xi, const rvec xj, const rvec xk, const rvec xl,
 void do_dih_fup(int i, int j, int k, int l, real ddphi,
                 rvec r_ij, rvec r_kj, rvec r_kl,
                 rvec m, rvec n, rvec f[], rvec fshift[],
-                const t_pbc *pbc, const t_graph *g,
+                const t_pbc *pbc, const struct t_graph *g,
                 const rvec *x, int t1, int t2, int t3);
 /* Do an update of the forces for dihedral potentials */
 
index 214fcc9a2265cdda0ea4c2f05db53621138dde5c..3428027332f10a9ba6ad3d2c4434cac3d44b76d6 100644 (file)
@@ -53,6 +53,8 @@
 extern "C" {
 #endif
 
+struct t_graph;
+
 void gmx_print_sepdvdl(FILE *fplog, const char *s, real v, real dvdlambda);
 
 void calc_vir(int nxf, rvec x[], rvec f[], tensor vir,
@@ -60,10 +62,10 @@ void calc_vir(int nxf, rvec x[], rvec f[], tensor vir,
 /* Calculate virial for nxf atoms, and add it to vir */
 
 void f_calc_vir(int i0, int i1, rvec x[], rvec f[], tensor vir,
-                t_graph *g, rvec shift_vec[]);
+                struct t_graph *g, rvec shift_vec[]);
 /* Calculate virial taking periodicity into account */
 
-real RF_excl_correction(const t_forcerec *fr, t_graph *g,
+real RF_excl_correction(const t_forcerec *fr, struct t_graph *g,
                         const t_mdatoms *mdatoms, const t_blocka *excl,
                         rvec x[], rvec f[], rvec *fshift, const t_pbc *pbc,
                         real lambda, real *dvdlambda);
@@ -226,7 +228,7 @@ extern void do_force(FILE *log, t_commrec *cr,
                      tensor vir_force,
                      t_mdatoms *mdatoms,
                      gmx_enerdata_t *enerd, t_fcdata *fcd,
-                     real *lambda, t_graph *graph,
+                     real *lambda, struct t_graph *graph,
                      t_forcerec *fr,
                      gmx_vsite_t *vsite, rvec mu_tot,
                      double t, FILE *field, gmx_edsam_t ed,
@@ -276,7 +278,7 @@ extern void do_force_lowlevel(FILE         *fplog,
                               matrix       box,
                               t_lambda     *fepvals,
                               real         *lambda,
-                              t_graph      *graph,
+                              struct t_graph      *graph,
                               t_blocka     *excl,
                               rvec         mu_tot[2],
                               int          flags,
index 99e2d51513deae7db479b7433943a6fcdc8ad2d9..4727cb5cdca37ed5511f5b20a0477d024c99b092 100644 (file)
@@ -55,6 +55,7 @@ extern "C" {
 #define STILL_P5INV (1.0/STILL_P5)
 #define STILL_PIP5  (M_PI*STILL_P5)
 
+struct t_graph;
 
 /* Initialise GB stuff */
 int init_gb(gmx_genborn_t **p_born,
@@ -70,7 +71,8 @@ int calc_gb_rad(t_commrec *cr, t_forcerec *fr, t_inputrec *ir, gmx_localtop_t *t
 /* Bonded GB interactions */
 real gb_bonds_tab(rvec x[], rvec f[], rvec fshift[], real *charge, real *p_gbtabscale,
                   real *invsqrta, real *dvda, real *GBtab, t_idef *idef, real epsilon_r,
-                  real gb_epsilon_solvent, real facel, const t_pbc *pbc, const t_graph *graph);
+                  real gb_epsilon_solvent, real facel, const t_pbc *pbc,
+                  const struct t_graph *graph);
 
 
 
@@ -79,13 +81,13 @@ real gb_bonds_tab(rvec x[], rvec f[], rvec fshift[], real *charge, real *p_gbtab
 void
 calc_gb_forces(t_commrec *cr, t_mdatoms *md, gmx_genborn_t *born, gmx_localtop_t *top,
                rvec x[], rvec f[], t_forcerec *fr, t_idef *idef, int gb_algorithm, int sa_algorithm, t_nrnb *nrnb,
-               const t_pbc *pbc, const t_graph *graph, gmx_enerdata_t *enerd);
+               const t_pbc *pbc, const struct t_graph *graph, gmx_enerdata_t *enerd);
 
 
 int
 make_gb_nblist(t_commrec *cr, int gb_algorithm,
                rvec x[], matrix box,
-               t_forcerec *fr, t_idef *idef, t_graph *graph, gmx_genborn_t *born);
+               t_forcerec *fr, t_idef *idef, struct t_graph *graph, gmx_genborn_t *born);
 
 void
 make_local_gb(const t_commrec *cr, gmx_genborn_t *born, int gb_algorithm);
index d4b5c9fa3d5ed8fa0f4041e60a2daa9fa9eac7f8..d1234fc447a5308940d1fbeaa3a68a25483aaa1a 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014, 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.
 extern "C" {
 #endif
 
+typedef enum {
+    egcolWhite, egcolGrey, egcolBlack, egcolNR
+} egCol;
+
+typedef struct t_graph {
+    int          at0;       /* The first atom the graph was constructed for */
+    int          at1;       /* The last atom the graph was constructed for  */
+    int          nnodes;    /* The number of nodes, nnodes=at_end-at_start  */
+    int          nbound;    /* The number of nodes with edges               */
+    int          at_start;  /* The first connected atom in this graph       */
+    int          at_end;    /* The last+1 connected atom in this graph      */
+    int         *nedge;     /* For each node the number of edges            */
+    atom_id    **edge;      /* For each node, the actual edges (bidirect.)  */
+    gmx_bool     bScrewPBC; /* Screw boundary conditions                    */
+    ivec        *ishift;    /* Shift for each particle                      */
+    int          negc;
+    egCol       *egc;       /* color of each node */
+} t_graph;
+
+#define SHIFT_IVEC(g, i) ((g)->ishift[i])
+
+
 t_graph *mk_graph(FILE *fplog,
                   t_idef *idef, int at_start, int at_end,
                   gmx_bool bShakeOnly, gmx_bool bSettle);
index 6176d60631c116ebfc441988703f8d59d45958a3..248cafa09bafd25380a84a5fbc212aa6f3988795 100644 (file)
@@ -51,6 +51,7 @@ extern "C" {
 } /* fixes auto-indentation problems */
 #endif
 
+struct t_graph;
 
 
 void
@@ -86,7 +87,7 @@ do_nonbonded(t_forcerec *fr,
  */
 real
 do_nonbonded_listed(int ftype, int nbonds, const t_iatom iatoms[], const t_iparams iparams[],
-                    const rvec x[], rvec f[], rvec fshift[], const t_pbc *pbc, const t_graph *g,
+                    const rvec x[], rvec f[], rvec fshift[], const t_pbc *pbc, const struct t_graph *g,
                     real *lambda, real *dvdl, const t_mdatoms *md, const t_forcerec *fr,
                     gmx_grppairener_t *grppener, int *global_atom_index);
 
index eca121f79dfc575f5141ca8576db7fd2f0ee9ae8..c254edec85bc6e64e61e2920f94311022de37152 100644 (file)
@@ -59,6 +59,8 @@ enum {
     ecenterDEF = ecenterTRIC
 };
 
+struct t_graph;
+
 int ePBC2npbcdim(int ePBC);
 /* Returns the number of dimensions that use pbc, starting at X */
 
@@ -85,7 +87,7 @@ real max_cutoff2(int ePBC, matrix box);
 int guess_ePBC(matrix box);
 /* Guesses the type of periodic boundary conditions using the box */
 
-gmx_bool correct_box(FILE *fplog, int step, tensor box, t_graph *graph);
+gmx_bool correct_box(FILE *fplog, int step, tensor box, struct t_graph *graph);
 /* Checks for un-allowed box angles and corrects the box
  * and the integer shift vectors in the graph (if graph!=NULL) if necessary.
  * Returns TRUE when the box was corrected.
index a3e6cd4294c111fcfc39311b3f3785923323441d..78033804fe28edc4b13c75d439b46ce34eec4281 100644 (file)
@@ -55,7 +55,6 @@
 #include "types/energy.h"
 #include "types/inputrec.h"
 #include "types/ishift.h"
-#include "types/graph.h"
 #include "types/nrnb.h"
 #include "types/nblist.h"
 #include "types/nbnxn_pairlist.h"
diff --git a/src/gromacs/legacyheaders/types/graph.h b/src/gromacs/legacyheaders/types/graph.h
deleted file mode 100644 (file)
index 67cc57a..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * This file is part of the GROMACS molecular simulation package.
- *
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013, 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.
- *
- * GROMACS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1
- * of the License, or (at your option) any later version.
- *
- * GROMACS is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with GROMACS; if not, see
- * http://www.gnu.org/licenses, or write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
- *
- * If you want to redistribute modifications to GROMACS, please
- * consider that scientific software is very special. Version
- * control is crucial - bugs must be traceable. We will be happy to
- * consider code for inclusion in the official distribution, but
- * derived work must not be called official GROMACS. Details are found
- * in the README & COPYING files - if they are missing, get the
- * official version at http://www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the research papers on the package. Check out http://www.gromacs.org.
- */
-
-#ifndef _types_graph_h
-#define _types_graph_h
-
-#include "idef.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-typedef enum {
-    egcolWhite, egcolGrey, egcolBlack, egcolNR
-} egCol;
-
-typedef struct {
-    int          at0;       /* The first atom the graph was constructed for */
-    int          at1;       /* The last atom the graph was constructed for */
-    int          nnodes;    /* The number of nodes, nnodes=at_end-at_start     */
-    int          nbound;    /* The number of nodes with edges          */
-    int          at_start;  /* The first connected atom in this graph  */
-    int          at_end;    /* The last+1 connected atom in this graph */
-    int         *nedge;     /* For each node the number of edges               */
-    atom_id    **edge;      /* For each node, the actual edges (bidirect.)     */
-    gmx_bool     bScrewPBC; /* Screw boundary conditions                    */
-    ivec        *ishift;    /* Shift for each particle                  */
-    int          negc;
-    egCol       *egc;       /* color of each node */
-} t_graph;
-
-
-#define SHIFT_IVEC(g, i) ((g)->ishift[i])
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _types_graph_h */
index 7e3cc7cad0a4c9fadcfb71028ab9c9c84ffcad18..a8c8bc0b087c82afa93019692f11fec13b960625 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014, 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.
 #include "idef.h"
 #include "mdatom.h"
 #include "fcdata.h"
-#include "graph.h"
 #include "pbc.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+struct t_graph;
 
 typedef real t_ifunc (int nbonds, const t_iatom iatoms[],
                       const t_iparams iparams[],
                       const rvec x[], rvec f[], rvec fshift[],
-                      const t_pbc *pbc, const t_graph *g,
+                      const t_pbc *pbc, const struct t_graph *g,
                       real lambda, real *dvdlambda,
                       const t_mdatoms *md, t_fcdata *fcd,
                       int *ddgatindex);
index 2ccc6ed1f9988681711f79259165249ad60ca049..a30ec2b734dabbb9e86b4361d9dc541c6d28c77b 100644 (file)
@@ -64,6 +64,8 @@ typedef struct {
     int                 th_ind_nalloc;        /* Size of th_ind                          */
 } gmx_vsite_t;
 
+struct t_graph;
+
 void construct_vsites(gmx_vsite_t *vsite,
                       rvec x[],
                       real dt, rvec v[],
@@ -91,7 +93,7 @@ void spread_vsite_f(gmx_vsite_t *vsite,
                     rvec x[], rvec f[], rvec *fshift,
                     gmx_bool VirCorr, matrix vir,
                     t_nrnb *nrnb, t_idef *idef,
-                    int ePBC, gmx_bool bMolPBC, t_graph *g, matrix box,
+                    int ePBC, gmx_bool bMolPBC, struct t_graph *g, matrix box,
                     t_commrec *cr);
 /* Spread the force operating on the vsite atoms on the surrounding atoms.
  * If fshift!=NULL also update the shift forces.
index 5058d568ed0e9afb080d37eba9cdc87ba8a27725..c43e9ac89907491d21b06a3a47aec45e794aca28 100644 (file)
 
 #include "typedefs.h"
 #include "types/commrec.h"
-#include "gromacs/utility/smalloc.h"
 #include "genborn.h"
-#include "gromacs/math/vec.h"
 #include "gromacs/fileio/pdbio.h"
 #include "names.h"
 #include "gromacs/math/units.h"
 #include "domdec.h"
 #include "network.h"
-#include "gromacs/utility/fatalerror.h"
 #include "mtop_util.h"
 #include "pbc.h"
 #include "nrnb.h"
 #include "bondf.h"
 
+#include "gromacs/math/vec.h"
+#include "mshift.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/gmxmpi.h"
+#include "gromacs/utility/smalloc.h"
 
 #ifdef GMX_SIMD_X86_SSE2_OR_HIGHER
 #  ifdef GMX_DOUBLE
index 6caeb816c0443c746f296f4fbe1e29207955b5d5..fa92696fa223ca5930192e233b0ee20d3becaaf1 100644 (file)
 #include "typedefs.h"
 #include "force.h"
 #include "names.h"
-#include "gromacs/math/vec.h"
-#include "gromacs/math/units.h"
 #include "copyrite.h"
 #include "pbc.h"
 
+#include "mshift.h"
+#include "gromacs/math/units.h"
+#include "gromacs/math/vec.h"
+
 real RF_excl_correction(const t_forcerec *fr, t_graph *g,
                         const t_mdatoms *mdatoms, const t_blocka *excl,
                         rvec x[], rvec f[], rvec *fshift, const t_pbc *pbc,