Remove unnecessary config.h includes
[alexxy/gromacs.git] / src / gromacs / gmxlib / typedefs.c
index 641ed8e34206d3448beb84cbee3daa0c2d257968..134f8c0ca55a3d1e4829d4f7c7550360d5e762f5 100644 (file)
  * the research papers on the package. Check out http://www.gromacs.org.
  */
 /* This file is completely threadsafe - keep it that way! */
-#include "typedefs.h"
+#include "gmxpre.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gromacs/legacyheaders/typedefs.h"
 
 #include <string.h>
 
-#include "thread_mpi/threads.h"
-
-#include "macros.h"
+#include "gromacs/legacyheaders/macros.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/pbcutil/pbc.h"
 #include "gromacs/random/random.h"
-#include "gromacs/topology/atoms.h"
-#include "gromacs/topology/block.h"
-#include "gromacs/topology/symtab.h"
 #include "gromacs/utility/smalloc.h"
 
 /* The source code in this file should be thread-safe.
       Please keep it that way. */
 
-
-
-static gmx_bool            bOverAllocDD     = FALSE;
-static tMPI_Thread_mutex_t over_alloc_mutex = TMPI_THREAD_MUTEX_INITIALIZER;
-
-
-void set_over_alloc_dd(gmx_bool set)
-{
-    tMPI_Thread_mutex_lock(&over_alloc_mutex);
-    /* we just make sure that we don't set this at the same time.
-       We don't worry too much about reading this rarely-set variable */
-    bOverAllocDD = set;
-    tMPI_Thread_mutex_unlock(&over_alloc_mutex);
-}
-
-int over_alloc_dd(int n)
-{
-    if (bOverAllocDD)
-    {
-        return OVER_ALLOC_FAC*n + 100;
-    }
-    else
-    {
-        return n;
-    }
-}
-
 int gmx_int64_to_int(gmx_int64_t step, const char *warn)
 {
     int i;
@@ -101,55 +67,6 @@ int gmx_int64_to_int(gmx_int64_t step, const char *warn)
     return i;
 }
 
-char *gmx_step_str(gmx_int64_t i, char *buf)
-{
-    sprintf(buf, "%"GMX_PRId64, i);
-
-    return buf;
-}
-
-void init_groups(gmx_groups_t *groups)
-{
-    int g;
-
-    groups->ngrpname = 0;
-    groups->grpname  = NULL;
-    for (g = 0; (g < egcNR); g++)
-    {
-        groups->grps[g].nm_ind = NULL;
-        groups->ngrpnr[g]      = 0;
-        groups->grpnr[g]       = NULL;
-    }
-
-}
-
-void init_mtop(gmx_mtop_t *mtop)
-{
-    mtop->name         = NULL;
-    mtop->nmoltype     = 0;
-    mtop->moltype      = NULL;
-    mtop->nmolblock    = 0;
-    mtop->molblock     = NULL;
-    mtop->maxres_renum = 0;
-    mtop->maxresnr     = -1;
-    init_groups(&mtop->groups);
-    init_block(&mtop->mols);
-    open_symtab(&mtop->symtab);
-}
-
-void init_top(t_topology *top)
-{
-    int i;
-
-    top->name = NULL;
-    init_atom (&(top->atoms));
-    init_atomtypes(&(top->atomtypes));
-    init_block(&top->cgs);
-    init_block(&top->mols);
-    init_blocka(&top->excls);
-    open_symtab(&top->symtab);
-}
-
 void init_inputrec(t_inputrec *ir)
 {
     memset(ir, 0, (size_t)sizeof(*ir));
@@ -158,84 +75,6 @@ void init_inputrec(t_inputrec *ir)
     snew(ir->simtempvals, 1);
 }
 
-void done_moltype(gmx_moltype_t *molt)
-{
-    int f;
-
-    done_atom(&molt->atoms);
-    done_block(&molt->cgs);
-    done_blocka(&molt->excls);
-
-    for (f = 0; f < F_NRE; f++)
-    {
-        sfree(molt->ilist[f].iatoms);
-        molt->ilist[f].nalloc = 0;
-    }
-}
-
-void done_molblock(gmx_molblock_t *molb)
-{
-    if (molb->nposres_xA > 0)
-    {
-        molb->nposres_xA = 0;
-        sfree(molb->posres_xA);
-    }
-    if (molb->nposres_xB > 0)
-    {
-        molb->nposres_xB = 0;
-        sfree(molb->posres_xB);
-    }
-}
-
-void done_mtop(gmx_mtop_t *mtop, gmx_bool bDoneSymtab)
-{
-    int i;
-
-    if (bDoneSymtab)
-    {
-        done_symtab(&mtop->symtab);
-    }
-
-    sfree(mtop->ffparams.functype);
-    sfree(mtop->ffparams.iparams);
-
-    for (i = 0; i < mtop->nmoltype; i++)
-    {
-        done_moltype(&mtop->moltype[i]);
-    }
-    sfree(mtop->moltype);
-    for (i = 0; i < mtop->nmolblock; i++)
-    {
-        done_molblock(&mtop->molblock[i]);
-    }
-    sfree(mtop->molblock);
-    done_block(&mtop->mols);
-}
-
-void done_top(t_topology *top)
-{
-    int f;
-
-    sfree(top->idef.functype);
-    sfree(top->idef.iparams);
-    for (f = 0; f < F_NRE; ++f)
-    {
-        sfree(top->idef.il[f].iatoms);
-        top->idef.il[f].iatoms = NULL;
-        top->idef.il[f].nalloc = 0;
-    }
-
-    done_atom (&(top->atoms));
-
-    /* For GB */
-    done_atomtypes(&(top->atomtypes));
-
-    done_symtab(&(top->symtab));
-    done_block(&(top->cgs));
-    done_block(&(top->mols));
-    done_blocka(&(top->excls));
-}
-
 static void done_pull_group(t_pull_group *pgrp)
 {
     if (pgrp->nat > 0)