// Descr: evident
TEST(GeometryTest, GetBond)
{
    vector<Bond> bonds;


    Bond bond1 = Bond(1, 2, 3.0, false);
    Bond bond2 = Bond(3, 4, 3.0, false);
    Bond bond3 = Bond(2, 3, 3.0, false);

    bonds.push_back(bond1);
    EXPECT_EQ( 1, bonds[0].atom1);
    bonds.push_back(bond2);
    bonds.push_back(bond3);

    Bond testBond1 = getBond(bonds, 1, 2);
    Bond testBond2 = getBond(bonds, 3, 4);
    Bond testBond3 = getBond(bonds, 2, 3);
    Bond testBond4 = getBond(bonds, 1, 4);

    EXPECT_EQ( bond1.atom1, testBond1.atom1);
    EXPECT_EQ( -1 , testBond4.atom1);

	EXPECT_TRUE( bond1.atom1 == testBond1.atom1 && bond1.atom2 == testBond1.atom2 && bond1.distance == testBond1.distance );
	EXPECT_TRUE( bond2.atom1 == testBond2.atom1 && bond2.atom2 == testBond2.atom2 && bond2.distance == testBond2.distance );
	EXPECT_TRUE( bond3.atom1 == testBond3.atom1 && bond3.atom2 == testBond3.atom2 && bond3.distance == testBond3.distance );
	EXPECT_TRUE( testBond4.atom1 == -1 && testBond4.atom2 == -1 && testBond4.distance == -1.0 );

}
Beispiel #2
0
void testGetBond()
{
    cout <<"Testing GetBond"<<endl;
    vector<Bond> bonds;

    Bond bond1 = createBond(1, 2, 3.0, false);
    Bond bond2 = createBond(3, 4, 3.0, false);
    Bond bond3 = createBond(2, 3, 3.0, false);

    bonds.push_back(bond1);
    bonds.push_back(bond2);
    bonds.push_back(bond3);

    Bond testBond1 = getBond(bonds, 1, 2);
    Bond testBond2 = getBond(bonds, 3, 4);
    Bond testBond3 = getBond(bonds, 2, 3);
    Bond testBond4 = getBond(bonds, 1, 4);

    assert(bond1.atom1 == testBond1.atom1 && bond1.atom2 == testBond1.atom2 && bond1.distance == testBond1.distance);
    assert(bond2.atom1 == testBond2.atom1 && bond2.atom2 == testBond2.atom2 && bond2.distance == testBond2.distance);
    assert(bond3.atom1 == testBond3.atom1 && bond3.atom2 == testBond3.atom2 && bond3.distance == testBond3.distance);
    assert(testBond4.atom1 == -1 && testBond4.atom2 == -1 && testBond4.distance == -1.0);

    cout <<"Testing GetBond Completed\n"<<endl;
}
// Sets the phosphate-sugar bond type differently based on the bond
// direction.  This allows the phosphate to be closer to one sugar
// than the other, based on the strand direction.
static void
pam5_phosphate_sugar_match(struct patternMatch *match)
{
    struct part *p = match->p;
    struct atom *aPl = p->atoms[match->atomIndices[0]];
    struct atom *aSs = p->atoms[match->atomIndices[1]];
    struct bond *b = getBond(p, aPl, aSs);
    BAIL();
    struct stretch *s = getStretch(p, aPl, aSs);
    BAIL();
    int reverse;

    pam5_requires_gromacs(match->p);
    BAIL();
    init_stack_match();
    BAIL();

    switch (b->direction) {
    case 'F':
        reverse = (b->a1 == aSs);
        break;
    case 'R':
        reverse = (b->a1 == aPl);
        break;
    default:
        ERROR2("pam5_phosphate_sugar_match: bond between ids %d and %d has no direction", aPl->atomID, aSs->atomID);
        p->parseError(p->stream);
        return;
    }
    s->stretchType = reverse ? stretch_5_Ss_Pl_3 : stretch_5_Pl_Ss_3 ;
    trace_setStretchType(match, s);
    //printMatch(match);
}
// Creates the Gv-Pl interaction, which replaces the Gv-Ss-Pl bend
// term.  Only do this on the 5' side.
static void
pam5_groove_phosphate_match(struct patternMatch *match)
{
    struct part *p = match->p;
    struct atom *aGv = p->atoms[match->atomIndices[0]];
    struct atom *aSs = p->atoms[match->atomIndices[1]];
    struct atom *aPl = p->atoms[match->atomIndices[2]];
    struct bond *b = getBond(p, aPl, aSs);
    BAIL();
    struct bond *bond;
    struct bend *bend;
    int reverse;
    char order;

    pam5_requires_gromacs(p);
    BAIL();

    switch (b->direction) {
    case 'F':
        reverse = (b->a1 == aSs);
        break;
    case 'R':
        reverse = (b->a1 == aPl);
        break;
    default:
        ERROR2("pam5_phosphate_sugar_match: bond between ids %d and %d has no direction", aPl->atomID, aSs->atomID);
        p->parseError(p->stream);
        return;
    }

    if (reverse) {
        order = '2';
    } else {
        order = '1';
        bend = getBend(p, aGv, aSs, aPl);
        bend->bendType = bend_Gv_Ss_Pl_5;
    }

    bond = makeBond(p, aPl, aGv, order);
    queueBond(p, bond);
    trace_makeBond(match, bond);
    //printMatch(match);
}