private static double scaledAtomicMasses(IElement element) throws java.io.IOException, ClassNotFoundException { IsotopeFactory isofac = Isotopes.getInstance(); double realmasses = isofac.getNaturalMass(element); return (realmasses / CARBON_MASS); }
private static double scaledAtomicMasses(IElement element) throws java.io.IOException, ClassNotFoundException { IsotopeFactory isofac = Isotopes.getInstance(); double realmasses = isofac.getNaturalMass(element); return (realmasses / CARBON_MASS); }
/** * Get the summed natural mass of all elements from an MolecularFormula. * * @param formula The IMolecularFormula to calculate * @return The summed exact mass of all atoms in this MolecularFormula */ public static double getNaturalExactMass(IMolecularFormula formula) { double mass = 0.0; IsotopeFactory factory; try { factory = Isotopes.getInstance(); } catch (IOException e) { throw new RuntimeException("Could not instantiate the IsotopeFactory."); } for (IIsotope isotope : formula.isotopes()) { IElement isotopesElement = formula.getBuilder().newInstance(IElement.class, isotope); mass += factory.getNaturalMass(isotopesElement) * formula.getIsotopeCount(isotope); } return mass; }
mass = factory.getNaturalMass(currentAtom);
mass = factory.getNaturalMass(currentAtom);