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 .

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:

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 .

smult = OECalcShapeMultipoles(mol)

Listing:6.3

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

 1 #!/usr/bin/env python
 2 # Copyright (C) 2005,2006 OpenEye Scientific Software, Inc.
 3 import os, sys
 4 from openeye.oechem import *
 5 from openeye.oeshape import *
 6
 7 if len(sys.argv)!=2:
 8     OEThrow.Usage("shapeprops.py <infile>")
 9
10 ifs = oemolistream(sys.argv[1])
11
12 mol=OEGraphMol()
13 while OEReadMolecule(ifs, mol):
14     OEThrow.Info("              Title: %s"%mol.GetTitle())
15     OEThrow.Info("             Volume: %8.2f"%OECalcVolume(mol))
16     OEThrow.Info("Volume: (without H): %8.2f\n"%OECalcVolume(mol, False))
17
18     smult=OECalcShapeMultipoles(mol)
19
20     OEThrow.Info("  Steric multipoles:")
21     OEThrow.Info("           monopole: %8.2f"%smult[0])
22     OEThrow.Info("        quadrupoles: %8.2f %8.2f %8.2f"%
23                  (smult[1],smult[2],smult[3]))
24     OEThrow.Info("          octopoles:")
25     OEThrow.Info("                xxx: %8.2f  yyy: %8.2f  zzz: %8.2f"%
26                  (smult[4],smult[5],smult[6]))
27     OEThrow.Info("                xxy: %8.2f  xxz: %8.2f  yyx: %8.2f"%
28                  (smult[7],smult[8],smult[9]))
29     OEThrow.Info("                yyz: %8.2f  zzx: %8.2f  zzy: %8.2f"%
30                  (smult[10],smult[11],smult[12]))
31     OEThrow.Info("                xyz: %8.2f\n"%smult[13])
32
33
34

Listing:6.4 Calculating shape properties.