Example #1
0
        public void TestReplaceIsotopes()
        {
            ChemicalFormula formulaA = new ChemicalFormula("CC{13}2H3NO");

            formulaA.Replace(PeriodicTable.GetElement("C")[13], PeriodicTable.GetElement("C")[12]);
            Assert.AreEqual("CC{12}2H3NO", formulaA.Formula);
        }
Example #2
0
        public ChemicalFormulaModification ToHeavyModification(bool c, bool n)
        {
            var formula = new ChemicalFormula();
            if (c)
            {
                Element carbon = Element.PeriodicTable["C"];
                formula.Replace(carbon[12], carbon[13]);
            }

            if (n)
            {
                Element nitrogen = Element.PeriodicTable["N"];
                formula.Replace(nitrogen[14], nitrogen[15]);
            }

            return new ChemicalFormulaModification(formula, "#", Site);
        }