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); }
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); }