public void ElementContributingOneElectronRejectWhenNoDoubleBond()
 {
     int[] cycle = new int[] { 0, 1, 2, 3, 4, 5, 0 };
     int[] contr = new int[] { 1, 1, 1, 1, 1, 1 };
     int[] dbs   = new int[] { 1, 0, 3, -1, 5, 4 };
     Assert.IsFalse(MmffAromaticTypeMapping.IsAromaticRing(cycle, contr, dbs, new bool[contr.Length]));
 }
 public void IndexOfHetroAt4()
 {
     int[] cycle = new int[] { 3, 2, 1, 4, 5, 3 };
     int[] contr = new int[] { 1, 1, 1, 1, 1, 1 };
     contr[cycle[4]] = 2;
     Assert.AreEqual(4, MmffAromaticTypeMapping.IndexOfHetro(cycle, contr));
 }
 public void ExocyclicDoubleBondsBreakAromaticity()
 {
     int[]  cycle = new int[] { 0, 1, 2, 3, 4, 5, 0 };
     int[]  contr = new int[] { 1, 1, 1, 1, 1, 1, 1, 1 };
     int[]  dbs   = new int[] { 1, 0, 6, 7, 5, 4 };
     bool[] arom  = new bool[contr.Length];
     Assert.IsFalse(MmffAromaticTypeMapping.IsAromaticRing(cycle, contr, dbs, arom));
 }
 public void PyrroleIsAromatic()
 {
     int[]  cycle = new int[] { 0, 1, 2, 3, 4, 0 };
     int[]  contr = new int[] { 2, 1, 1, 1, 1 };
     int[]  dbs   = new int[] { -1, 2, 1, 4, 3 };
     bool[] arom  = new bool[contr.Length];
     Assert.IsTrue(MmffAromaticTypeMapping.IsAromaticRing(cycle, contr, dbs, arom));
 }
 public void BenzeneIsAromatic()
 {
     int[]  cycle = new int[] { 0, 1, 2, 3, 4, 5, 0 };
     int[]  contr = new int[] { 1, 1, 1, 1, 1, 1 };
     int[]  dbs   = new int[] { 1, 0, 3, 2, 5, 4 };
     bool[] arom  = new bool[contr.Length];
     Assert.IsTrue(MmffAromaticTypeMapping.IsAromaticRing(cycle, contr, dbs, arom));
 }
 public void NormaliseHetroAt2()
 {
     int[] cycle = new int[] { 3, 2, 1, 4, 5, 3 };
     int[] contr = new int[] { 1, 1, 1, 1, 1, 1 };
     contr[cycle[2]] = 2;
     Assert.IsTrue(MmffAromaticTypeMapping.NormaliseCycle(cycle, contr));
     Assert.IsTrue(Compares.AreDeepEqual(new int[] { 1, 4, 5, 3, 2, 1 }, cycle));
 }
        public void AnionCarbonTypesAreNeitherAlphaOrBeta()
        {
            var map = new Dictionary <string, string>()
            {
                { "CB", "C5A" }
            };

            Assert.AreEqual("C5", MmffAromaticTypeMapping.GetAromaticType(map, 'A', "CB", false, true));
        }
 public void UpdateN2OXtoNPOX()
 {
     int[]    cycle = new int[] { 2, 4, 3, 1, 0, 5, 2 };
     string[] symbs = new string[10];
     Arrays.Fill(symbs, "");
     symbs[cycle[1]] = "N2OX";
     MmffAromaticTypeMapping.UpdateAromaticTypesInSixMemberRing(cycle, symbs);
     Assert.AreEqual("NPOX", symbs[cycle[1]]);
 }
 public void DelocaiIsedExocyclicDoubleBondsMaintainAromaticity()
 {
     int[]  cycle = new int[] { 0, 1, 2, 3, 4, 5, 0 };
     int[]  contr = new int[] { 1, 1, 1, 1, 1, 1, 1, 1 };
     int[]  dbs   = new int[] { 1, 0, 6, 7, 5, 4 };
     bool[] arom  = new bool[contr.Length];
     arom[2] = arom[3] = arom[6] = arom[7] = true; // adjacent ring is aromatic
     Assert.IsTrue(MmffAromaticTypeMapping.IsAromaticRing(cycle, contr, dbs, arom));
 }
        public void AnionNitrogensAreAlwaysN5M()
        {
            var map = new Dictionary <string, string>()
            {
                { "N=C", "N5A" }
            };

            Assert.AreEqual("N5M", MmffAromaticTypeMapping.GetAromaticType(map, 'A', "N=C", false, true));
        }
        public void UseMappingWhenNeitherFlagIsRaised()
        {
            var map = new Dictionary <string, string>()
            {
                { "N=C", "N5A" }
            };

            Assert.AreEqual("N5A", MmffAromaticTypeMapping.GetAromaticType(map, 'A', "N=C", false, false));
        }
        public void ImidazoleNitrogenTypesAreNeitherAlphaOrBeta()
        {
            var map = new Dictionary <string, string>()
            {
                { "N=C", "N5A" }
            };

            Assert.AreEqual("N5", MmffAromaticTypeMapping.GetAromaticType(map, 'A', "N=C", true, false));
        }
 public void UpdateCStarToCB()
 {
     int[]    cycle = new int[] { 2, 4, 3, 1, 0, 5, 2 };
     string[] symbs = new string[10];
     Arrays.Fill(symbs, "");
     symbs[cycle[1]] = "C=C";
     symbs[cycle[2]] = "C=N";
     MmffAromaticTypeMapping.UpdateAromaticTypesInSixMemberRing(cycle, symbs);
     Assert.AreEqual("CB", symbs[cycle[1]]);
     Assert.AreEqual("CB", symbs[cycle[2]]);
 }
 public void UpdateToNPDPlus()
 {
     int[]    cycle = new int[] { 2, 4, 3, 1, 0, 5, 2 };
     string[] symbs = new string[10];
     Arrays.Fill(symbs, "");
     symbs[cycle[1]] = "NCN+";
     symbs[cycle[2]] = "N+=C";
     symbs[cycle[3]] = "N=+C";
     MmffAromaticTypeMapping.UpdateAromaticTypesInSixMemberRing(cycle, symbs);
     Assert.AreEqual("NPD+", symbs[cycle[1]]);
     Assert.AreEqual("NPD+", symbs[cycle[2]]);
     Assert.AreEqual("NPD+", symbs[cycle[3]]);
 }
        public void IntractableNumberOfCycles()
        {
            // to ensure intractable cycles are handled we create a complete graph
            // where every vertex is attached to every other vertex. K8 is sufficient
            // to trigger an abort when finding cycles
            IAtomContainer container = new Mock <IAtomContainer>().Object;

            int[][] graphK8 = Arrays.CreateJagged <int>(8, 7);

            for (int i = 0; i < graphK8.Length; i++)
            {
                int n = 0;
                for (int j = 0; j < graphK8.Length; j++)
                {
                    if (i == j)
                    {
                        continue;
                    }
                    graphK8[i][n++] = j;
                }
            }

            Assert.AreEqual(0, MmffAromaticTypeMapping.CyclesOfSizeFiveOrSix(container, graphK8).Length);
        }
 public void NormaliseNoHetro()
 {
     int[] cycle = new int[] { 3, 2, 1, 4, 5, 3 };
     int[] contr = new int[] { 1, 1, 1, 1, 1, 1 };
     Assert.IsFalse(MmffAromaticTypeMapping.NormaliseCycle(cycle, contr));
 }
 public void IndexOfNoHetroAtom()
 {
     int[] cycle = new int[] { 3, 2, 1, 4, 5, 3 };
     int[] contr = new int[] { 1, 1, 1, 1, 1, 1 };
     Assert.AreEqual(-1, MmffAromaticTypeMapping.IndexOfHetro(cycle, contr));
 }
 public void TrivalentBicoordinateNitrogenContributesOneElectron()
 {
     Assert.AreEqual(1, MmffAromaticTypeMapping.Contribution(7, 2, 3));
 }
 public void ContributionOfFiveValentNitrogen()
 {
     Assert.AreEqual(-1, MmffAromaticTypeMapping.Contribution(7, 3, 5));
 }
 public void ContributionOfThreeValentCarbon()
 {
     Assert.AreEqual(-1, MmffAromaticTypeMapping.Contribution(6, 3, 3));
 }
 public void BivalentBicoordinateNitrogenContributesTwoElectrons()
 {
     Assert.AreEqual(2, MmffAromaticTypeMapping.Contribution(7, 2, 2));
 }
 public void DivalentSulphurContributesTwoElectrons()
 {
     Assert.AreEqual(2, MmffAromaticTypeMapping.Contribution(16, 2, 2));
 }
 public void DivalentOxygenContributesTwoElectrons()
 {
     Assert.AreEqual(2, MmffAromaticTypeMapping.Contribution(8, 2, 2));
 }
 public void TetravalentCarbonContributesOneElectron()
 {
     Assert.AreEqual(1, MmffAromaticTypeMapping.Contribution(6, 3, 4));
 }