Dear all,
As a new Babel-user first of all I'd like to thank you for this great
software !!
My question: what is the correct way (in c++) to generate an OBMol
object from a smiles-code ? I know how to convert smiles e.g. to inchi
directly using a conv->convert(), but I dont see yet how I can get
access to the obMol object ? My below code seems to work but leads to
a valgrind error ?
Related to this question: I searched but didnt find info on this in
http://openbabel.org/api/2.3/mainclasses.shtml. Are there other places
where I should look for answers to similar questions ?
regards,
Rafel
#include <iostream>
#include <openbabel/obconversion.h>
#include <openbabel/mol.h>
int main() {
OpenBabel::OBMol *obMol = new OpenBabel::OBMol();
// setup conversion from smiles into inchi-key
OpenBabel::OBConversion conv(NULL,&std::cout);
conv.SetInAndOutFormats("SMI","inchi");
conv.AddOption("K",OpenBabel::OBConversion::OUTOPTIONS);
// read methane, this statement raises valgrind error 'conditional jump ..'
conv.ReadString(obMol, "C");
// output inchikey, this works
conv.Write(obMol);
delete obMol;
}
valgrind error:
==13841== Conditional jump or move depends on uninitialised value(s)
==13841== at 0x5D154E0: inflateReset2 (in
/lib/x86_64-linux-gnu/libz.so.1.2.3.4)
==13841== by 0x5D155D8: inflateInit2_ (in
/lib/x86_64-linux-gnu/libz.so.1.2.3.4)
==13841== by 0x4F3CEFC: ??? (in /usr/lib/libopenbabel.so.4.0.0)
==13841== by 0x4F3D078: ??? (in /usr/lib/libopenbabel.so.4.0.0)
==13841== by 0x4F3D1A9: ??? (in /usr/lib/libopenbabel.so.4.0.0)
==13841== by 0x4F35398:
OpenBabel::OBConversion::Read(OpenBabel::OBBase*, std::istream*) (in
/usr/lib/libopenbabel.so.4.0.0)
==13841== by 0x4F35953:
OpenBabel::OBConversion::ReadString(OpenBabel::OBBase*, std::string) (in
/usr/lib/libopenbabel.so.4.0.0)
==13841== by 0x400F8B: main (test.cpp:20)
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss