예제 #1
0
static void
init_output_pos(t_topology * /* top */, gmx_ana_selvalue_t *out, void *data)
{
    t_methoddata_pos *d = (t_methoddata_pos *)data;

    gmx_ana_poscalc_init_pos(d->pc, out->u.p);
}
예제 #2
0
/*!
 * \param[in]     top   Topology data structure.
 * \param[in,out] out   Pointer to output data structure.
 * \param[in,out] data  Should point to \c t_methoddata_pos.
 * \returns       0 for success.
 */
static int
init_output_pos(t_topology *top, gmx_ana_selvalue_t *out, void *data)
{
    t_methoddata_pos *d = (t_methoddata_pos *)data;

    gmx_ana_poscalc_init_pos(d->pc, out->u.p);
    gmx_ana_pos_set_evalgrp(out->u.p, &d->g);
    return 0;
}
예제 #3
0
파일: poscalc.cpp 프로젝트: hasagar/gromacs
void PositionCalculationCollection::initEvaluation()
{
    if (impl_->bInit_)
    {
        return;
    }
    gmx_ana_poscalc_t *pc = impl_->first_;
    while (pc)
    {
        /* Initialize position storage for base calculations */
        if (pc->p)
        {
            gmx_ana_poscalc_init_pos(pc, pc->p);
        }
        /* Construct the mapping of the base positions */
        if (pc->sbase)
        {
            int                     bi, bj;

            snew(pc->baseid, pc->b.nr);
            for (bi = bj = 0; bi < pc->b.nr; ++bi, ++bj)
            {
                while (pc->sbase->b.a[pc->sbase->b.index[bj]] != pc->b.a[pc->b.index[bi]])
                {
                    ++bj;
                }
                pc->baseid[bi] = bj;
            }
        }
        /* Free the block data for dynamic calculations */
        if (pc->flags & POS_DYNAMIC)
        {
            if (pc->b.nalloc_index > 0)
            {
                sfree(pc->b.index);
                pc->b.nalloc_index = 0;
            }
            if (pc->b.nalloc_a > 0)
            {
                sfree(pc->b.a);
                pc->b.nalloc_a = 0;
            }
        }
        pc = pc->next;
    }
    impl_->bInit_ = true;
}
예제 #4
0
/*!
 * \param[in,out] pcc Position calculation collection to initialize.
 *
 * This function does some final initialization of the data structures in the
 * collection to prepare them for evaluation.
 * After this function has been called, it is no longer possible to add new
 * calculations to the collection.
 *
 * This function is automatically called by gmx_ana_poscalc_init_frame() 
 * if not called by the user earlier.
 * Multiple calls to the function are ignored.
 */
void
gmx_ana_poscalc_init_eval(gmx_ana_poscalc_coll_t *pcc)
{
    gmx_ana_poscalc_t      *pc;
    int                     bi, bj;

    if (pcc->bInit)
    {
        return;
    }
    pc = pcc->first;
    while (pc)
    {
        /* Initialize position storage for base calculations */
        if (pc->p)
        {
            gmx_ana_poscalc_init_pos(pc, pc->p);
        }
        /* Construct the mapping of the base positions */
        if (pc->sbase)
        {
            snew(pc->baseid, pc->b.nr);
            for (bi = bj = 0; bi < pc->b.nr; ++bi, ++bj)
            {
                while (pc->sbase->b.a[pc->sbase->b.index[bj]] != pc->b.a[pc->b.index[bi]])
                {
                    ++bj;
                }
                pc->baseid[bi] = bj;
            }
        }
        /* Free the block data for dynamic calculations */
        if ((pc->flags & POS_DYNAMIC) && pc->b.nalloc_index > 0)
        {
            sfree(pc->b.index);
            sfree(pc->b.a);
            pc->b.nalloc_index = 0;
            pc->b.nalloc_a     = 0;
        }
        pc = pc->next;
    }
    pcc->bInit = TRUE;
}