/// <summary>
        /// Extract from a set of MolecularFormula the minimal occurrence of each element found and
        /// put the element and occurrence in a new IMolecularFormula.
        /// </summary>
        /// <param name="mfSet">The set of molecularFormules to inspect</param>
        /// <returns>A IMolecularFormula containing the minimal occurrence of the elements</returns>
        /// <seealso cref="GetMaxOccurrenceElements(IMolecularFormulaSet)"/>
        public static IMolecularFormula GetMinOccurrenceElements(IMolecularFormulaSet mfSet)
        {
            var molecularFormula = mfSet.Builder.NewMolecularFormula();

            foreach (var mf in mfSet)
            {
                foreach (var isotope in mf.Isotopes)
                {
                    var element   = isotope.Element;
                    int occur_new = MolecularFormulaManipulator.GetElementCount(mf, element);
                    if (!MolecularFormulaManipulator.ContainsElement(molecularFormula, element))
                    {
                        molecularFormula.Add(mfSet.Builder.NewIsotope(element), occur_new);
                    }
                    else
                    {
                        int occur_old = MolecularFormulaManipulator.GetElementCount(molecularFormula, element);
                        if (occur_new < occur_old)
                        {
                            MolecularFormulaManipulator.RemoveElement(molecularFormula, element);
                            molecularFormula.Add(mfSet.Builder.NewIsotope(element), occur_new);
                        }
                    }
                }
            }
            return(molecularFormula);
        }