On 12/15/11 10:03 AM, David Lonie wrote: > On Thu, Dec 15, 2011 at 12:48 PM, David Lonie<lonieda...@gmail.com> wrote: >> This seems like something that someone may have encountered before, so >> I figured I'd ask before rolling my own solution/attempting to patch >> the cml reader/writer. > > small update: > After skimming the spec, It looks like cml doesn't have a way to > specify conformers, either. I suppose a separate cml string for each > conformer would be the best solution I can think of at this point.
This may sound hokey, but if you want to "roll your own," storing canonical SMILES with X/Y/Z coordinates is very easy to do, and very easy to parse. It's also very compact and compresses about 10- or 20-to-1 with gzip. You can store multiple conformers by just appending them to the line with a tab separator. The code is almost there already. echo "CCO" | babel --gen2D -i smi -o can -xx prints out the X/Y coordinates in canonical order. The code to do this is about 15 lines of C++ in smilesformat.cpp (look for IsOption("x")). You can copy the code and just add the Z coordinate and it would do what you want. Parsing is pretty simple too because the coordinates are in the same order as the atoms. If you're interested, I can send you a function that parses a string of X/Y coordinates into an OBMol object - it's about 50 lines of C++ code and includes a certain amount of error checking. Again, all you'd have to change is to add the Z coordinate. Like I said, it's a bit hokey and certainly not a supported format, but it's very effective. (I wonder ... would "SMILES-with-coordinates" be an interesting addition to the SMILES parser? The code is all written.) Craig ------------------------------------------------------------------------------ 10 Tips for Better Server Consolidation Server virtualization is being driven by many needs. But none more important than the need to reduce IT complexity while improving strategic productivity. Learn More! http://www.accelacomm.com/jaw/sdnl/114/51507609/ _______________________________________________ OpenBabel-Devel mailing list OpenBabel-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-devel