Hello,

I would like to convert a file File.xyz into a SMILES string in a C++
program. I have done the following (I am simplifying):

ifstream input("File.xyz");
ostringstream streamOBabel;
OpenBabel::OBConversion conv(&input, &streamOBabel);
conv.SetInAndOutFormats("XYZ","SMI");
conv.Convert();
string smilesString = streamOBabel.str();
cout << smilesString << endl;

I don't know if it is the best way, but it works. However, smilesString
contains the SMILES string and then the title of File.xyz (I call title what
is written in the second line of File.xyz, after the number of atoms in the
molecule and before the cartesion coordinates). I would like to keep only
the SMILES string. Is there a way to do it, with some options?

Thank you for your help.

Nicolas



--
View this message in context: 
http://forums.openbabel.org/Converting-xyz-file-to-a-SMILES-string-in-C-tp4657332.html
Sent from the General discussion mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to