Class ElementalAnalyserPlugin

java.lang.Object
chemaxon.marvin.plugin.CalculatorPlugin
chemaxon.marvin.calculations.ElementalAnalyserPlugin
All Implemented Interfaces:
TaggedCalculator, chemaxon.license.Licensable

@PublicApi public class ElementalAnalyserPlugin extends CalculatorPlugin
Calculates molecular formula, mass, MS mass and composition.

API usage example:

    // read input molecule
    MolImporter mi = new MolImporter("test.mol");
    Molecule mol = mi.read();
    mi.close();

    // create plugin
    ElementalAnalyserPlugin plugin = new ElementalAnalyserPlugin();

    // set plugin parameters
    Properties params = new Properties();
    params.put("precision", "3");
    plugin.setParameters(params);

    // set target molecule
    plugin.setMolecule(mol);

    // run the calculation
    plugin.run();

    // get results
    double exactMass = plugin.getExactMass();
    double mass = plugin.getMass();
    int atomCount1 = plugin.getAtomCount(8); // oxygen atom count
    int atomCount2 = plugin.getAtomCount(8, 0); // non-isotope oxygen count
    int atomCount3 = plugin.getAtomCount(8, 16); // oxygen isotope count with massno=16
    String formula = plugin.getFormula();
    String isotopeFormula = plugin.getIsotopeFormula();
    String composition = plugin.getComposition();
    String isotopeComposition = plugin.getIsotopeComposition();
    // do something with the results ...
 

For concurrent plugin example applications using ChemAxon's concurrent framework, refer to the Concurrent plugin examples.

Since:
1.0, 11/03/2002
  • Constructor Details

    • ElementalAnalyserPlugin

      public ElementalAnalyserPlugin()
  • Method Details

    • setMolecule

      public void setMolecule(String formula) throws IllegalArgumentException
      Specifies a molecule to calculate with.
      Parameters:
      formula - the molecular formula to calculate with
      Throws:
      IllegalArgumentException - if the formula is invalid
      Since:
      Marvin 5.3.2
    • getProductName

      public String getProductName()
      Description copied from class: CalculatorPlugin
      Returns the product identifier of the plugin as given by LicenseManager. The name is used by the CalculatorPlugin.isLicensed() method.
      Specified by:
      getProductName in class CalculatorPlugin
      Returns:
      product identifier or a default string
    • setParameters

      public void setParameters(Properties params) throws PluginException
      Sets the input parameters for the plugin. Parameters:
      • single: "true" if single fragment mode (calculation is performed separately for each fragment) (default: "false")
      • type: result types, separated by ',' (for possible values, see the string IDs of the constants in the ElementalAnalyserPlugin.ResultType enum) (default: "mass,exactmass,formula,composition")
      (default: "mass,exactmass,formula,composition")