public virtual void TestGetBondOrderSum() { IChemObject obj = NewChemObject(); IRing r = obj.Builder.NewRing(5, "C"); Assert.AreEqual(5, r.GetBondOrderSum()); BondManipulator.IncreaseBondOrder(r.Bonds[0]); Assert.AreEqual(6, r.GetBondOrderSum()); BondManipulator.IncreaseBondOrder(r.Bonds[0]); Assert.AreEqual(7, r.GetBondOrderSum()); BondManipulator.IncreaseBondOrder(r.Bonds[4]); Assert.AreEqual(8, r.GetBondOrderSum()); }
/// <summary> /// We define the heaviest ring as the one with the highest number of double bonds. /// Needed for example for the placement of in-ring double bonds. /// </summary> /// <param name="ringSet">The collection of rings</param> /// <param name="bond">A bond which must be contained by the heaviest ring</param> /// <returns>The ring with the highest number of double bonds connected to a given bond</returns> public static IRing GetHeaviestRing(IRingSet ringSet, IBond bond) { var rings = ringSet.GetRings(bond); IRing ring = null; int maxOrderSum = 0; foreach (var ring1 in rings) { if (maxOrderSum < ((IRing)ring1).GetBondOrderSum()) { ring = (IRing)ring1; maxOrderSum = ring.GetBondOrderSum(); } } return(ring); }