public void TestMatchedBonds()
        {
            Assert.IsNotNull(conformers);

            // make a query
            var query = new PharmacophoreQuery();

            var o  = new PharmacophoreQueryAtom("D", "[OX1]");
            var n1 = new PharmacophoreQueryAtom("A", "[N]");
            var n2 = new PharmacophoreQueryAtom("A", "[N]");

            query.Atoms.Add(o);
            query.Atoms.Add(n1);
            query.Atoms.Add(n2);

            var b1 = new PharmacophoreQueryBond(o, n1, 4.0, 4.5);
            var b2 = new PharmacophoreQueryBond(o, n2, 4.0, 5.0);
            var b3 = new PharmacophoreQueryBond(n1, n2, 5.4, 5.8);

            query.Bonds.Add(b1);
            query.Bonds.Add(b2);
            query.Bonds.Add(b3);

            var  conf1   = conformers[0];
            var  matcher = new PharmacophoreMatcher(query);
            bool status  = matcher.Matches(conf1);

            Assert.IsTrue(status);

            var bMatches = matcher.GetMatchingPharmacophoreBonds();

            Assert.AreEqual(2, bMatches.Count); // 2 since we haven't gotten a unique set
            Assert.AreEqual(3, bMatches[0].Count);

            var pbond  = (PharmacophoreBond)BondRef.Deref(bMatches[0][0]);
            var patom1 = (PharmacophoreAtom)AtomRef.Deref(pbond.Begin);
            var patom2 = (PharmacophoreAtom)AtomRef.Deref(pbond.End);

            Assert.AreEqual("D", patom1.Symbol);
            Assert.AreEqual("A", patom2.Symbol);

            var bondMap = matcher.GetTargetQueryBondMappings();

            Assert.AreEqual(2, bondMap.Count);
            var mapping = bondMap[0];

            // get the 'BondRef' for lookup
            var value = mapping[bMatches[0][0]];

            Assert.AreEqual(b1, value);
        }
        public void TestMatchingBonds()
        {
            var filename = "NCDK.Data.MDL.cnssmarts.sdf";
            var ins      = ResourceLoader.GetAsStream(filename);
            var reader   = new EnumerableSDFReader(ins, CDK.Builder);

            var query = new PharmacophoreQuery();
            var arom  = new PharmacophoreQueryAtom("A", "c1ccccc1");
            var n1    = new PharmacophoreQueryAtom("BasicAmine", "[NX3;h2,h1,H1,H2;!$(NC=O)]");
            var b1    = new PharmacophoreQueryBond(arom, n1, 5.0, 7.0);

            query.Atoms.Add(arom);
            query.Atoms.Add(n1);
            query.Bonds.Add(b1);

            var mol = reader.First();

            reader.Close();

            var  matcher = new PharmacophoreMatcher(query);
            bool status  = matcher.Matches(mol);

            Assert.IsTrue(status);

            var pmatches = matcher.GetMatchingPharmacophoreAtoms();

            Assert.AreEqual(1, pmatches.Count);

            var upmatches = matcher.GetUniqueMatchingPharmacophoreAtoms();

            Assert.AreEqual(1, upmatches.Count);

            var bmatches = matcher.GetMatchingPharmacophoreBonds();

            Assert.AreEqual(1, bmatches.Count);
            var bmatch = bmatches[0];

            Assert.AreEqual(1, bmatch.Count);
            var pbond = (PharmacophoreBond)BondRef.Deref(bmatch[0]);

            Assert.AreEqual(5.63, pbond.BondLength, 0.01);
        }