/// <summary>
        /// This badly named methods tries to determine which AtomContainer in the
        /// ChemModel is best suited to contain added Atom's and Bond's.
        /// </summary>
        public static IAtomContainer GetRelevantAtomContainer(IChemModel chemModel, IAtom atom)
        {
            IAtomContainer result = null;

            if (chemModel.MoleculeSet != null)
            {
                var moleculeSet = chemModel.MoleculeSet;
                result = MoleculeSetManipulator.GetRelevantAtomContainer(moleculeSet, atom);
                if (result != null)
                {
                    return(result);
                }
            }
            if (chemModel.ReactionSet != null)
            {
                var reactionSet = chemModel.ReactionSet;
                return(ReactionSetManipulator.GetRelevantAtomContainer(reactionSet, atom));
            }
            if (chemModel.Crystal != null && chemModel.Crystal.Contains(atom))
            {
                return(chemModel.Crystal);
            }
            if (chemModel.RingSet != null)
            {
                return(AtomContainerSetManipulator.GetRelevantAtomContainer(chemModel.RingSet, atom));
            }
            throw new ArgumentException("The provided atom is not part of this IChemModel.");
        }
        public void TestGetRelevantAtomContainer_IAtomContainerSet_IAtom()
        {
            var ac1 = AtomContainerSetManipulator.GetRelevantAtomContainer(som, atomInMol1);

            Assert.AreEqual(mol1, ac1);
            var ac2 = AtomContainerSetManipulator.GetRelevantAtomContainer(som, atomInMol2);

            Assert.AreEqual(mol2, ac2);
        }
 public static IAtomContainer GetRelevantAtomContainer(IChemObjectSet <IAtomContainer> moleculeSet, IBond bond)
 {
     return(AtomContainerSetManipulator.GetRelevantAtomContainer(moleculeSet, bond));
 }
        public void TestGetRelevantAtomContainer_IAtomContainerSet_IBond()
        {
            var ac1 = AtomContainerSetManipulator.GetRelevantAtomContainer(som, bondInMol1);

            Assert.AreEqual(mol1, ac1);
        }