Evaluator

The Evaluator class provides an interface to the Chemical Terms library. It requires the creation of a ChemJEP object. ChemJEP is the actual expression parser/compiler and evaluator for the chemical terms in in the Evaluator call. The API for Evaluator presents many fine examples but we will present a simple case as example. This command will calculate the first acidic pKa for a molecule.

For how to get the Molecule from the selected row see the Reading a molecule scriptlet.

        import chemaxon.jep.Evaluator
        import chemaxon.jep.ChemJEP
        import chemaxon.jep.context.MolContext
        import chemaxon.struc.Molecule
        import chemaxon.formats.MolImporter

        // create the molecule. We use benzoic acid
        Molecule mol = MolImporter.importMol('c1ccccc1C(=O)O')

        // evaluator stuff
        Evaluator evaluator = new Evaluator()
        ChemJEP chemJEP = evaluator.compile("pKa('acidic','1')", MolContext.class)
        MolContext context = new MolContext()
        context.setMolecule(mol)
        def result = chemJEP.evaluate(context)
        println "result=$result"
        


Copyright © 1999-2012 ChemAxon Ltd.    All rights reserved.