Initial Scripts

You can define molecule sets and other constants in the user-defined initial script $HOME/chemaxon/MARVIN_MAJOR_VERSION/jep.script(Windows) or $HOME/.chemaxon/MARVIN_MAJOR_VERSION/jep.script (UNIX / Linux), where $HOME is your user home directory, and MARVIN_MAJOR_VERSION is the major version of Marvin (e.g. "5.1").

This script is run right after the molecule sets are read and the constants defined here can be used later in your chemical expressions. Any valid chemical terms assignment is allowed here, and the terminating ';' characters may be omitted as long as you write each assignment in a separate line. Typically, you will define a molecule set by

  1. listing its members:

    x = {acid_halide, alcohol, "[#6]CC[#8]"}
    y = {alkene, amide, imide, imine}
    z = {alkene, amide, amine, alcohol, isocyanate}
  2. or deriving it from other sets with the help of set operators:

    all = x + y + z (union of x, y, z)
    join = y * z (join of y and z)
    C = (x + y) * z (join of the union of x and y with z)
    D = z - alcohol (all elements of z except alcohol)
    E = (x + y) - z (union of x and y without the elements of z)
     

    where "+" means set-union, "*" means set-join and "-" means exclusion.

Predefined molecules and molecule sets are most useful in query definitions of the match function:

  • match(amide) will test whether the input molecule matches an amide group, match(reactant(0), {amide,amine}) will test whether the first reactant in a reaction context matches an amide or an amine

  • match(2, {metalloid,alcohol}, 1) will check whether atom 2 of the input molecule matches either a metalloid or an alcohol carbon - the last parameter1 denotes the query atom map which picks the carbon from the alcohol definition; match(ratom(2), {metalloid,alcohol}, 1) is the same in a reaction context with checking target reactant atom which corresponds to the reactant atom with map 2 in the reaction equation.