cxcalc integration

    This manual gives you a walk-through on how to integrate your own calculations using cxcalc.


    Cxcalc is a command line tool that can perform chemical calculations in batch mode. It can invoke all calculations that are available in MarvinSketch, and since Marvin version 5.6 it can also run external services. As Marvin saves the configuration of the services into an XML file, services that were previously set can be used in cxcalc without any further setup. To execute the external service in cxcalc its name or the alias of the service can be used to execute it.

    To see the help of a service calculation in cxcalc, execute the cxcalc <name> -h command, where name is the name of the calculation. As an example see the command line help for the hellomolecule command.


    Fig. 1 The command line help of the hellomolecule service called from cxcalc

    To execute the hellomolecule calculation run the cxcalc hellomolecule <input file/strings> command. It will run the calculation with the default settings. To run the calculation in batch mode you should simply replace the single molecule parameter with an input file. An example could be:


    Fig. 2 The hellomolecule service called for the etanol molecule

    The parameters of the calculation can be set using the --<parameter_name> <parameter value> command line options. For example to output molecule names you can use the name:t format option:


    Fig. 3 The hellomolecule service called in batch mode

    Accessing parameters

    The following example illustrates the connection between the service and cxcalc parameters. In this case we want to calculate the number of microspecies at a give pH for a molecule.


    Fig. 4 The service cxcalc connection

    The default service and parameter names can be defined using the @Alias annotation:

    @Alias(name="MSCount", params={"mol", "pH"})
    @Description("Counts microspecies of the given molecule at " +
    "given pH.")
    public Integer getMicrospeciesCount(Molecule mol, Double pH)

    The default settings can be overwritten during the set-up. Next we will modify the name and parameter names of the MSCount calculation.


    Fig. 5 Modifying the MSCount calculation

    After the modification the calculation is also accessible as MSC , and the -pH command line parameter can also be referred to as --H, too.


    Fig. 6 Using the new parameters

    If no pH parameters are set, the default is used. (pH 7.4)

    Additional cxcalc parameters

    Calculated properties can also be stored as a molecule property:


    Fig. 7. Storing calculated properties as a molecule property

    The visualized result is:


    Fig. 8. Visualized molecule with the stored properties

    {info} Built-in and external calculations can be called at the same time, too.