Subsections

 
4.3 OEColorForceField

The color force field can be used to measure chemical complimentarity, and to refine shape based superpositions based on chemical similarity. The CFF is composed of SMARTS rules that determine chemical centers plus rules to determine how such centers interact. In addition to the built-in color force fields, there are several methods for user-defined force fields.

4.3.1 User-defined interactions

As a step toward writing a complete color force field, it is possible to combine built-in rules for color atom assignment with user defined interactions. A new OEColorForceField object can be created using one of the built-in types, then the interactions can be cleared using ClearInteractions() (section and subsequent user interactions added (section ).

For example, to use the ImplicitMillsDean atom typing rules, but to only consider donor-donor and acceptor-acceptor interactions, one can use the following:

 1 /*******************************************************************************
 2  * Copyright 2005,2006,2007,2008 OpenEye Scientific Software, Inc.
 3  ******************************************************************************/
 4 package openeye.examples.oeshape;
 5
 6 import openeye.oechem.*;
 7 import openeye.oeshape.*;
 8
 9 public class UserColor {
10   public static void main(String[] args) {
11     if (args.length!=3) {
12       System.out.println("UserColor <reffile> <rocs_hits> <output.sdf>");
13       System.exit(0);
14     }
15
16     oemolistream reffs = new oemolistream(args[0]);
17     oemolistream fitfs = new oemolistream(args[1]);
18     oemolostream outfs = new oemolostream(args[2]);
19
20     OEGraphMol refmol = new OEGraphMol();
21     oechem.OEReadMolecule(reffs, refmol);
22
23     OEColorForceField cff = new OEColorForceField();
24     cff.Init(OEColorFFType.ImplicitMillsDean);
25     cff.ClearInteractions();
26     int donorType = cff.GetType("donor");
27     int accepType = cff.GetType("acceptor");
28     cff.AddInteraction(donorType, donorType, "gaussian", -1.0f, 1.0f);
29     cff.AddInteraction(accepType, accepType, "gaussian", -1.0f, 1.0f);
30
31     OEColorOverlap ov = new OEColorOverlap();
32     ov.SetColorForceField(cff);
33     ov.SetRefMol(refmol);
34
35     System.out.print("Ref. Title: "+refmol.GetTitle()+" ");
36     System.out.println("Self color: "+ov.GetSelfColor());
37
38     OEColorResults res = new OEColorResults();
39     OEGraphMol fitmol = new OEGraphMol();
40     while (oechem.OEReadMolecule(fitfs, fitmol)) {
41       ov.ColorScore(fitmol, res);
42       oechem.OESetSDData(fitmol, "MyColorScore",
43           String.valueOf(res.getColorscore()));
44       oechem.OESetSDData(fitmol, "MyScaledColor",
45           String.valueOf(res.getScaledcolor()));
46       oechem.OEWriteMolecule(outfs, fitmol);
47
48       System.out.print("Fit. Title: "+fitmol.GetTitle()+" ");
49       System.out.print("Color Score: "+res.getColorscore()+" ");
50       System.out.println("Scaled color: "+res.getScaledcolor());
51     }
52   }
53 }
54
55

Listing:4.2 Using ImplicitMillsDean with user interactions.

4.3.2 Writing color force field files (CFF)

As an alternative to the built-in force fields, the user can define a new color force field using the format described in this section.

The following is a simplified example of a color force field specification.

DEFINE hetero [#7,#8,#15,#16]
DEFINE notNearHetero [!#1;!$($hetero);!$(*[$hetero])]
#
#
TYPE donor
TYPE acceptor
TYPE rings
TYPE positive
TYPE negative
TYPE structural
#
#
PATTERN donor [$hetero;H]
PATTERN acceptor [#8&!$(*~N~[OD1]),#7&H0;!$([D4]);!$([D3]-*=,:[$hetero])]
PATTERN rings [R]~1~[R]~[R]~[R]1
PATTERN rings [R]~1~[R]~[R]~[R]~[R]1
PATTERN rings [R]~1~[R]~[R]~[R]~[R]~[R]1
PATTERN rings [R]~1~[R]~[R]~[R]~[R]~[R]~[R]1
PATTERN positive [+,$([N;!$(*-*=O)])]
PATTERN negative [-]
PATTERN negative [OD1+0]-[!#7D3]~[OD1+0]
PATTERN negative [OD1+0]-[!#7D4](~[OD1+0])~[OD1+0]
PATTERN structural [$notNearHetero]
#
#
INTERACTION donor donor attractive gaussian weight=1.0 radius=1.0
INTERACTION acceptor acceptor attractive gaussian weight=1.0 radius=1.0
INTERACTION rings rings attractive gaussian weight=1.0 radius=1.0
INTERACTION positive positive attractive gaussian weight=1.0 radius=1.0
INTERACTION negative negative attractive gaussian weight=1.0 radius=1.0
INTERACTION structural structural attractive gaussian weight=1.0 radius=1.0

There are four basic keywords in a cff file: DEFINE, TYPE, PATTERN, and INTERACTION. The TYPE field can be any user-defined term. TYPES can be any user-specified string such as "donor", "acceptor", "lipophilic anion" etc. The PATTERN keyword is used to associate SMARTS patterns with these types. There is no restriction on the number of patterns that can be associated with a user defined type. The position in Cartesian space of the PATTERN is taken as the average of the coordinates of the atoms that match the SMARTS pattern. If the desired location of the PATTERN is on a single atom of a larger SMARTS pattern recursive SMARTS (written as '[$(SMARTS)]' can be used to this effect. Only the first atom in a recursive SMARTS pattern 'matches' the molecule, and the rest of the SMARTS pattern defines an environment. By writing a SMARTS pattern in recursive notation the location of the PATTERN will be taken as the atomic position of the first matching atom in the pattern. In order to simplify both reading and writing SMARTS, intermediate SMARTS can be associated with words using the DEFINE keyword. Once defined, these words can then be used as atom primitives in subsequent SMARTS patterns with the $ prefix (see "DEFINE hetero" and "PATTERN donor" above).

Interactions between types are associated with the INTERACTION keyword. Two user-defined TYPES must be listed, and whether their interaction is attractive or repulsive. By default the interaction decays as a Gaussian of weight 1.0Åand radius (decay to 1/e) 1.0Å. The weight and radius can be modified by keywords WEIGHT and RADIUS. At present, the only alternative to a Gaussian decay is invoked by the DISCRETE keyword. A discrete interaction contributes all of WEIGHT if the inter-type distance is less than RADIUS, or zero. Since it is not differentiable it makes no contribution to optimization (i.e. because the gradient of a DISCRETE function is 0 or infinite).