OEWriteMolecule

unsigned int OEWriteMolecule(oemolostream &ofs, OEGraphMol &mol)
unsigned int OEWriteMolecule(oemolostream &ofs, OEMol &mol)
unsigned int OEWriteMolecule(oemolostream &ofs, OEQMol &mol)

unsigned int OEWriteMolecule(oemolothread &ofs, OEMolBase &mol)
unsigned int OEWriteMolecule(oemolothread &ofs, OEMCMolBase &mol)
unsigned int OEWriteMolecule(oemolothread &ofs, OEQMolBase &mol)

These functions provide high-level file format writers for multiple file formats. These functions are built on top of OEChem TK’s low-level file format writers and may modify the molecule by automatically invoking the appropriate perception routines (aromaticity, atom typing, chirality perception, residue perception, etc…) as required by the selected output format. This greatly simplifies the task of writing molecules to a stream, but may provide less control than calling the lower-level functions directly.

There are a parallel set of OEWriteConstMolecule functions which write identical output without modifying the given molecule. These const functions will operate on a copy of the molecule if additional perception is required.

All of the overloads of OEWriteMolecule functions return an error code from the OEWriteMolReturnCode namespace. A return code of 0 or OEWriteMolReturnCode.Success indicates the write had no problems.

ofs

The output stream into which the molecule will be written.

The file format controlled by the format field of the oemolostream which may be set and retrieved using the methods oemolstreambase.SetFormat, and oemolstreambase.GetFormat respectively.

Additionally, the OEWriteMolecule functions provide some level of control over the processing applied to a molecule prior to writing using OEChem TK’s file format flavor mechanism. Each output molecule stream maintains an independent ‘flavor’ value for each output file format that can be specified by oemolstreambase.SetFlavor. These ‘flavors’ are unsigned integer values that are the combination of bit patterns specified by the OEOFlavor namespace. The interpretation of each bit in a flavor depends upon the output file format to which it refers, and enables or disables processing associated with writing that output file format.

mol

The molecule that is written into the stream.

See also