Move atomprop.* to topology/
authorTeemu Murtola <teemu.murtola@gmail.com>
Sat, 31 May 2014 19:11:47 +0000 (22:11 +0300)
committerTeemu Murtola <teemu.murtola@gmail.com>
Mon, 2 Jun 2014 15:00:43 +0000 (18:00 +0300)
- Remove some unnecessary includes.
- Convert the source file to C++ and fix some issues.
- Some header cleanup in touched files.

This introduces a fileio<->topology cyclic dependency, but that needs to
wait for later resolution.

Change-Id: I88e70cd9024d86c56c4d4435fa91c42af9af7c29

20 files changed:
src/contrib/hexamer.c
src/contrib/mkice.c
src/gromacs/fileio/pdbio.c
src/gromacs/fileio/pdbio.h
src/gromacs/fileio/tpxio.c
src/gromacs/gmxana/gmx_dyecoupl.c
src/gromacs/gmxana/gmx_editconf.c
src/gromacs/gmxpreprocess/insert-molecules.cpp
src/gromacs/gmxpreprocess/pdb2gmx.c
src/gromacs/gmxpreprocess/read-conformation.cpp
src/gromacs/gmxpreprocess/read-conformation.h
src/gromacs/gmxpreprocess/solvate.cpp
src/gromacs/gmxpreprocess/x2top.c
src/gromacs/tools/check.c
src/gromacs/topology/CMakeLists.txt
src/gromacs/topology/atomprop.cpp [moved from src/gromacs/gmxlib/atomprop.c with 97% similarity]
src/gromacs/topology/atomprop.h [moved from src/gromacs/legacyheaders/atomprop.h with 93% similarity]
src/gromacs/trajectoryanalysis/modules/freevolume.cpp
src/gromacs/trajectoryanalysis/modules/sasa.cpp
src/programs/view/manager.cpp

index 6e55de9c3aecbeec8a84a393263beeae3a92a483..22117c73a93836fd0d78fa4e011c004d64149124 100644 (file)
@@ -51,7 +51,6 @@
 #include "typedefs.h"
 #include "gbutil.h"
 #include "gromacs/math/units.h"
-#include "atomprop.h"
 
 void copy_atom(t_symtab *tab,t_atoms *a1,int i1,t_atoms *a2,int i2,
               rvec xin[],rvec xout[],rvec vin[],rvec vout[])
index 2cd3b2afbcf4d4a6ee07b144dc60866154dc0de1..a60b847cdd9b881be02bcde7221ec663c71cf627 100644 (file)
@@ -53,7 +53,6 @@
 #include "gromacs/fileio/trnio.h"
 #include "gromacs/topology/symtab.h"
 #include "gromacs/fileio/strdb.h"
-#include "atomprop.h"
 #include "gromacs/fileio/confio.h"
 
 #define TET   109.47
index 58de0aaf67834adc23a42aef3a8dbb670933c31c..a4c1487d683282c0a829d33fcb70756bda773d0a 100644 (file)
@@ -44,8 +44,8 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "gromacs/legacyheaders/atomprop.h"
 #include "gromacs/legacyheaders/copyrite.h"
+#include "gromacs/legacyheaders/index.h"
 #include "gromacs/legacyheaders/types/ifunc.h"
 #include "gromacs/legacyheaders/typedefs.h"
 #include "gromacs/utility/futil.h"
@@ -54,6 +54,7 @@
 #include "gromacs/math/units.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/pbcutil/pbc.h"
+#include "gromacs/topology/atomprop.h"
 #include "gromacs/topology/symtab.h"
 #include "gromacs/topology/topology.h"
 #include "gromacs/utility/cstringutil.h"
index e3a69b44868cd5af833acc1885bf940d66fd903a..a8f41a62b384d3a9fb7275fa5fcf05ba25ce974a 100644 (file)
 
 #include <stdio.h>
 
-#include "../legacyheaders/atomprop.h"
+#include "../legacyheaders/types/simple.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+struct gmx_atomprop;
 struct t_atoms;
 struct t_topology;
 
@@ -104,7 +105,7 @@ void write_pdbfile(FILE *out, const char *title, struct t_atoms *atoms,
  * which may be useful for visualization purposes.
  */
 
-void get_pdb_atomnumber(struct t_atoms *atoms, gmx_atomprop_t aps);
+void get_pdb_atomnumber(struct t_atoms *atoms, struct gmx_atomprop *aps);
 /* Routine to extract atomic numbers from the atom names */
 
 int read_pdbfile(FILE *in, char *title, int *model_nr,
index 7dc48935a65326f15b37a7bb26221f2c422b872e..55f5f6a0855d7ab550eafb1384b8f5edf2316bf0 100644 (file)
 #include "tpxio.h"
 #include "txtdump.h"
 #include "confio.h"
-#include "atomprop.h"
 #include "copyrite.h"
-#include "gromacs/topology/mtop_util.h"
 
 #include "gromacs/math/vec.h"
+#include "gromacs/topology/atomprop.h"
 #include "gromacs/topology/block.h"
+#include "gromacs/topology/mtop_util.h"
 #include "gromacs/topology/symtab.h"
 #include "gromacs/topology/topology.h"
 #include "gromacs/utility/cstringutil.h"
index 7e8934f6c6b43ebd82a1b8808558893ed3debe9f..cc492abd05d1263dc2053b3f5ac3a825db307b9c 100644 (file)
@@ -42,6 +42,7 @@
 #include "gromacs/fileio/trxio.h"
 #include "gromacs/fileio/xvgr.h"
 #include "gromacs/pbcutil/pbc.h"
+#include "index.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
index 6b87cf828cab69e3a0be0982e92f9a5077333874..3bf14dbf76ee24a1bdd494bbd84b1657dc5205fb 100644 (file)
 
 #include "gromacs/fileio/pdbio.h"
 #include "gromacs/fileio/confio.h"
-#include "gromacs/utility/smalloc.h"
 #include "macros.h"
-#include "gromacs/commandline/pargs.h"
 #include "gromacs/fileio/strdb.h"
 #include "index.h"
-#include "gromacs/math/vec.h"
 #include "typedefs.h"
 #include "gromacs/gmxlib/conformation-utilities.h"
 #include "gromacs/math/units.h"
-#include "atomprop.h"
 #include "gromacs/fileio/tpxio.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/pbcutil/pbc.h"
 #include "princ.h"
 #include "txtdump.h"
 #include "viewit.h"
-#include "gromacs/pbcutil/rmpbc.h"
 #include "gmx_ana.h"
 
+#include "gromacs/commandline/pargs.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/pbcutil/pbc.h"
+#include "gromacs/pbcutil/rmpbc.h"
+#include "gromacs/topology/atomprop.h"
 #include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
 
 typedef struct
 {
index a69ad76497f8dcd4823b9cd9c2b9c47f63e9941c..7d583bd8550609d5f2ff52505084705d85f22bf9 100644 (file)
@@ -44,7 +44,6 @@
 #include "gromacs/math/utilities.h"
 #include "gromacs/fileio/confio.h"
 #include "macros.h"
-#include "atomprop.h"
 #include "names.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/gmxlib/conformation-utilities.h"
@@ -56,6 +55,7 @@
 #include "gromacs/pbcutil/ishift.h"
 #include "gromacs/pbcutil/pbc.h"
 #include "gromacs/random/random.h"
+#include "gromacs/topology/atomprop.h"
 #include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/futil.h"
index 4dd0bf28947ca807120237f3eb1c7287a5120cfc..db0a5412560a6aec35b301cc68bc734de6b3f5a2 100644 (file)
 #include "gromacs/gmxlib/conformation-utilities.h"
 #include "genhydro.h"
 #include "readinp.h"
-#include "atomprop.h"
 #include "index.h"
 #include "fflibutil.h"
 #include "macros.h"
 
 #include "gromacs/commandline/pargs.h"
 #include "gromacs/fileio/strdb.h"
+#include "gromacs/topology/atomprop.h"
 #include "gromacs/topology/block.h"
 #include "gromacs/topology/symtab.h"
 #include "gromacs/utility/smalloc.h"
index e282233aa2424bbb72df10e7b66d6c1ee11411f5..fa4d8c5b78b66b48974e00e830807f2a4a4b52c2 100644 (file)
@@ -35,9 +35,9 @@
 #include "read-conformation.h"
 
 #include "gromacs/fileio/confio.h"
-#include "gromacs/legacyheaders/atomprop.h"
 #include "gromacs/legacyheaders/types/simple.h"
 #include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/topology/atomprop.h"
 #include "gromacs/topology/atoms.h"
 #include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/smalloc.h"
index be15b1d4fb596feffc80571d1cfe39a35de43b91..4a1704d5cef5ab0141c46c28a088f8a74088b2f7 100644 (file)
 #define GMX_GMXPREPROCESS_READ_CONFORMATION_H
 
 #include "types/simple.h"
-#include "atomprop.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+struct gmx_atomprop;
 struct t_atoms;
 
 /*! \brief Allocate and fill an array of inter-atomic half distances
@@ -50,7 +50,7 @@ struct t_atoms;
  * default value. Used directly and indirectly by solvate and
  * insert-molecules for deciding whether molecules clash. The return
  * pointer should be freed by the caller. */
-real *makeExclusionDistances(const struct t_atoms *a, gmx_atomprop_t aps,
+real *makeExclusionDistances(const struct t_atoms *a, struct gmx_atomprop *aps,
                              real defaultDistance, real scaleFactor);
 
 /*! \brief Read a conformation from a file, allocate and fill data structures.
index 90ade757478afdc05c95af2b1361bf3c059ebe41..a639c08a43d46790c6fab33f00f3e5802ee297bf 100644 (file)
 #include <string.h>
 
 #include "typedefs.h"
-#include "gromacs/utility/smalloc.h"
-#include "gromacs/utility/cstringutil.h"
 #include "gromacs/fileio/confio.h"
 #include "macros.h"
 #include "gromacs/utility/futil.h"
-#include "atomprop.h"
 #include "names.h"
-#include "gromacs/math/vec.h"
-#include "gromacs/utility/fatalerror.h"
-#include "gromacs/commandline/pargs.h"
 #include "gromacs/gmxlib/conformation-utilities.h"
 #include "addconf.h"
 #include "read-conformation.h"
 #include "gromacs/fileio/pdbio.h"
 
+#include "gromacs/commandline/pargs.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/topology/atomprop.h"
+#include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
+
 #ifdef DEBUG
 static void print_stat(rvec *x, int natoms, matrix box)
 {
index 686b300e2893b4c3b22d30927e412213ad16a647..06962af891003bd66996c59532080a4e3ec0bba5 100644 (file)
@@ -56,7 +56,6 @@
 #include "pdb2top.h"
 #include "gen_ad.h"
 #include "gpp_nextnb.h"
-#include "atomprop.h"
 #include "hackblock.h"
 #include "nm2type.h"
 
index 91ecdded11fd6d7df41001ef30f93f64180a9985..47c703efa5aef4909c3f4aab19b83ff68d555891 100644 (file)
 #include <string.h>
 
 #include "macros.h"
-#include "gromacs/commandline/pargs.h"
 #include "txtdump.h"
-#include "gromacs/utility/fatalerror.h"
-#include "atomprop.h"
 #include "gromacs/math/vec.h"
-#include "gromacs/pbcutil/pbc.h"
 #include "gromacs/math/units.h"
 #include "index.h"
-#include "gromacs/utility/smalloc.h"
 #include "names.h"
-#include "gromacs/topology/mtop_util.h"
 #include "gromacs/utility/futil.h"
 #include "gromacs/fileio/gmxfio.h"
 #include "gromacs/fileio/trnio.h"
 #include "gromacs/fileio/enxio.h"
 #include "gromacs/fileio/tpxio.h"
 #include "gromacs/fileio/trxio.h"
+
+#include "gromacs/commandline/pargs.h"
+#include "gromacs/pbcutil/pbc.h"
+#include "gromacs/topology/atomprop.h"
 #include "gromacs/topology/block.h"
+#include "gromacs/topology/mtop_util.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
 
 #include "compare.h"
 
index a6ffdfb009f8e1c7a6801089681703bc82a240ff..fb900cfca091208dc068006c50d3cf4cfd5a65e5 100644 (file)
@@ -36,6 +36,7 @@ file(GLOB TOPOLOGY_SOURCES *.cpp *.c)
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TOPOLOGY_SOURCES} PARENT_SCOPE)
 
 set(TOPOLOGY_PUBLIC_HEADERS
+    atomprop.h
     atoms.h
     block.h
     idef.h
similarity index 97%
rename from src/gromacs/gmxlib/atomprop.c
rename to src/gromacs/topology/atomprop.cpp
index 0b359886e5026b86eb2c4e9f758545110fc35d48..519a5bb897a31e0fb03325db63ea60d5de839d6a 100644 (file)
@@ -34,6 +34,8 @@
  * To help us fund GROMACS development, we humbly ask that you cite
  * the research papers on the package. Check out http://www.gromacs.org.
  */
+#include "gromacs/topology/atomprop.h"
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 #include <string.h>
 
 #include "gromacs/fileio/strdb.h"
-#include "gromacs/legacyheaders/atomprop.h"
 #include "gromacs/legacyheaders/copyrite.h"
 #include "gromacs/legacyheaders/index.h"
-#include "gromacs/legacyheaders/macros.h"
-#include "gromacs/legacyheaders/typedefs.h"
 #include "gromacs/math/utilities.h"
 #include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/fatalerror.h"
@@ -226,7 +225,7 @@ static void read_prop(gmx_atomprop_t aps, int eprop, double factor)
     while (get_a_line(fp, line, STRLEN))
     {
         line_no++;
-        if (sscanf(line, "%s %s %lf", resnm, atomnm, &pp) == 3)
+        if (sscanf(line, "%31s %31s %20lf", resnm, atomnm, &pp) == 3)
         {
             pp *= factor;
             add_prop(ap, aps->restype, resnm, atomnm, pp, line_no);
@@ -281,7 +280,6 @@ static void set_prop(gmx_atomprop_t aps, int eprop)
 gmx_atomprop_t gmx_atomprop_init(void)
 {
     gmx_atomprop *aps;
-    int           p;
 
     snew(aps, 1);
 
@@ -350,7 +348,6 @@ gmx_bool gmx_atomprop_query(gmx_atomprop_t aps,
                             real *value)
 {
     gmx_atomprop *ap = (gmx_atomprop*) aps;
-    size_t        i;
     int           j;
 #define MAXQ 32
     char          atomname[MAXQ], resname[MAXQ];
@@ -367,8 +364,9 @@ gmx_bool gmx_atomprop_query(gmx_atomprop_t aps,
     }
     if (isdigit(atomnm[0]))
     {
+        int i;
         /* put digit after atomname */
-        for (i = 1; (i < min(MAXQ-1, strlen(atomnm))); i++)
+        for (i = 1; i < MAXQ-1 && atomnm[i] != '\0'; i++)
         {
             atomname[i-1] = atomnm[i];
         }
@@ -430,5 +428,5 @@ int gmx_atomprop_atomnumber(gmx_atomprop_t aps, const char *elem)
             return gmx_nint(ap->prop[epropElement].value[i]);
         }
     }
-    return NOTSET;
+    return -1;
 }
similarity index 93%
rename from src/gromacs/legacyheaders/atomprop.h
rename to src/gromacs/topology/atomprop.h
index c70f760ec514e70b8dd09a0095d6be8124b93082..33b0c60da845e6c479f9a476daf7029f1d6324ed 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) 2010, by the GROMACS development team, led by
+ * Copyright (c) 2010,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.
  * 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_ATOMPROP_H
+#define GMX_TOPOLOGY_ATOMPROP_H
 
-#ifndef _atomprop_h
-#define _atomprop_h
+#include "../utility/basedefinitions.h"
+#include "../utility/real.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#include "index.h"
-
 /* Abstract type for the atom property database */
 typedef struct gmx_atomprop *gmx_atomprop_t;
 
@@ -75,5 +75,4 @@ gmx_bool gmx_atomprop_query(gmx_atomprop_t aps,
 }
 #endif
 
-
 #endif
index 5add6153909cf051ab6590ad84f34dbfbd228ffa..b8084b433a8e21ec0b1bf5860265a4cbb251b4f9 100644 (file)
@@ -43,7 +43,6 @@
 
 #include <string>
 
-#include "gromacs/legacyheaders/atomprop.h"
 #include "gromacs/legacyheaders/copyrite.h"
 
 #include "gromacs/analysisdata/analysisdata.h"
@@ -59,6 +58,7 @@
 #include "gromacs/selection/nbsearch.h"
 #include "gromacs/selection/selection.h"
 #include "gromacs/selection/selectionoption.h"
+#include "gromacs/topology/atomprop.h"
 #include "gromacs/topology/topology.h"
 #include "gromacs/trajectoryanalysis/analysissettings.h"
 #include "gromacs/utility/arrayref.h"
index 087a8eea33e23d03538a5a867076c3a50fb66a75..2128e3f24570dcd6ed8b4a4f421c334a0c389e6d 100644 (file)
@@ -47,7 +47,6 @@
 #include <string>
 #include <vector>
 
-#include "gromacs/legacyheaders/atomprop.h"
 #include "gromacs/legacyheaders/copyrite.h"
 
 #include "gromacs/analysisdata/analysisdata.h"
@@ -64,6 +63,7 @@
 #include "gromacs/pbcutil/pbc.h"
 #include "gromacs/selection/selection.h"
 #include "gromacs/selection/selectionoption.h"
+#include "gromacs/topology/atomprop.h"
 #include "gromacs/topology/symtab.h"
 #include "gromacs/topology/topology.h"
 #include "gromacs/trajectoryanalysis/analysismodule.h"
index a4ddb6541a61015c9010c743fa1e4c8a0560b62c..4541de232af7a531cd2f347811e903d914a8d2fe 100644 (file)
 
 #include "typedefs.h"
 #include "macros.h"
-#include "atomprop.h"
 #include "names.h"
-#include "gromacs/pbcutil/pbc.h"
 #include "copyrite.h"
 
+#include "gromacs/fileio/tpxio.h"
 #include "gromacs/math/utilities.h"
 #include "gromacs/math/vec.h"
-#include "gromacs/fileio/tpxio.h"
+#include "gromacs/pbcutil/pbc.h"
+#include "gromacs/topology/atomprop.h"
 #include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/futil.h"
 #include "gromacs/utility/smalloc.h"