Exemple #1
0
/*!
 * \param[in] top   Not used.
 * \param[in] npar  Not used.
 * \param[in] param Not used.
 * \param[in,out] data  Should point to \c t_methoddata_pos.
 * \returns       0 on success, a non-zero error code on error.
 *
 * The \c t_methoddata_pos::type field should have been initialized
 * externally using _gmx_selelem_set_kwpos_type().
 */
static int
init_kwpos(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data)
{
    t_methoddata_pos *d = (t_methoddata_pos *)data;
    int               rc;

    if (!(param[0].flags & SPAR_DYNAMIC))
    {
        d->flags &= ~(POS_DYNAMIC | POS_MASKONLY);
    }
    else if (!(d->flags & POS_MASKONLY))
    {
        d->flags |= POS_DYNAMIC;
    }
    rc = gmx_ana_poscalc_create_enum(&d->pc, d->pcc, d->type, d->flags);
    if (rc != 0)
    {
        return rc;
    }
    gmx_ana_poscalc_set_maxindex(d->pc, &d->g);
    return 0;
}
Exemple #2
0
/*! \brief
 * Initializes the reference position calculation for a \ref SEL_EXPRESSION
 * element.
 *
 * \param[in,out] pcc    Position calculation collection to use.
 * \param[in,out] sel    Selection element to initialize.
 * \param[in]     rpost  Reference position type to use (NULL = default).
 * \returns       0 on success, a non-zero error code on error.
 */
static int
set_refpos_type(gmx_ana_poscalc_coll_t *pcc, t_selelem *sel, const char *rpost)
{
    int  rc;

    if (!rpost)
    {
        return 0;
    }

    rc = 0;
    if (sel->u.expr.method->pupdate)
    {
        /* By default, use whole residues/molecules. */
        rc = gmx_ana_poscalc_create_enum(&sel->u.expr.pc, pcc, rpost,
                                         POS_COMPLWHOLE);
    }
    else
    {
        _gmx_selparser_error("warning: '%d' modifier for '%s' ignored",
                             rpost, sel->u.expr.method->name);
    }
    return rc;
}