示例#1
0
文件: topsort.c 项目: hasagar/gromacs
static gmx_bool ip_pert(int ftype, const t_iparams *ip)
{
    gmx_bool bPert;
    int      i;

    if (NRFPB(ftype) == 0)
    {
        return FALSE;
    }

    switch (ftype)
    {
        case F_BONDS:
        case F_G96BONDS:
        case F_HARMONIC:
        case F_ANGLES:
        case F_G96ANGLES:
        case F_IDIHS:
            bPert = (ip->harmonic.rA  != ip->harmonic.rB ||
                     ip->harmonic.krA != ip->harmonic.krB);
            break;
        case F_MORSE:
            bPert = (ip->morse.b0A  != ip->morse.b0B ||
                     ip->morse.cbA  != ip->morse.cbB ||
                     ip->morse.betaA  != ip->morse.betaB);
            break;
        case F_RESTRBONDS:
            bPert = (ip->restraint.lowA  != ip->restraint.lowB ||
                     ip->restraint.up1A  != ip->restraint.up1B ||
                     ip->restraint.up2A  != ip->restraint.up2B ||
                     ip->restraint.kA    != ip->restraint.kB);
            break;
        case F_PDIHS:
        case F_PIDIHS:
        case F_ANGRES:
        case F_ANGRESZ:
            bPert = (ip->pdihs.phiA != ip->pdihs.phiB ||
                     ip->pdihs.cpA  != ip->pdihs.cpB);
            break;
        case F_RBDIHS:
            bPert = FALSE;
            for (i = 0; i < NR_RBDIHS; i++)
            {
                if (ip->rbdihs.rbcA[i] != ip->rbdihs.rbcB[i])
                {
                    bPert = TRUE;
                }
            }
            break;
        case F_TABBONDS:
        case F_TABBONDSNC:
        case F_TABANGLES:
        case F_TABDIHS:
            bPert = (ip->tab.kA != ip->tab.kB);
            break;
        case F_POSRES:
            bPert = FALSE;
            for (i = 0; i < DIM; i++)
            {
                if (ip->posres.pos0A[i] != ip->posres.pos0B[i] ||
                    ip->posres.fcA[i]   != ip->posres.fcB[i])
                {
                    bPert = TRUE;
                }
            }
            break;
        case F_DIHRES:
            bPert = ((ip->dihres.phiA != ip->dihres.phiB) ||
                     (ip->dihres.dphiA != ip->dihres.dphiB) ||
                     (ip->dihres.kfacA != ip->dihres.kfacB));
            break;
        case F_LJ14:
            bPert = (ip->lj14.c6A  != ip->lj14.c6B ||
                     ip->lj14.c12A != ip->lj14.c12B);
            break;
        case F_CMAP:
            bPert = FALSE;
            break;
        default:
            bPert = FALSE;
            gmx_fatal(FARGS, "Function type %s not implemented in ip_pert",
                      interaction_function[ftype].longname);
    }

    return bPert;
}
示例#2
0
static bool ip_pert(int ftype,t_iparams *ip)
{
    bool bPert;
    int  i;

    if (NRFPB(ftype) == 0)
    {
        return FALSE;
    }

    switch (ftype)
    {
    case F_BONDS:
    case F_G96BONDS:
    case F_HARMONIC:
    case F_ANGLES:
    case F_G96ANGLES:
    case F_IDIHS:
        bPert = (ip->harmonic.rA  != ip->harmonic.rB ||
                 ip->harmonic.krA != ip->harmonic.krB);
        break;
    case F_PDIHS:
    case F_ANGRES:
    case F_ANGRESZ:
        bPert = (ip->pdihs.phiA != ip->pdihs.phiB ||
                 ip->pdihs.cpA  != ip->pdihs.cpB);
        break;
    case F_RBDIHS:
        bPert = FALSE;
        for(i=0; i<NR_RBDIHS; i++)
        {
            if (ip->rbdihs.rbcA[i] != ip->rbdihs.rbcB[i])
            {
                bPert = TRUE;
            }
        }
        break;
    case F_TABBONDS:
    case F_TABBONDSNC:
    case F_TABANGLES:
    case F_TABDIHS:
        bPert = (ip->tab.kA != ip->tab.kB);
        break;
    case F_POSRES:
        bPert = FALSE;
        for(i=0; i<DIM; i++)
        {
            if (ip->posres.pos0A[i] != ip->posres.pos0B[i] ||
                ip->posres.fcA[i]   != ip->posres.fcB[i])
            {
                bPert = TRUE;
            }
        }
        break;
    case F_LJ14:
        bPert = (ip->lj14.c6A  != ip->lj14.c6B ||
                 ip->lj14.c12A != ip->lj14.c12B);
        break;
    default:
        bPert = FALSE;
        gmx_fatal(FARGS,"Function type %s not implemented in ip_pert",
                  interaction_function[ftype].longname);
    }

    return bPert;
}