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.
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);