/// <summary> /// Get the total number of bonds inside an IChemModel. /// </summary> /// <param name="chemModel">The IChemModel object.</param> /// <returns>The number of Bond object inside.</returns> public static int GetBondCount(IChemModel chemModel) { int count = 0; ICrystal crystal = chemModel.Crystal; if (crystal != null) { count += crystal.Bonds.Count; } IChemObjectSet <IAtomContainer> moleculeSet = chemModel.MoleculeSet; if (moleculeSet != null) { count += MoleculeSetManipulator.GetBondCount(moleculeSet); } IReactionSet reactionSet = chemModel.ReactionSet; if (reactionSet != null) { count += ReactionSetManipulator.GetBondCount(reactionSet); } return(count); }
/// <summary> /// Get the total number of bonds inside an IChemModel. /// </summary> /// <param name="chemModel">The IChemModel object.</param> /// <returns>The number of Bond object inside.</returns> public static int GetBondCount(IChemModel chemModel) { int count = 0; var crystal = chemModel.Crystal; if (crystal != null) { count += crystal.Bonds.Count; } var moleculeSet = chemModel.MoleculeSet; if (moleculeSet != null) { count += MoleculeSetManipulator.GetBondCount(moleculeSet); } var reactionSet = chemModel.ReactionSet; if (reactionSet != null) { count += ReactionSetManipulator.GetBondCount(reactionSet); } return(count); }
public void TestGetBondCount_IReactionSet() { Assert.AreEqual(18, ReactionSetManipulator.GetBondCount(set)); }