3.6 Focussing

Focussing is a way to achieve the desired precision around a target (such as a ligand) while maintaining reasonable time and memory limits for the calculation. The target for focussing is set using the SetFocusTarget() function.

For a typical ZAP electrostatics calculation, a consistent grid spacing is used for the entire system, where the default value is 0.5 Angstroms but it may be set to a custom value using SetGridSpacing(). This method is entirely appropriate for certain calculations, such as solvation energy calculations for small molecules. For other types of calculations, such as a binding energy calculation for a protein and ligand, a consistent grid spacing may cause the calculation to be either prohibitively expensive or insufficiently precise around the binding area.

Focussing alleviates this problem by using a fine grid for the target volume, and coarser grids away from the target. The grid spacing setting for ZAP is applied to the target volume, and the grid spacing is doubled for each addition coarse grid surrounding the target. A quadradic interpolation is used for the grid intersections. The implementation of the bind uses the SetFocusTarget() method to set the ligand as the target for focussing.

The following example program computes the binding energy of a protein and ligand twice, once without focussing and once with the ligand as the focussing target. The values of the binding energy and the time it took to calculate them are displayed. For a focussed atom potential calculation, the full electrostatics for the protein and complex would each be computed with multiple electrostatics calculations. The first calculation would create the potential grid for the target volume with a grid spacing of 0.5 (assuming the default spacing is being used). An additional calculation with a grid spacing of 1.0 would be done on a larger volume volume, and then additional calculations with grid spacings of 2.0, 4.0, and so on would be done until the grid is large enough to contain the entire volume of the system.

 1 /*******************************************************************************
 2  * Copyright (C) 2006, 2008 OpenEye Scientific Software, Inc.
 3  ******************************************************************************/
 4 package openeye.examples.oezap;
 5
 6 import openeye.oechem.*;
 7 import openeye.oezap.*;
 8
 9 public class ZapFocussing {
10   public static void CalcBindingEnergy(OEZap zap, OEGraphMol protein,
11       OEGraphMol ligand, OEGraphMol cmplx) {
12     OEStopwatch stopwatch = new OEStopwatch();
13     stopwatch.Start();
14
15     OEFloatArray ppot = new OEFloatArray(protein.GetMaxAtomIdx());
16     zap.SetMolecule(protein);
17     zap.CalcAtomPotentials(ppot.ptrCast());
18     double proteinEnergy = 0.0;
19     OEAtomBaseIter aiter = protein.GetAtoms();
20     while (aiter.hasNext()) {
21       OEAtomBase atom = aiter.next();
22       proteinEnergy += ppot.getItem(atom.GetIdx()) * atom.GetPartialCharge();
23     }
24     proteinEnergy *= 0.5;
25
26     OEFloatArray lpot = new OEFloatArray(ligand.GetMaxAtomIdx());
27     zap.SetMolecule(ligand);
28     zap.CalcAtomPotentials(lpot.ptrCast());
29     double ligandEnergy = 0.0;
30     aiter = ligand.GetAtoms();
31     while (aiter.hasNext()) {
32       OEAtomBase atom = aiter.next();
33       ligandEnergy += lpot.getItem(atom.GetIdx()) * atom.GetPartialCharge();
34     }
35     ligandEnergy *= 0.5;
36
37     OEFloatArray cpot = new OEFloatArray(cmplx.GetMaxAtomIdx());
38     zap.SetMolecule(cmplx);
39     zap.CalcAtomPotentials(cpot.ptrCast());
40     double cmplxEnergy = 0.0;
41     aiter = cmplx.GetAtoms();
42     while (aiter.hasNext()) {
43       OEAtomBase atom = aiter.next();
44       cmplxEnergy += cpot.getItem(atom.GetIdx()) * atom.GetPartialCharge();
45     }
46     cmplxEnergy *= 0.5;
47
48     double energy = cmplxEnergy - ligandEnergy - proteinEnergy;
49     float time = stopwatch.Elapsed();
50
51     if (zap.IsFocusTargetSet())
52       System.out.println("Yes\t\t" + (float) energy + "\t" + time);
53     else
54       System.out.println("No\t\t" + (float) energy + "\t" + time);
55
56   }
57
58   public static void main(String argv[]) {
59     if (argv.length != 2) {
60       System.err.println("usage: ZapFocussing <protein> <ligand>");
61       System.exit(1);
62     }
63
64     oemolistream ifs = new oemolistream();
65     if (!ifs.open(argv[0])) {
66       System.err.println("Unable to open file for reading: " + argv[0]);
67       System.exit(1);
68     }
69     OEGraphMol protein = new OEGraphMol();
70     oechem.OEReadMolecule(ifs, protein);
71
72     oechem.OEAssignBondiVdWRadii(protein);
73     oechem.OEMMFFAtomTypes(protein);
74     oechem.OEMMFF94PartialCharges(protein);
75
76     if (!ifs.open(argv[1])) {
77       System.err.println("Unable to open file for reading: " + argv[1]);
78       System.exit(1);
79     }
80     OEGraphMol ligand = new OEGraphMol();
81     oechem.OEReadMolecule(ifs, ligand);
82
83     oechem.OEAssignBondiVdWRadii(ligand);
84     oechem.OEMMFFAtomTypes(ligand);
85     oechem.OEMMFF94PartialCharges(ligand);
86
87     OEGraphMol cmplx = new OEGraphMol(protein);
88     oechem.OEAddMols(cmplx, ligand);
89
90     float epsin = 1.0f;
91     float spacing = 0.5f;
92     OEZap zap = new OEZap();
93     zap.SetInnerDielectric(epsin);
94     zap.SetGridSpacing(spacing);
95
96     System.out.println("\n Binding Energy and Wall Clock Time for "
97         + protein.GetTitle() + " and " + ligand.GetTitle());
98     System.out.println("Focussed?\tEnergy(kT)\tTime(s)");
99
100     CalcBindingEnergy(zap, protein, ligand, cmplx);
101     zap.SetFocusTarget(ligand);
102     CalcBindingEnergy(zap, protein, ligand, cmplx);
103
104     ifs.close();
105   }
106 }

Listing:3.8 ZAP Bind Example