6. Calculating shape characteristics

While most functionality in the Shape Toolkit involves comparison of pairs of molecules, there are a few fundamental properties that can be calculated for a single molecule. All of these calculations are done using the same basic Gaussian description of a molecule as described above.

The simplest property to calculate is volume, using OECalcVolume (section .

float vol = OECalcVolume(mol);

Listing:6.1

Note that in general Shape is a heavy-atom property and as such hydrogens are ignored by default in most Shape toolkit functions. To calculate the volume including hydrogens:

float vol = OECalcVolume(mol, true);

Listing:6.2

In addition to simple volume calculations, the steric multipoles of a molecule can also be calculated. See section .

float [] smult = new float[14];
oeshape.OECalcShapeMultipoles(mol, smult);

Listing:6.3

This next example demonstrates the calculation of volume and shape multipoles.

 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 ShapeProps {
10   public static void main(String[] args) {
11     if (args.length!=1) {
12       System.out.println("ShapeProps <infile>");
13       System.exit(0);
14     }
15
16     oemolistream ifs = new oemolistream(args[0]);
17
18     OEGraphMol mol = new OEGraphMol();
19
20     while (oechem.OEReadMolecule(ifs,mol)) {
21       System.out.println("              Title: "+mol.GetTitle());
22       System.out.println("             Volume: "+oeshape.OECalcVolume(mol));
23       System.out.println("Volume: (without H): "+
24                          oeshape.OECalcVolume(mol, false));
25
26       float [] smult = new float[14];
27       oeshape.OECalcShapeMultipoles(mol, smult);
28
29       System.out.println("  Steric multipoles:");
30       System.out.println("           monopole: "+smult[0]);
31       System.out.println("        quadrupoles: "+
32                          smult[1]+" "+smult[2]+" "+smult[3]);
33       System.out.println("          octopoles:");
34       System.out.println("                xxx: "+smult[4]+
35                          " yyy: "+smult[5]+" zzz: "+smult[6]);
36       System.out.println("                xxy: "+smult[7]+
37                          " xxz: "+smult[8]+" yyx: "+smult[9]);
38       System.out.println("                yyz: "+smult[10]+
39                          " zzx: "+smult[11]+" zzy: "+smult[12]);
40       System.out.println("                xyz: "+smult[13]);
41
42       System.out.println("");
43     }
44   }
45 }
46
47

Listing:6.4 Calculating shape properties.