Class MolecularFormulas

java.lang.Object
com.chemaxon.calculations.elemanal.factory.MolecularFormulas

@PublicAPI public class MolecularFormulas extends Object
Static utility methods related to molecular formula calculations.
  • Method Details

    • fromFormula

      public static com.chemaxon.calculations.elemanal.formula.MolecularFormula fromFormula(String formula)
    • fromMolecule

      public static com.chemaxon.calculations.elemanal.formula.MolecularFormula fromMolecule(Molecule molecule, Set<Integer> filteredAtoms, boolean ignorePseudoLabels)
    • fromMolecule

      public static com.chemaxon.calculations.elemanal.formula.MolecularFormula fromMolecule(Molecule molecule, boolean ignorePseudoLabels)
    • fromMolecule

      public static com.chemaxon.calculations.elemanal.formula.MolecularFormula fromMolecule(Molecule molecule)
    • createAnalysis

      public static ElementalAnalysis createAnalysis(String formula)
      Constructs an elemental analysis from molecular formula.

      Multiple fragments with fractional stoichiometric coefficients are supported: CH3O.0.5Na.1.5H2O, NaCl.1.5H2O, AlCl3.1.5H2O
      If the molecular formula contains any unspecified symbol (e.g. R, Pol) the analysis do not take into consideration these symbols. The analysis returns the same result for formulas either with or without these symbols.

      Parameters:
      formula - molecular formula, e.g. C3H8NO2, Al2(CO3)3.2H2O
      Returns:
      an ElementalAnalysis instance
      Throws:
      com.chemaxon.calculations.elemanal.formula.tree.InvalidFormulaException - if the parser cannot parse the formula string