本文整理汇总了C++中Mol::getAtomWithIdx方法的典型用法代码示例。如果您正苦于以下问题:C++ Mol::getAtomWithIdx方法的具体用法?C++ Mol::getAtomWithIdx怎么用?C++ Mol::getAtomWithIdx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mol
的用法示例。
在下文中一共展示了Mol::getAtomWithIdx方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test4
void test4() {
BOOST_LOG(rdErrorLog) << "---------------------- Test4" << std::endl;
Mol m;
Atom *a = new Atom(6);
// we copy in addAtom, so this is safe
m.addAtom(a);
m.addAtom(a);
m.addAtom(a);
m.addAtom(a);
m.addAtom(a);
m.addAtom(a);
m.addAtom(a);
delete a;
m.addBond(0, 1, Bond::SINGLE);
m.addBond(1, 2, Bond::DOUBLE);
m.addBond(2, 3, Bond::SINGLE);
m.addBond(3, 4, Bond::DOUBLE);
m.addBond(4, 5, Bond::SINGLE);
m.addBond(5, 0, Bond::DOUBLE);
m.addBond(5, 6, Bond::SINGLE);
MolOps::sanitizeMol(m);
ATOM_NULL_QUERY *aeq = makeAtomNullQuery();
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(0)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(1)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(5)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(6)), "");
delete aeq;
BOOST_LOG(rdErrorLog) << "Done!" << std::endl;
}
示例2: test5
void test5(){
BOOST_LOG(rdErrorLog) << "---------------------- Test5" << std::endl;
Mol m;
Atom *a = new Atom(6);
// we copy in addAtom, so this is safe
m.addAtom(a);
m.addAtom(a);
m.addAtom(a);
m.addAtom(a);
m.addAtom(a);
m.addAtom(a);
m.addAtom(a);
delete a;
m.addBond(0,1,Bond::SINGLE);
m.addBond(1,2,Bond::DOUBLE);
m.addBond(2,3,Bond::SINGLE);
m.addBond(3,4,Bond::DOUBLE);
m.addBond(4,5,Bond::SINGLE);
m.addBond(5,0,Bond::DOUBLE);
m.addBond(5,6,Bond::SINGLE);
MolOps::sanitizeMol(m);
unsigned int valenceProd;
valenceProd=queryAtomBondProduct(m.getAtomWithIdx(0));
TEST_ASSERT(valenceProd==1681); // aromatic*aromatic = 41 * 41 = 1681
valenceProd=queryAtomBondProduct(m.getAtomWithIdx(1));
TEST_ASSERT(valenceProd==1681);
valenceProd=queryAtomBondProduct(m.getAtomWithIdx(5));
TEST_ASSERT(valenceProd==5043);
valenceProd=queryAtomBondProduct(m.getAtomWithIdx(6));
TEST_ASSERT(valenceProd==3);
valenceProd=queryAtomAllBondProduct(m.getAtomWithIdx(6));
TEST_ASSERT(valenceProd==81);
BOOST_LOG(rdErrorLog) << "Done!" << std::endl;
}
示例3: test1
void test1() {
BOOST_LOG(rdErrorLog) << "---------------------- Test1" << std::endl;
Mol qM;
Mol m;
Atom *a = new Atom(6);
// we copy in addAtom, so this is safe
m.addAtom(a);
m.addAtom(a);
delete a;
m.addBond(0, 1, Bond::SINGLE);
a = new Atom(8);
m.addAtom(a);
delete a;
m.addBond(1, 2, Bond::DOUBLE);
MolOps::sanitizeMol(m);
QueryAtom *qA = new QueryAtom(6);
CHECK_INVARIANT(qA->Match(m.getAtomWithIdx(0)), "");
CHECK_INVARIANT(qA->Match(m.getAtomWithIdx(1)), "");
CHECK_INVARIANT(!qA->Match(m.getAtomWithIdx(2)), "");
qA->expandQuery(makeAtomImplicitValenceQuery(3));
CHECK_INVARIANT(qA->Match(m.getAtomWithIdx(0)), "");
CHECK_INVARIANT(!qA->Match(m.getAtomWithIdx(1)), "");
CHECK_INVARIANT(!qA->Match(m.getAtomWithIdx(2)), "");
qM.addAtom(qA);
delete qA;
qA = new QueryAtom(6);
qA->expandQuery(makeAtomNumQuery(8), Queries::COMPOSITE_OR);
qM.addAtom(qA);
delete qA;
qM.addAtom(new QueryAtom(8), true, true);
// Atom::ATOM_SPTR qA(new QueryAtom(6));
QueryBond *qB;
qB = new QueryBond(Bond::UNSPECIFIED);
qB->setOwningMol(qM);
qB->setBeginAtomIdx(0);
qB->setEndAtomIdx(1);
CHECK_INVARIANT(qB->Match(m.getBondWithIdx(0)), "");
CHECK_INVARIANT(qB->Match(m.getBondWithIdx(1)), "");
qM.addBond(qB, true);
qB = new QueryBond(Bond::DOUBLE);
qB->setOwningMol(qM);
qB->setBeginAtomIdx(1);
qB->setEndAtomIdx(2);
qM.addBond(qB, true);
CHECK_INVARIANT(qM.getAtomWithIdx(0)->Match(m.getAtomWithIdx(0)), "");
CHECK_INVARIANT(!qM.getAtomWithIdx(0)->Match(m.getAtomWithIdx(1)), "");
CHECK_INVARIANT(!qM.getAtomWithIdx(0)->Match(m.getAtomWithIdx(2)), "");
CHECK_INVARIANT(qM.getAtomWithIdx(1)->Match(m.getAtomWithIdx(0)), "");
CHECK_INVARIANT(qM.getAtomWithIdx(1)->Match(m.getAtomWithIdx(1)), "");
CHECK_INVARIANT(qM.getAtomWithIdx(1)->Match(m.getAtomWithIdx(2)), "");
CHECK_INVARIANT(!qM.getAtomWithIdx(2)->Match(m.getAtomWithIdx(0)), "");
CHECK_INVARIANT(!qM.getAtomWithIdx(2)->Match(m.getAtomWithIdx(1)), "");
CHECK_INVARIANT(qM.getAtomWithIdx(2)->Match(m.getAtomWithIdx(2)), "");
CHECK_INVARIANT(qM.getBondWithIdx(0)->Match(m.getBondWithIdx(0)), "");
CHECK_INVARIANT(qM.getBondWithIdx(0)->Match(m.getBondWithIdx(1)), "");
CHECK_INVARIANT(!qM.getBondWithIdx(1)->Match(m.getBondWithIdx(0)), "");
CHECK_INVARIANT(qM.getBondWithIdx(1)->Match(m.getBondWithIdx(1)), "");
BOOST_LOG(rdErrorLog) << "Done!" << std::endl;
}
示例4: test3
void test3() {
BOOST_LOG(rdErrorLog) << "---------------------- Test3" << std::endl;
Mol m;
Atom *a = new Atom(6);
// we copy in addAtom, so this is safe
m.addAtom(a);
m.addAtom(a);
m.addAtom(a);
m.addAtom(a);
m.addAtom(a);
m.addAtom(a);
m.addAtom(a);
delete a;
m.addBond(0, 1, Bond::SINGLE);
m.addBond(1, 2, Bond::DOUBLE);
m.addBond(2, 3, Bond::SINGLE);
m.addBond(3, 4, Bond::DOUBLE);
m.addBond(4, 5, Bond::SINGLE);
m.addBond(5, 0, Bond::DOUBLE);
m.addBond(5, 6, Bond::SINGLE);
MolOps::sanitizeMol(m);
ATOM_EQUALS_QUERY *aeq = makeAtomExplicitDegreeQuery(3);
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(0)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(1)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(5)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(6)), "");
delete aeq;
aeq = makeAtomExplicitDegreeQuery(2);
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(0)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(1)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(5)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(6)), "");
delete aeq;
aeq = makeAtomHCountQuery(1);
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(0)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(1)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(5)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(6)), "");
delete aeq;
aeq = makeAtomInNRingsQuery(1);
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(0)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(1)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(5)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(6)), "");
delete aeq;
aeq = makeAtomInNRingsQuery(0);
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(0)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(1)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(5)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(6)), "");
delete aeq;
aeq = makeAtomAromaticQuery();
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(0)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(1)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(5)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(6)), "");
delete aeq;
aeq = makeAtomAliphaticQuery();
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(0)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(1)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(5)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(6)), "");
delete aeq;
aeq = makeAtomInRingQuery();
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(0)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(1)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(5)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(6)), "");
aeq->setNegation(true);
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(0)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(1)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(5)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(6)), "");
delete aeq;
aeq = makeAtomInRingOfSizeQuery(6);
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(0)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(1)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(5)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(6)), "");
aeq->setNegation(true);
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(0)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(1)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(5)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(6)), "");
delete aeq;
aeq = makeAtomInRingOfSizeQuery(5);
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(0)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(1)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(5)), "");
CHECK_INVARIANT(!aeq->Match(m.getAtomWithIdx(6)), "");
//.........这里部分代码省略.........