public static double getTotalMassNumber ( IMolecularFormula formula ) { double mass = 0.0 ; for ( IIsotope isotope : formula . isotopes ( ) ) { try { IIsotope isotope2 = Isotopes . getInstance ( ) . getMajorIsotope ( isotope . getSymbol ( ) ) ; if ( isotope2 != null ) { mass += isotope2 . getMassNumber ( ) * formula . getIsotopeCount ( isotope ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } } return mass ; }
Get the summed mass number of all isotopes from an MolecularFormula . It assumes isotope masses to be preset and returns 0 . 0 if not .