Class ElementalAnalysis

java.lang.Object
chemaxon.calculations.elemental.ElementalAnalysis

@PublicApi public class ElementalAnalysis extends Object
Calculates molecular formula, mass, MS mass and composition.

API usage example:


     // Build the analysis
     ElementalAnalysis analysis = ElementalAnalysisFactory.createAnalysis(molecule);

     // Use the results
     double exactMass = analysis.exactMass();
     double mass = analysis.mass();
     BigDecimal massPrecision = analysis.massPrecision();
     BigDecimal atomCount1 = analysis.atomCount(8);       // oxygen atom count
     BigDecimal atomCount3 = analysis.atomCount(8, 16);   // oxygen isotope count with massno = 16
     String formula = analysis.formula();
     String composition = analysis.composition(2);        // precision = 2
 
Since:
Marvin 16.4.18
  • Method Details

    • atomCount

      public BigDecimal atomCount()
      Calculates the number of atoms in the molecule.
      Returns:
      number of atoms
    • atomCount

      public BigDecimal atomCount(int z)
      Calculates the number of atoms of a given element in the molecule (including its isotopes).
      Parameters:
      z - atomic number of the atom (protons)
      Returns:
      number of the specified atoms
    • atomCount

      public BigDecimal atomCount(int z, int m)
      Calculates the number of atoms of a given element in the molecule.
      Parameters:
      z - atomic number of the atom (protons)
      m - mass number of the atom (protons + neutrons)
      Returns:
      number of the specified atoms
    • mass

      public BigDecimal mass()
      Calculates the molecular weight of the molecule.

      The result is rounded according to the decimals of the lowest precision atomic mass value.

      Returns:
      molecular weight of the molecule
    • exactMass

      public BigDecimal exactMass()
      Calculates the weight of the MS molecule ion using the mass of the most frequent natural isotope for element atoms.
      Returns:
      weight of the molecule ion
    • nominalMass

      public BigDecimal nominalMass()
      Mass of the molecule calculated using the isotope mass of the most abundant constituent element isotope of each element rounded to the nearest integer value and multiplied by the number of atoms of each element.
      Returns:
      nominal mass of the molecule
    • formula

      public String formula()
      Calculates the molecular formula which is a string listing all atom types and their occurrence in the molecule.

      Note: Isotopes and charged elements are separated.

      Returns:
      formula representation of elements
    • formula

      public String formula(Set<FormulaGenerationRule> rules)
      Calculates the molecular formula which is a string listing all atom types and their occurrence in the molecule.
      Returns:
      formula representation of elements
      See Also:
    • formula

      public String formula(FormulaGenerationRule... rules)
      Calculates the molecular formula which is a string listing all atom types and their occurrence in the molecule.
      Returns:
      formula representation of elements
      See Also:
    • formalCharge

      public BigDecimal formalCharge()
      Calculates the formal (total) charge of the molecule.
      Returns:
      the formal charge of the molecule
    • sumOfRadicals

      public BigDecimal sumOfRadicals()
      Calculates the sum of the radicals of all atoms of the molecule.
      Returns:
      the sum of the radicals of all atoms
    • isotopeDistribution

      public SortedMap<BigDecimal,BigDecimal> isotopeDistribution()
      Calculates the isotopic distributions for the molecule.

      Takes charge into account. The maximum of distribution is normalized to 1.

      Returns:
      the map of masses and distributions.
      Throws:
      ArithmeticException - if the molecule contains non-integer fragment multipliers, e.g. 2Na.1.5H2O
    • composition

      public Map<FormulaAtom,BigDecimal> composition()
      Gets the elemental analysis, the relative percent composition of a pure chemical substance by element (w/w%).
      Returns:
      molecular composition