Move types/idef.h to topology/
authorTeemu Murtola <teemu.murtola@gmail.com>
Sat, 24 May 2014 18:13:58 +0000 (21:13 +0300)
committerTeemu Murtola <teemu.murtola@gmail.com>
Sat, 24 May 2014 18:15:28 +0000 (21:15 +0300)
- Move bondedtable_t to fcdata.h, which is the only header that used it.
- Make other types forward-declarable.
- Some minor cleanup in the moved file.
- Adapt files that were including idef.h directly.  Everything else
  still depends on getting this through typedefs.h / types/topology.h.

Change-Id: Ib11c1e34dde83180e1bfa8415d579ced96aeee4d

12 files changed:
src/gromacs/gmxlib/ifunc.c
src/gromacs/gmxlib/restcbt.c
src/gromacs/legacyheaders/typedefs.h
src/gromacs/legacyheaders/types/commrec.h
src/gromacs/legacyheaders/types/fcdata.h
src/gromacs/legacyheaders/types/forcerec.h
src/gromacs/legacyheaders/types/ifunc.h
src/gromacs/legacyheaders/types/topology.h
src/gromacs/pbcutil/mshift.h
src/gromacs/pbcutil/rmpbc.h
src/gromacs/topology/CMakeLists.txt
src/gromacs/topology/idef.h [moved from src/gromacs/legacyheaders/types/idef.h with 88% similarity]

index 02f055c1362a5b35373f6d3c2800f2fc62ddc567..ba34887fe5f6cdbde4707fa2cc1753f6e1869231 100644 (file)
@@ -86,7 +86,7 @@
 #define    def_nofc(str, lstr) \
     {str, lstr,    0,     0,     0, IF_NULL,                    -1, unimplemented}
 
-/* this MUST correspond to the enum in include/types/idef.h */
+/* this MUST correspond to the enum in src/gromacs/topology/idef.h */
 const t_interaction_function interaction_function[F_NRE] =
 {
     def_bond    ("BONDS",    "Bond",            2, 2, 2,  eNR_BONDS,  bonds         ),
index e7befd6cf132380dc72fe24b80a88049413c525a..a1d96f42a7ff1c8ddf6d4d39a7791e309d1d01fb 100644 (file)
  */
 #include <math.h>
 
-#include "gromacs/legacyheaders/types/idef.h"
-
 #include "gromacs/math/units.h"
 #include "gromacs/math/utilities.h"
 #include "gromacs/math/vec.h"
+#include "gromacs/topology/idef.h"
 
 /* This function computes factors needed for restricted angle potential.
  * For explanations on formula used see file "restcbt.h" */
index 520f7730feb1bc95b8f8995928a050bf5f62d122..ea1da1e89ce65a9d59654ad317ea87a273c739b1 100644 (file)
@@ -46,7 +46,6 @@
 
 #include "types/simple.h"
 #include "types/enums.h"
-#include "types/idef.h"
 #include "../fileio/trx.h"
 #include "types/topology.h"
 #include "types/energy.h"
index eaad7b4ead41f49b286ea1123f20baa479fb5996..4fbb9bb8825dd2417409d7f8f5c34995a0ea256c 100644 (file)
@@ -39,7 +39,6 @@
 
 #include "../../utility/gmxmpi.h"
 #include "../typedefs.h"
-#include "idef.h"
 
 #ifdef __cplusplus
 extern "C" {
index 2c9d605e27ac45a5b109f70c74fad956316b11d0..e158f982bd95bcaa65837a94ff981bdcd3a28fb4 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.
@@ -98,6 +98,12 @@ typedef struct {
     double **v;
 } t_oriresdata;
 
+typedef struct {
+    int   n;      /* n+1 is the number of points */
+    real  scale;  /* distance between two points */
+    real *data;   /* the actual table data, per point there are 4 numbers */
+} bondedtable_t;
+
 /*
  * Data struct used in the force calculation routines
  * for storing the tables for bonded interactions and
index 4adcbf0d2a0b0e0426b95033b297beb4ee14be84..920fdc77f426deaadcc70e78da588467c66deadf 100644 (file)
@@ -38,7 +38,7 @@
 #include "ns.h"
 #include "genborn.h"
 #include "qmmmrec.h"
-#include "idef.h"
+#include "../../topology/idef.h"
 #include "nb_verlet.h"
 #include "interaction_const.h"
 #include "hw_info.h"
index 6a29ece2bd31a85e706b62d435fe2e25f240cf06..02d51fceee68adde02ee40bdb2c5cfd58bdaa121 100644 (file)
@@ -39,7 +39,7 @@
 #ifndef _ifunc_h
 #define _ifunc_h
 
-#include "idef.h"
+#include "../../topology/idef.h"
 #include "mdatom.h"
 #include "fcdata.h"
 
index 3acfe55301d615816ab975debcda95ca9a3334a3..7093b5c776649ac8dd31f8fd0d040a7c6ae9d95e 100644 (file)
@@ -37,8 +37,8 @@
 #ifndef GMX_LEGACYHEADERS_TOPOLOGY_H
 #define GMX_LEGACYHEADERS_TOPOLOGY_H
 
-#include "idef.h"
 #include "simple.h"
+#include "../../topology/idef.h"
 #include "../../topology/atoms.h"
 #include "../../topology/block.h"
 #include "../../topology/symtab.h"
index b7479f5ca0a1cba0d3b6cae88db5308f473dbf7e..3c8783663da8ea09b5cf4330862bb1453112626f 100644 (file)
@@ -40,7 +40,6 @@
 #include <stdio.h>
 
 #include "gromacs/legacyheaders/types/simple.h"
-#include "gromacs/legacyheaders/types/idef.h"
 #include "gromacs/math/vectypes.h"
 #include "gromacs/utility/basedefinitions.h"
 
@@ -48,6 +47,9 @@
 extern "C" {
 #endif
 
+struct t_idef;
+struct t_ilist;
+
 typedef enum {
     egcolWhite, egcolGrey, egcolBlack, egcolNR
 } egCol;
@@ -70,7 +72,7 @@ typedef struct 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,
+                  struct t_idef *idef, int at_start, int at_end,
                   gmx_bool bShakeOnly, gmx_bool bSettle);
 /* Build a graph from an idef description. The graph can be used
  * to generate mol-shift indices.
@@ -81,7 +83,7 @@ t_graph *mk_graph(FILE *fplog,
  */
 
 void mk_graph_ilist(FILE *fplog,
-                    t_ilist *ilist, int at_start, int at_end,
+                    struct t_ilist *ilist, int at_start, int at_end,
                     gmx_bool bShakeOnly, gmx_bool bSettle,
                     t_graph *g);
 /* As mk_graph, but takes t_ilist iso t_idef and does not allocate g */
index 13223782b3ce2fea3e4edcbf262e113ef9bc51a9..2fe50b0e6c547720e8f9d150977cc7450f781bd4 100644 (file)
@@ -37,7 +37,6 @@
 #ifndef GMX_PBCUTIL_RMPBC_H
 #define GMX_PBCUTIL_RMPBC_H
 
-#include "../legacyheaders/types/idef.h"
 #include "../fileio/trx.h"
 #include "../math/vectypes.h"
 
@@ -46,10 +45,11 @@ extern "C" {
 #endif
 
 struct t_atoms;
+struct t_idef;
 
 typedef struct gmx_rmpbc *gmx_rmpbc_t;
 
-gmx_rmpbc_t gmx_rmpbc_init(t_idef *idef, int ePBC, int natoms);
+gmx_rmpbc_t gmx_rmpbc_init(struct t_idef *idef, int ePBC, int natoms);
 
 void gmx_rmpbc_done(gmx_rmpbc_t gpbc);
 
index 1d20344bfeea1a5a1f2b5e4c15efbc10a9eab3f5..f086663f2190123d0232bb544e134f5b035f73dd 100644 (file)
@@ -38,6 +38,7 @@ set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TOPOLOGY_SOURCES} PARENT_SCOPE)
 set(TOPOLOGY_PUBLIC_HEADERS
     atoms.h
     block.h
+    idef.h
     symtab.h)
 
 gmx_install_headers(topology ${TOPOLOGY_PUBLIC_HEADERS})
similarity index 88%
rename from src/gromacs/legacyheaders/types/idef.h
rename to src/gromacs/topology/idef.h
index 51fa605399246d6d2fab1e5ecee234c7102ecb77..00ce01cd6dcda9fb43ba54902b0b3798b97d3a34 100644 (file)
  * 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 GMX_TOPOLOGY_IDEF_H
+#define GMX_TOPOLOGY_IDEF_H
 
-
-#ifndef _idef_h
-#define _idef_h
-
-#include "simple.h"
+#include "../legacyheaders/types/simple.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -149,7 +147,7 @@ enum {
     F_DVDL_BONDED,
     F_DVDL_RESTRAINT,
     F_DVDL_TEMPERATURE, /* not calculated for now, but should just be the energy (NVT) or enthalpy (NPT), or 0 (NVE) */
-    F_NRE               /* This number is for the total number of energies     */
+    F_NRE               /* This number is for the total number of energies      */
 };
 
 #define IS_RESTRAINT_TYPE(ifunc) (((ifunc == F_POSRES) || (ifunc == F_FBPOSRES) || (ifunc == F_DISRES) || (ifunc == F_RESTRBONDS) || (ifunc == F_DISRESVIOL) || (ifunc == F_ORIRES) || (ifunc == F_ORIRESDEV) || (ifunc == F_ANGRES) || (ifunc == F_ANGRESZ) || (ifunc == F_DIHRES)))
@@ -160,7 +158,7 @@ enum {
  */
 #define IS_LISTED_LJ_C(ftype) ((ftype) >= F_LJ14 && (ftype) <= F_LJC_PAIRS_NB)
 
-typedef union
+typedef union t_iparams
 {
     /* Some parameters have A and B values for free energy calculations.
      * The B values are not used for regular simulations of course.
@@ -292,7 +290,7 @@ typedef int t_functype;
  * the remaining ones from nr_nonperturbed..(nr-1) are perturbed bonded
  * interactions.
  */
-typedef struct
+typedef struct t_ilist
 {
     int      nr;
     int      nr_nonperturbed;
@@ -304,36 +302,36 @@ typedef struct
  * The struct t_ilist defines a list of atoms with their interactions.
  * General field description:
  *   int nr
- *     the size (nr elements) of the interactions array (iatoms[]).
+ *      the size (nr elements) of the interactions array (iatoms[]).
  *   t_iatom *iatoms
  *  specifies which atoms are involved in an interaction of a certain
  *       type. The layout of this array is as follows:
  *
- *       +-----+---+---+---+-----+---+---+-----+---+---+---+-----+---+---+...
- *       |type1|at1|at2|at3|type2|at1|at2|type1|at1|at2|at3|type3|at1|at2|
- *       +-----+---+---+---+-----+---+---+-----+---+---+---+-----+---+---+...
+ *        +-----+---+---+---+-----+---+---+-----+---+---+---+-----+---+---+...
+ *        |type1|at1|at2|at3|type2|at1|at2|type1|at1|at2|at3|type3|at1|at2|
+ *        +-----+---+---+---+-----+---+---+-----+---+---+---+-----+---+---+...
  *
  *  So for interaction type type1 3 atoms are needed, and for type2 and
  *      type3 only 2. The type identifier is used to select the function to
- *     calculate the interaction and its actual parameters. This type
- *     identifier is an index in a params[] and functype[] array.
+ *      calculate the interaction and its actual parameters. This type
+ *      identifier is an index in a params[] and functype[] array.
  */
 
 typedef struct
 {
     real *cmap; /* Has length 4*grid_spacing*grid_spacing, */
     /* there are 4 entries for each cmap type (V,dVdx,dVdy,d2dVdxdy) */
-} cmapdata_t;
+} gmx_cmapdata_t;
 
-typedef struct
+typedef struct gmx_cmap_t
 {
-    int         ngrid;        /* Number of allocated cmap (cmapdata_t ) grids */
-    int         grid_spacing; /* Grid spacing */
-    cmapdata_t *cmapdata;     /* Pointer to grid with actual, pre-interpolated data */
+    int             ngrid;        /* Number of allocated cmap (cmapdata_t ) grids */
+    int             grid_spacing; /* Grid spacing */
+    gmx_cmapdata_t *cmapdata;     /* Pointer to grid with actual, pre-interpolated data */
 } gmx_cmap_t;
 
 
-typedef struct
+typedef struct gmx_ffparams_t
 {
     int         ntypes;
     int         atnr;
@@ -348,7 +346,7 @@ enum {
     ilsortUNKNOWN, ilsortNO_FE, ilsortFE_UNSORTED, ilsortFE_SORTED
 };
 
-typedef struct
+typedef struct t_idef
 {
     int         ntypes;
     int         atnr;
@@ -372,24 +370,24 @@ typedef struct
  * version of the program  can use it as easy as the single node version.
  * General field description:
  *   int ntypes
- *     defines the number of elements in functype[] and param[].
+ *      defines the number of elements in functype[] and param[].
  *   int nodeid
  *      the node id (if parallel machines)
  *   int atnr
  *      the number of atomtypes
  *   t_functype *functype
- *     array of length ntypes, defines for every force type what type of
+ *      array of length ntypes, defines for every force type what type of
  *      function to use. Every "bond" with the same function but different
- *     force parameters is a different force type. The type identifier in the
- *     forceatoms[] array is an index in this array.
+ *      force parameters is a different force type. The type identifier in the
+ *      forceatoms[] array is an index in this array.
  *   t_iparams *iparams
- *     array of length ntypes, defines the parameters for every interaction
+ *      array of length ntypes, defines the parameters for every interaction
  *      type. The type identifier in the actual interaction list
  *      (ilist[ftype].iatoms[]) is an index in this array.
  *   gmx_cmap_t cmap_grid
  *      the grid for the dihedral pair correction maps.
  *   t_iparams *iparams_posres, *iparams_fbposres
- *     defines the parameters for position restraints only.
+ *      defines the parameters for position restraints only.
  *      Position restraints are the only interactions that have different
  *      parameters (reference positions) for different molecules
  *      of the same type. ilist[F_POSRES].iatoms[] is an index in this array.
@@ -409,15 +407,8 @@ typedef struct
  *      should be at least F_NRE*(nthreads+1).
  */
 
-typedef struct {
-    int   n;      /* n+1 is the number of points */
-    real  scale;  /* distance between two points */
-    real *data;   /* the actual table data, per point there are 4 numbers */
-} bondedtable_t;
-
 #ifdef __cplusplus
 }
 #endif
 
-
 #endif