Ejemplo n.º 1
0
/*!
 * \param   d  Trajectory analysis data to free.
 */
void
gmx_ana_traj_free(gmx_ana_traj_t *d)
{
    int                 i;

    if (d->top)
    {
        done_top(d->top);
        sfree(d->top);
    }
    if (d->fr)
    {
        /* Gromacs does not seem to have a function for freeing frame data */
        sfree(d->fr->x);
        sfree(d->fr->v);
        sfree(d->fr->f);
        sfree(d->fr);
    }
    sfree(d->xtop);
    sfree(d->sel);
    gmx_ana_selcollection_free(d->sc);
    gmx_ana_poscalc_coll_free(d->pcc);
    sfree(d->grpnames);
    sfree(d);
}
Ejemplo n.º 2
0
/*!
 * \param[out] data  Trajectory analysis data structure poitner to initialize.
 * \param[in]  flags Combination of flags (see \ref analysis_flags).
 * \returns    0 on success.
 */
int
gmx_ana_traj_create(gmx_ana_traj_t **data, unsigned long flags)
{
    gmx_ana_traj_t     *d;
    int                 rc;

    snew(d, 1);

    d->nrefgrps        = 0;
    d->nanagrps        = 1;
    d->frflags         = TRX_NEED_X;
    d->bRmPBC          = TRUE;
    d->bPBC            = TRUE;

    d->trjfile         = NULL;
    d->topfile         = NULL;
    d->ndxfile         = NULL;
    d->selfile         = NULL;
    d->selection       = NULL;

    d->top             = NULL;
    d->bTop            = FALSE;
    d->xtop            = NULL;
    d->ePBC            = -1;
    d->fr              = NULL;
    d->nframes         = 0;

    d->ngrps           = 0;
    d->sel             = NULL;
    d->grpnames        = NULL;

    d->flags           = flags;
    d->topfile_notnull = NULL;
    rc = gmx_ana_poscalc_coll_create(&d->pcc);
    if (rc != 0)
    {
        sfree(d);
        *data = NULL;
        return rc;
    }
    rc = gmx_ana_selcollection_create(&d->sc, d->pcc);
    if (rc != 0)
    {
        gmx_ana_poscalc_coll_free(d->pcc);
        sfree(d);
        *data = NULL;
        return rc;
    }
    d->status          = -1;

    *data              = d;
    return 0;
}
Ejemplo n.º 3
0
SelectionCollection::Impl::~Impl()
{
    _gmx_selelem_free_chain(_sc.root);
    SelectionList::const_iterator isel;
    for (isel = _sc.sel.begin(); isel != _sc.sel.end(); ++isel)
    {
        delete *isel;
    }
    for (int i = 0; i < _sc.nvars; ++i)
    {
        sfree(_sc.varstrs[i]);
    }
    sfree(_sc.varstrs);
    gmx_ana_index_deinit(&_sc.gall);
    if (_sc.mempool)
    {
        _gmx_sel_mempool_destroy(_sc.mempool);
    }
    if (hasFlag(efOwnPositionCollection))
    {
        gmx_ana_poscalc_coll_free(_sc.pcc);
    }
    clearSymbolTable();
}