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
gmx_localtop_t *gmx_mtop_generate_local_top(gmx_mtop_t *mtop,t_inputrec *ir)
{
    gmx_localtop_t *top;

    snew(top,1);

    gen_local_top(mtop,ir,top);

    return top;
}
Ejemplo n.º 3
0
gmx_localtop_t *gmx_mtop_generate_local_top(const gmx_mtop_t *mtop,
                                            const t_inputrec *ir)
{
    gmx_localtop_t *top;

    snew(top,1);

    gen_local_top(mtop,ir,TRUE,top);

    return top;
}
Ejemplo n.º 4
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;
}