/** * Get the summed natural abundance of all isotopes from an MolecularFormula. Assumes abundances * to be preset, and will return 0.0 if not. * * @param formula The IMolecularFormula to calculate * @return The summed natural abundance of all isotopes in this MolecularFormula */ public static double getTotalNaturalAbundance(IMolecularFormula formula) { double abundance = 1.0; for (IIsotope isotope : formula.isotopes()) { if (isotope.getNaturalAbundance() == null) return 0.0; abundance = abundance * Math.pow(isotope.getNaturalAbundance(), formula.getIsotopeCount(isotope)); } return abundance / Math.pow(100, getAtomCount(formula)); }