Move residuetype handling to its own file.
authorTeemu Murtola <teemu.murtola@gmail.com>
Thu, 5 Jun 2014 04:08:22 +0000 (07:08 +0300)
committerDavid van der Spoel <davidvanderspoel@gmail.com>
Sat, 7 Jun 2014 07:49:46 +0000 (09:49 +0200)
Change-Id: I430dcb08db65479d4865e032a24effbacc87d28e

14 files changed:
src/gromacs/fileio/pdbio.c
src/gromacs/gmxana/dlist.c
src/gromacs/gmxana/gmx_chi.c
src/gromacs/gmxana/gstat.h
src/gromacs/gmxpreprocess/gen_vsite.c
src/gromacs/gmxpreprocess/pdb2gmx.c
src/gromacs/gmxpreprocess/pdb2top.cpp
src/gromacs/gmxpreprocess/xlate.c
src/gromacs/gmxpreprocess/xlate.h
src/gromacs/topology/atomprop.cpp
src/gromacs/topology/index.cpp
src/gromacs/topology/index.h
src/gromacs/topology/residuetypes.cpp [new file with mode: 0644]
src/gromacs/topology/residuetypes.h [new file with mode: 0644]

index ecbfa7c75b6fc86b9ec04710d4cd79c5564d90b9..39b8355b6d7be3f06da8243731574bfaf988da75 100644 (file)
@@ -54,7 +54,7 @@
 #include "gromacs/math/vec.h"
 #include "gromacs/pbcutil/pbc.h"
 #include "gromacs/topology/atomprop.h"
-#include "gromacs/topology/index.h"
+#include "gromacs/topology/residuetypes.h"
 #include "gromacs/topology/symtab.h"
 #include "gromacs/topology/topology.h"
 #include "gromacs/utility/cstringutil.h"
index f44fe45ec853063ec2dbce74529ac76b82b72a1d..90ac8732c9730ec8918819e8afc77a9f905e9bc9 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 
-#include "gromacs/utility/smalloc.h"
 #include "gstat.h"
+
+#include "gromacs/topology/residuetypes.h"
 #include "gromacs/utility/fatalerror.h"
-#include "gromacs/topology/index.h"
+#include "gromacs/utility/smalloc.h"
 
 t_dlist *mk_dlist(FILE *log,
                   t_atoms *atoms, int *nlist,
index 89882e96e9fd24593b44b7d5de522d1a2dc5c3bc..b0f46c0a0906d0535826a45313430503c7c9a94b 100644 (file)
@@ -50,7 +50,7 @@
 #include "macros.h"
 #include "gromacs/math/utilities.h"
 #include "gromacs/math/units.h"
-#include "gromacs/topology/index.h"
+#include "gromacs/topology/residuetypes.h"
 #include "gromacs/utility/smalloc.h"
 #include "gromacs/commandline/pargs.h"
 #include "gromacs/fileio/tpxio.h"
index 8c9895a8557b20c5aafdc09e45ae9ecdbfbf796e..7bfb9a257d04f876d663d1778f34a70e9a9fcbbb 100644 (file)
@@ -41,6 +41,7 @@
 #include "../legacyheaders/oenv.h"
 #include "../commandline/pargs.h"
 #include "../topology/index.h"
+#include "../topology/residuetypes.h"
 
 #ifdef __cplusplus
 extern "C" {
index 3dfbaa48bd50c9c48711f4fe77251ea960461b68..c3cdddb5976215c45a02f8239e03a5ec66a8e9ef 100644 (file)
 #include "gromacs/math/vec.h"
 #include "toputil.h"
 #include "gromacs/math/units.h"
-#include "gromacs/topology/index.h"
 #include "names.h"
 #include "gromacs/utility/futil.h"
 #include "gpp_atomtype.h"
 #include "fflibutil.h"
 
+#include "gromacs/topology/residuetypes.h"
 #include "gromacs/topology/symtab.h"
 #include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/fatalerror.h"
index 883d5b79c32f015c1fc11bba09a8de6cb54bc6d7..cf0bc05f2fcfc1d0401cab1326c062447c908be9 100644 (file)
@@ -71,6 +71,7 @@
 #include "gromacs/topology/atomprop.h"
 #include "gromacs/topology/block.h"
 #include "gromacs/topology/index.h"
+#include "gromacs/topology/residuetypes.h"
 #include "gromacs/topology/symtab.h"
 #include "gromacs/utility/smalloc.h"
 #include "gromacs/utility/fatalerror.h"
index a71f273c870a3f19fb3d05debd29940caf499fd5..676ba94c42dd60d9a053067411ea0f4b28093a83 100644 (file)
@@ -57,7 +57,6 @@
 #include "gromacs/fileio/pdbio.h"
 #include "gen_ad.h"
 #include "gromacs/fileio/filenm.h"
-#include "gromacs/topology/index.h"
 #include "gen_vsite.h"
 #include "add_par.h"
 #include "toputil.h"
@@ -65,6 +64,7 @@
 #include "copyrite.h"
 
 #include "gromacs/fileio/strdb.h"
+#include "gromacs/topology/residuetypes.h"
 #include "gromacs/topology/symtab.h"
 #include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/fatalerror.h"
index faf148c120bdacb9f762657e8053ef6ed8173484..b9400345dd1a851aad6f5cc1dffa659ff27f51d7 100644 (file)
 #include <string.h>
 
 #include "typedefs.h"
-#include "gromacs/topology/index.h"
 #include "fflibutil.h"
 #include "hackblock.h"
 #include "xlate.h"
 
 #include "gromacs/fileio/strdb.h"
+#include "gromacs/topology/residuetypes.h"
 #include "gromacs/topology/symtab.h"
 #include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/fatalerror.h"
index 83d667b0b3402c4ca56455047e4d01ffece6ca07..9ed45b9b75a5f5579443c8deb7dbcbbd91ba09e1 100644 (file)
@@ -38,7 +38,7 @@
 #ifndef GMX_GMXPREPROCESS_XLATE_H
 #define GMX_GMXPREPROCESS_XLATE_H
 
-#include "gromacs/topology/index.h"
+#include "gromacs/topology/residuetypes.h"
 
 #ifdef __cplusplus
 extern "C" {
index 09cb30785b2251ae5d26bb2f1ecdc82e499cd652..5bba2874597b3b7332326de3b3a096c2c73f3b0c 100644 (file)
@@ -46,7 +46,7 @@
 #include "gromacs/fileio/strdb.h"
 #include "gromacs/legacyheaders/copyrite.h"
 #include "gromacs/math/utilities.h"
-#include "gromacs/topology/index.h"
+#include "gromacs/topology/residuetypes.h"
 #include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/futil.h"
index 31b2e663cc51562ede4000a36213478e763c71cc..d0afa4658f67603542ad3c573dd930523bf209df 100644 (file)
 #include "gromacs/topology/atoms.h"
 #include "gromacs/topology/block.h"
 #include "gromacs/topology/invblock.h"
+#include "gromacs/topology/residuetypes.h"
 #include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/fatalerror.h"
-#include "gromacs/utility/futil.h"
 #include "gromacs/utility/smalloc.h"
 
-const char gmx_residuetype_undefined[] = "Other";
-
-struct gmx_residuetype
-{
-    int      n;
-    char **  resname;
-    char **  restype;
-
-};
-
-
 static gmx_bool gmx_ask_yesno(gmx_bool bASK)
 {
     char c;
@@ -586,239 +575,6 @@ static void analyse_prot(const char ** restype, t_atoms *atoms,
 }
 
 
-
-
-/* Return 0 if the name was found, otherwise -1.
- * p_restype is set to a pointer to the type name, or 'Other' if we did not find it.
- */
-int
-gmx_residuetype_get_type(gmx_residuetype_t rt, const char * resname, const char ** p_restype)
-{
-    int    i, rc;
-
-    rc = -1;
-    for (i = 0; i < rt->n && rc; i++)
-    {
-        rc = gmx_strcasecmp(rt->resname[i], resname);
-    }
-
-    *p_restype = (rc == 0) ? rt->restype[i-1] : gmx_residuetype_undefined;
-
-    return rc;
-}
-
-int
-gmx_residuetype_add(gmx_residuetype_t rt, const char *newresname, const char *newrestype)
-{
-    int           found;
-    const char *  p_oldtype;
-
-    found = !gmx_residuetype_get_type(rt, newresname, &p_oldtype);
-
-    if (found && gmx_strcasecmp(p_oldtype, newrestype))
-    {
-        fprintf(stderr, "Warning: Residue '%s' already present with type '%s' in database, ignoring new type '%s'.",
-                newresname, p_oldtype, newrestype);
-    }
-
-    if (found == 0)
-    {
-        srenew(rt->resname, rt->n+1);
-        srenew(rt->restype, rt->n+1);
-        rt->resname[rt->n] = strdup(newresname);
-        rt->restype[rt->n] = strdup(newrestype);
-        rt->n++;
-    }
-
-    return 0;
-}
-
-
-int
-gmx_residuetype_init(gmx_residuetype_t *prt)
-{
-    FILE                 *  db;
-    char                    line[STRLEN];
-    char                    resname[STRLEN], restype[STRLEN], dum[STRLEN];
-    struct gmx_residuetype *rt;
-
-    snew(rt, 1);
-    *prt = rt;
-
-    rt->n        = 0;
-    rt->resname  = NULL;
-    rt->restype  = NULL;
-
-    db = libopen("residuetypes.dat");
-
-    while (get_a_line(db, line, STRLEN))
-    {
-        strip_comment(line);
-        trim(line);
-        if (line[0] != '\0')
-        {
-            if (sscanf(line, "%s %s %s", resname, restype, dum) != 2)
-            {
-                gmx_fatal(FARGS, "Incorrect number of columns (2 expected) for line in residuetypes.dat");
-            }
-            gmx_residuetype_add(rt, resname, restype);
-        }
-    }
-
-    fclose(db);
-
-    return 0;
-}
-
-
-
-int
-gmx_residuetype_destroy(gmx_residuetype_t rt)
-{
-    int i;
-
-    for (i = 0; i < rt->n; i++)
-    {
-        sfree(rt->resname[i]);
-        sfree(rt->restype[i]);
-    }
-    sfree(rt->resname);
-    sfree(rt->restype);
-    sfree(rt);
-
-    return 0;
-}
-
-int
-gmx_residuetype_get_alltypes(gmx_residuetype_t    rt,
-                             const char ***       p_typenames,
-                             int *                ntypes)
-{
-    int            i, n;
-    const char **  my_typename;
-
-    n           = 0;
-    my_typename = NULL;
-    for (i = 0; i < rt->n; i++)
-    {
-        const char *const p      = rt->restype[i];
-        bool              bFound = false;
-        for (int j = 0; j < n && !bFound; j++)
-        {
-            assert(my_typename != NULL);
-            bFound = !gmx_strcasecmp(p, my_typename[j]);
-        }
-        if (!bFound)
-        {
-            srenew(my_typename, n+1);
-            my_typename[n] = p;
-            n++;
-        }
-    }
-    *ntypes      = n;
-    *p_typenames = my_typename;
-
-    return 0;
-}
-
-
-
-gmx_bool
-gmx_residuetype_is_protein(gmx_residuetype_t rt, const char *resnm)
-{
-    gmx_bool    rc;
-    const char *p_type;
-
-    if (gmx_residuetype_get_type(rt, resnm, &p_type) == 0 &&
-        gmx_strcasecmp(p_type, "Protein") == 0)
-    {
-        rc = TRUE;
-    }
-    else
-    {
-        rc = FALSE;
-    }
-    return rc;
-}
-
-gmx_bool
-gmx_residuetype_is_dna(gmx_residuetype_t rt, const char *resnm)
-{
-    gmx_bool    rc;
-    const char *p_type;
-
-    if (gmx_residuetype_get_type(rt, resnm, &p_type) == 0 &&
-        gmx_strcasecmp(p_type, "DNA") == 0)
-    {
-        rc = TRUE;
-    }
-    else
-    {
-        rc = FALSE;
-    }
-    return rc;
-}
-
-gmx_bool
-gmx_residuetype_is_rna(gmx_residuetype_t rt, const char *resnm)
-{
-    gmx_bool    rc;
-    const char *p_type;
-
-    if (gmx_residuetype_get_type(rt, resnm, &p_type) == 0 &&
-        gmx_strcasecmp(p_type, "RNA") == 0)
-    {
-        rc = TRUE;
-    }
-    else
-    {
-        rc = FALSE;
-    }
-    return rc;
-}
-
-/* Return the size of the arrays */
-int
-gmx_residuetype_get_size(gmx_residuetype_t rt)
-{
-    return rt->n;
-}
-
-/* Search for a residuetype with name resnm within the
- * gmx_residuetype database. Return the index if found,
- * otherwise -1.
- */
-int
-gmx_residuetype_get_index(gmx_residuetype_t rt, const char *resnm)
-{
-    int i, rc;
-
-    rc = -1;
-    for (i = 0; i < rt->n && rc; i++)
-    {
-        rc = gmx_strcasecmp(rt->resname[i], resnm);
-    }
-
-    return (0 == rc) ? i-1 : -1;
-}
-
-/* Return the name of the residuetype with the given index, or
- * NULL if not found. */
-const char *
-gmx_residuetype_get_name(gmx_residuetype_t rt, int index)
-{
-    if (index >= 0 && index < rt->n)
-    {
-        return rt->resname[index];
-    }
-    else
-    {
-        return NULL;
-    }
-}
-
-
-
 void analyse(t_atoms *atoms, t_blocka *gb, char ***gn, gmx_bool bASK, gmx_bool bVerb)
 {
     gmx_residuetype_t rt = NULL;
index 91ec2ce8e189299440714acbaf026f33ddbb1c30..4bba1f80217541ebd406653a493be3fa0698d0c2 100644 (file)
@@ -95,47 +95,6 @@ typedef struct {
 
 t_cluster_ndx *cluster_index(FILE *fplog, const char *ndx);
 
-typedef struct gmx_residuetype *gmx_residuetype_t;
-
-int
-gmx_residuetype_init(gmx_residuetype_t *rt);
-
-int
-gmx_residuetype_destroy(gmx_residuetype_t rt);
-
-int
-gmx_residuetype_get_type(gmx_residuetype_t rt, const char * resname, const char ** p_restype);
-
-int
-gmx_residuetype_add(gmx_residuetype_t rt, const char *newresname, const char *newrestype);
-
-int
-gmx_residuetype_get_alltypes(gmx_residuetype_t    rt,
-                             const char ***       p_typenames,
-                             int *                ntypes);
-
-gmx_bool
-gmx_residuetype_is_protein(gmx_residuetype_t rt, const char *resnm);
-
-gmx_bool
-gmx_residuetype_is_dna(gmx_residuetype_t rt, const char *resnm);
-
-gmx_bool
-gmx_residuetype_is_rna(gmx_residuetype_t rt, const char *resnm);
-
-int
-gmx_residuetype_get_size(gmx_residuetype_t rt);
-
-int
-gmx_residuetype_get_index(gmx_residuetype_t rt, const char *resnm);
-
-const char *
-gmx_residuetype_get_name(gmx_residuetype_t rt, int index);
-
-
-
-
-
 
 void write_index(const char *outf, struct t_blocka *b, char **gnames, gmx_bool bDuplicate, int natoms);
 /* Writes index blocks to outf (writes an indexfile) */
diff --git a/src/gromacs/topology/residuetypes.cpp b/src/gromacs/topology/residuetypes.cpp
new file mode 100644 (file)
index 0000000..461405b
--- /dev/null
@@ -0,0 +1,277 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2010,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.
+ *
+ * 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.
+ */
+#include "gromacs/topology/residuetypes.h"
+
+#include <cassert>
+#include <cstdio>
+
+#include "gromacs/fileio/strdb.h"
+#include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/futil.h"
+#include "gromacs/utility/smalloc.h"
+
+const char gmx_residuetype_undefined[] = "Other";
+
+struct gmx_residuetype
+{
+    int      n;
+    char **  resname;
+    char **  restype;
+};
+
+int
+gmx_residuetype_init(gmx_residuetype_t *prt)
+{
+    FILE                 *  db;
+    char                    line[STRLEN];
+    char                    resname[STRLEN], restype[STRLEN], dum[STRLEN];
+    struct gmx_residuetype *rt;
+
+    snew(rt, 1);
+    *prt = rt;
+
+    rt->n        = 0;
+    rt->resname  = NULL;
+    rt->restype  = NULL;
+
+    db = libopen("residuetypes.dat");
+
+    while (get_a_line(db, line, STRLEN))
+    {
+        strip_comment(line);
+        trim(line);
+        if (line[0] != '\0')
+        {
+            if (sscanf(line, "%1000s %1000s %1000s", resname, restype, dum) != 2)
+            {
+                gmx_fatal(FARGS, "Incorrect number of columns (2 expected) for line in residuetypes.dat");
+            }
+            gmx_residuetype_add(rt, resname, restype);
+        }
+    }
+
+    fclose(db);
+
+    return 0;
+}
+
+int
+gmx_residuetype_destroy(gmx_residuetype_t rt)
+{
+    int i;
+
+    for (i = 0; i < rt->n; i++)
+    {
+        sfree(rt->resname[i]);
+        sfree(rt->restype[i]);
+    }
+    sfree(rt->resname);
+    sfree(rt->restype);
+    sfree(rt);
+
+    return 0;
+}
+
+/* Return 0 if the name was found, otherwise -1.
+ * p_restype is set to a pointer to the type name, or 'Other' if we did not find it.
+ */
+int
+gmx_residuetype_get_type(gmx_residuetype_t rt, const char * resname, const char ** p_restype)
+{
+    int    i, rc;
+
+    rc = -1;
+    for (i = 0; i < rt->n && rc; i++)
+    {
+        rc = gmx_strcasecmp(rt->resname[i], resname);
+    }
+
+    *p_restype = (rc == 0) ? rt->restype[i-1] : gmx_residuetype_undefined;
+
+    return rc;
+}
+
+int
+gmx_residuetype_add(gmx_residuetype_t rt, const char *newresname, const char *newrestype)
+{
+    int           found;
+    const char *  p_oldtype;
+
+    found = !gmx_residuetype_get_type(rt, newresname, &p_oldtype);
+
+    if (found && gmx_strcasecmp(p_oldtype, newrestype))
+    {
+        fprintf(stderr, "Warning: Residue '%s' already present with type '%s' in database, ignoring new type '%s'.",
+                newresname, p_oldtype, newrestype);
+    }
+
+    if (found == 0)
+    {
+        srenew(rt->resname, rt->n+1);
+        srenew(rt->restype, rt->n+1);
+        rt->resname[rt->n] = gmx_strdup(newresname);
+        rt->restype[rt->n] = gmx_strdup(newrestype);
+        rt->n++;
+    }
+
+    return 0;
+}
+
+int
+gmx_residuetype_get_alltypes(gmx_residuetype_t    rt,
+                             const char ***       p_typenames,
+                             int *                ntypes)
+{
+    int            i, n;
+    const char **  my_typename;
+
+    n           = 0;
+    my_typename = NULL;
+    for (i = 0; i < rt->n; i++)
+    {
+        const char *const p      = rt->restype[i];
+        bool              bFound = false;
+        for (int j = 0; j < n && !bFound; j++)
+        {
+            assert(my_typename != NULL);
+            bFound = !gmx_strcasecmp(p, my_typename[j]);
+        }
+        if (!bFound)
+        {
+            srenew(my_typename, n+1);
+            my_typename[n] = p;
+            n++;
+        }
+    }
+    *ntypes      = n;
+    *p_typenames = my_typename;
+
+    return 0;
+}
+
+gmx_bool
+gmx_residuetype_is_protein(gmx_residuetype_t rt, const char *resnm)
+{
+    gmx_bool    rc;
+    const char *p_type;
+
+    if (gmx_residuetype_get_type(rt, resnm, &p_type) == 0 &&
+        gmx_strcasecmp(p_type, "Protein") == 0)
+    {
+        rc = TRUE;
+    }
+    else
+    {
+        rc = FALSE;
+    }
+    return rc;
+}
+
+gmx_bool
+gmx_residuetype_is_dna(gmx_residuetype_t rt, const char *resnm)
+{
+    gmx_bool    rc;
+    const char *p_type;
+
+    if (gmx_residuetype_get_type(rt, resnm, &p_type) == 0 &&
+        gmx_strcasecmp(p_type, "DNA") == 0)
+    {
+        rc = TRUE;
+    }
+    else
+    {
+        rc = FALSE;
+    }
+    return rc;
+}
+
+gmx_bool
+gmx_residuetype_is_rna(gmx_residuetype_t rt, const char *resnm)
+{
+    gmx_bool    rc;
+    const char *p_type;
+
+    if (gmx_residuetype_get_type(rt, resnm, &p_type) == 0 &&
+        gmx_strcasecmp(p_type, "RNA") == 0)
+    {
+        rc = TRUE;
+    }
+    else
+    {
+        rc = FALSE;
+    }
+    return rc;
+}
+
+/* Return the size of the arrays */
+int
+gmx_residuetype_get_size(gmx_residuetype_t rt)
+{
+    return rt->n;
+}
+
+/* Search for a residuetype with name resnm within the
+ * gmx_residuetype database. Return the index if found,
+ * otherwise -1.
+ */
+int
+gmx_residuetype_get_index(gmx_residuetype_t rt, const char *resnm)
+{
+    int i, rc;
+
+    rc = -1;
+    for (i = 0; i < rt->n && rc; i++)
+    {
+        rc = gmx_strcasecmp(rt->resname[i], resnm);
+    }
+
+    return (0 == rc) ? i-1 : -1;
+}
+
+/* Return the name of the residuetype with the given index, or
+ * NULL if not found. */
+const char *
+gmx_residuetype_get_name(gmx_residuetype_t rt, int index)
+{
+    if (index >= 0 && index < rt->n)
+    {
+        return rt->resname[index];
+    }
+    else
+    {
+        return NULL;
+    }
+}
diff --git a/src/gromacs/topology/residuetypes.h b/src/gromacs/topology/residuetypes.h
new file mode 100644 (file)
index 0000000..82c24e8
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * 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.
+ *
+ * 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 GMX_TOPOLOGY_RESIDUETYPES_H
+#define GMX_TOPOLOGY_RESIDUETYPES_H
+
+#include "gromacs/utility/basedefinitions.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+typedef struct gmx_residuetype *gmx_residuetype_t;
+
+int
+gmx_residuetype_init(gmx_residuetype_t *rt);
+
+int
+gmx_residuetype_destroy(gmx_residuetype_t rt);
+
+int
+gmx_residuetype_get_type(gmx_residuetype_t rt, const char *resname, const char **p_restype);
+
+int
+gmx_residuetype_add(gmx_residuetype_t rt, const char *newresname, const char *newrestype);
+
+int
+gmx_residuetype_get_alltypes(gmx_residuetype_t    rt,
+                             const char        ***p_typenames,
+                             int                 *ntypes);
+
+gmx_bool
+gmx_residuetype_is_protein(gmx_residuetype_t rt, const char *resnm);
+
+gmx_bool
+gmx_residuetype_is_dna(gmx_residuetype_t rt, const char *resnm);
+
+gmx_bool
+gmx_residuetype_is_rna(gmx_residuetype_t rt, const char *resnm);
+
+int
+gmx_residuetype_get_size(gmx_residuetype_t rt);
+
+int
+gmx_residuetype_get_index(gmx_residuetype_t rt, const char *resnm);
+
+const char *
+gmx_residuetype_get_name(gmx_residuetype_t rt, int index);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif