Subsections

2.4 Storage

   

2.4.1 Formats

   OESpicoli supports the following storage formats:
(.srf)
Old GRASP format
(.oesrf)
OpenEye format based upon tagged binary files

The GRASP format is provided for backwards compatibility with older visualization programs. There were byte ordering issues with the format so OpenEye developed a more flexible format based upon the tagged binary IO available in OESystem.

2.4.2 Attached to Molecules

   The OpenEye format allows surfaces to be attached to molecules and then written out to OEBinary (.oeb) files. A visualizer can then read in the molecule and surface without any other means of making the association.

To do this, the binary writers inside OESystem need to be initialized to handle surfaces. Listing 2.5 demonstrates how to properly attach surfaces to molecules.

oemolostream ofs;
if (!ofs.open(fname))
  OEThrow.Fatal("Unable to open file: %s", fname);
OEInitSurfaceHandlers(ofs);

OEGraphMol mol;
// Read a molecule into mol
OEAssignBondiVdWRadii(mol);

OESurface surf;
OEMakeMolecularSurface(surf, mol);
mol.SetData<OESurface>("surface", surf);

OEWriteMolecule(ofs, mol);

Listing:2.5 Attaching surfaces to molecules