public double getNaturalMass ( int atomicNum ) { List < IIsotope > isotopes = this . isotopes [ atomicNum ] ; if ( isotopes == null ) return 0 ; double summedAbundances = 0 ; double summedWeightedAbundances = 0 ; double getNaturalMass = 0 ; for ( IIsotope isotope : isotopes ) { summedAbundances += isotope . getNaturalAbundance ( ) ; summedWeightedAbundances += isotope . getNaturalAbundance ( ) * isotope . getExactMass ( ) ; getNaturalMass = summedWeightedAbundances / summedAbundances ; } return getNaturalMass ; }
Gets the natural mass of this element defined as average of masses of isotopes weighted by abundance .