コード例 #1
0
        /// <summary>
        /// Get the total number of atoms inside an IChemModel.
        /// </summary>
        /// <param name="chemModel">The IChemModel object.</param>
        /// <returns>The number of Atom object inside.</returns>
        public static int GetAtomCount(IChemModel chemModel)
        {
            int      count   = 0;
            ICrystal crystal = chemModel.Crystal;

            if (crystal != null)
            {
                count += crystal.Atoms.Count;
            }
            IChemObjectSet <IAtomContainer> moleculeSet = chemModel.MoleculeSet;

            if (moleculeSet != null)
            {
                count += MoleculeSetManipulator.GetAtomCount(moleculeSet);
            }
            IReactionSet reactionSet = chemModel.ReactionSet;

            if (reactionSet != null)
            {
                count += ReactionSetManipulator.GetAtomCount(reactionSet);
            }
            return(count);
        }
コード例 #2
0
        /// <summary>
        /// Get the total number of atoms inside an IChemModel.
        /// </summary>
        /// <param name="chemModel">The IChemModel object.</param>
        /// <returns>The number of Atom object inside.</returns>
        public static int GetAtomCount(IChemModel chemModel)
        {
            int count   = 0;
            var crystal = chemModel.Crystal;

            if (crystal != null)
            {
                count += crystal.Atoms.Count;
            }
            var moleculeSet = chemModel.MoleculeSet;

            if (moleculeSet != null)
            {
                count += MoleculeSetManipulator.GetAtomCount(moleculeSet);
            }
            var reactionSet = chemModel.ReactionSet;

            if (reactionSet != null)
            {
                count += ReactionSetManipulator.GetAtomCount(reactionSet);
            }
            return(count);
        }
コード例 #3
0
 public void TestGetAtomCount_IReactionSet()
 {
     Assert.AreEqual(19, ReactionSetManipulator.GetAtomCount(set));
 }