[Open Babel] Creating an OBMol by hand in C++

2014-05-07 Thread Nicolas Cheron
Dear all, I am working with a program (in C++) which has its own way of dealing with atoms and molecules. I would like to use the OpenBabel library to assign types to atoms. For now, when I need to do it I write a .xyz file and then read it in an OBMol object and assign the types. This works,

Re: [Open Babel] Creating an OBMol by hand in C++

2014-05-07 Thread David Hall
Never written something like this, but briefly looking at some code in openbabel for reading molecules, you should do atom = obMol.NewAtom(); At the beginning of each loop. Your code looks like it is just due referencing an unset pointer, so no surprise it segfaults. You maybe also have to do