Ejemplo n.º 1
0
t_topology gmx_mtop_t_to_t_topology(gmx_mtop_t *mtop)
{
    int mt,mb;
    gmx_localtop_t ltop;
    t_topology top;

    gen_local_top(mtop,NULL,&ltop);

    open_symtab(&top.symtab);

    top.name      = mtop->name;
    top.idef      = ltop.idef;
    top.atomtypes = ltop.atomtypes;
    top.cgs       = ltop.cgs;
    top.excls     = ltop.excls;
    top.atoms     = gmx_mtop_global_atoms(mtop);
    top.mols      = mtop->mols;

    /* We only need to free the moltype and molblock data,
     * all other pointers have been copied to top.
     */
    for(mt=0; mt<mtop->nmoltype; mt++)
    {
        done_moltype(&mtop->moltype[mt]);
    }
    sfree(mtop->moltype);

    for(mb=0; mb<mtop->nmolblock; mb++)
    {
        done_molblock(&mtop->molblock[mb]);
    }
    sfree(mtop->molblock);

    return top;
}
Ejemplo n.º 2
0
void done_mtop(gmx_mtop_t *mtop,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);
}
Ejemplo n.º 3
0
t_topology gmx_mtop_t_to_t_topology(gmx_mtop_t *mtop)
{
    int mt,mb;
    gmx_localtop_t ltop;
    t_topology top;

    gen_local_top(mtop,NULL,FALSE,&ltop);

    top.name      = mtop->name;
    top.idef      = ltop.idef;
    top.atomtypes = ltop.atomtypes;
    top.cgs       = ltop.cgs;
    top.excls     = ltop.excls;
    top.atoms     = gmx_mtop_global_atoms(mtop);
    top.mols      = mtop->mols;
    top.symtab    = mtop->symtab;

    /* We only need to free the moltype and molblock data,
     * all other pointers have been copied to top.
     *
     * Well, except for the group data, but we can't free those, because they
     * are used somewhere even after a call to this function.
     */
    for(mt=0; mt<mtop->nmoltype; mt++)
    {
        done_moltype(&mtop->moltype[mt]);
    }
    sfree(mtop->moltype);

    for(mb=0; mb<mtop->nmolblock; mb++)
    {
        done_molblock(&mtop->molblock[mb]);
    }
    sfree(mtop->molblock);

    return top;
}