Class ElementalAnalyserPlugin

  • All Implemented Interfaces:
    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 Detail

      • ElementalAnalyserPlugin

        public ElementalAnalyserPlugin()
    • Method Detail

      • 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
      • 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")
Overrides:
setParameters in class CalculatorPlugin
Parameters:
params - is the parameter table
Throws:
PluginException - on error