Exemplo n.º 1
0
        public void TestBenzeneWithDoubleBonds()
        {
            IAtomContainer benzene = builder.NewAtomContainer();

            AbstractSignatureTest.AddCarbons(benzene, 6);
            for (int i = 0; i < 6; i++)
            {
                AbstractSignatureTest.AddHydrogens(benzene, i, 1);
            }
            benzene.AddBond(benzene.Atoms[0], benzene.Atoms[1], BondOrder.Single);
            benzene.AddBond(benzene.Atoms[1], benzene.Atoms[2], BondOrder.Double);
            benzene.AddBond(benzene.Atoms[2], benzene.Atoms[3], BondOrder.Single);
            benzene.AddBond(benzene.Atoms[3], benzene.Atoms[4], BondOrder.Double);
            benzene.AddBond(benzene.Atoms[4], benzene.Atoms[5], BondOrder.Single);
            benzene.AddBond(benzene.Atoms[5], benzene.Atoms[0], BondOrder.Double);

            MoleculeSignature signature       = new MoleculeSignature(benzene);
            string            carbonSignature = signature.SignatureStringForVertex(0);

            for (int i = 1; i < 6; i++)
            {
                string carbonSignatureI = signature.SignatureStringForVertex(i);
                Assert.AreEqual(carbonSignature, carbonSignatureI);
            }
        }
Exemplo n.º 2
0
        public void MethyleneCyclopropeneTest()
        {
            IAtomContainer mol = builder.NewAtomContainer();

            AbstractSignatureTest.AddCarbons(mol, 4);
            AbstractSignatureTest.AddHydrogens(mol, 1, 2);
            AbstractSignatureTest.AddHydrogens(mol, 2, 1);
            AbstractSignatureTest.AddHydrogens(mol, 3, 1);
            mol.AddBond(mol.Atoms[0], mol.Atoms[1], BondOrder.Double);
            mol.AddBond(mol.Atoms[0], mol.Atoms[2], BondOrder.Single);
            mol.AddBond(mol.Atoms[0], mol.Atoms[3], BondOrder.Single);
            mol.AddBond(mol.Atoms[2], mol.Atoms[3], BondOrder.Double);
            MoleculeSignature molSig = new MoleculeSignature(mol);

            string sigFor2Height1 = molSig.SignatureStringForVertex(2, 1);
            string sigFor3Height1 = molSig.SignatureStringForVertex(3, 1);

            Assert.IsTrue(
                sigFor2Height1.Equals(sigFor3Height1),
                "Height 1 signatures for atoms 2 and 3" + " should be the same");

            string sigFor2Height2 = molSig.SignatureStringForVertex(2, 1);
            string sigFor3Height2 = molSig.SignatureStringForVertex(3, 1);

            Assert.IsTrue(
                sigFor2Height2.Equals(sigFor3Height2),
                "Height 2 signatures for atoms 2 and 3" + " should be the same");
        }
Exemplo n.º 3
0
        public static IAtomContainer MakeC7H16C()
        {
            IAtomContainer mol = builder.NewAtomContainer();

            AbstractSignatureTest.AddCarbons(mol, 7);
            mol.AddBond(mol.Atoms[0], mol.Atoms[2], BondOrder.Single);
            mol.AddBond(mol.Atoms[1], mol.Atoms[2], BondOrder.Single);
            mol.AddBond(mol.Atoms[2], mol.Atoms[3], BondOrder.Single);
            mol.AddBond(mol.Atoms[3], mol.Atoms[4], BondOrder.Single);
            mol.AddBond(mol.Atoms[4], mol.Atoms[5], BondOrder.Single);
            mol.AddBond(mol.Atoms[5], mol.Atoms[6], BondOrder.Single);
            AbstractSignatureTest.AddHydrogens(mol, 0, 3);
            AbstractSignatureTest.AddHydrogens(mol, 1, 3);
            AbstractSignatureTest.AddHydrogens(mol, 2, 1);
            AbstractSignatureTest.AddHydrogens(mol, 3, 2);
            AbstractSignatureTest.AddHydrogens(mol, 4, 2);
            AbstractSignatureTest.AddHydrogens(mol, 5, 2);
            AbstractSignatureTest.AddHydrogens(mol, 6, 3);
            return(mol);
        }