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, but I am not happy because it could be more efficient. Thus, I would like to create the OBMol object by hand. I was thinking of something such as: struct Atom{ float x; float y; float z; char Type[4]; // Element name (H, C, N, O...). char PotentialType[3]; // Atom type for the scoring function. }; struct Molecule{ Atom atom[150]; int size; }; ///////////// OpenBabel::OBMol obMol; OpenBabel::OBAtom *atom; for (int i=0; i<molecule.size ; i++ ) { atom->SetVector(molecule.atom[i].x, molecule.atom[i].y, molecule.atom[i].z); atom->SetType(molecule.atom[i].Type); obMol.InsertAtom(*atom); } obMol.ConnectTheDots(); When I am doing this the code compiles but crashes (Segmentation fault) and I have not been able to find what is going wrong. I have also tried with SetVector(const vector3 & v ) but it is the same. Does anyone have a clue of how I can create this object atom by atom? Thank you Nicolas ------------------------------------------------------------------------------ Is your legacy SCM system holding you back? Join Perforce May 7 to find out: • 3 signs your SCM is hindering your productivity • Requirements for releasing software faster • Expert tips and advice for migrating your SCM now http://p.sf.net/sfu/perforce _______________________________________________ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss