Try using OBIsomorphismMapper to find tge right mapping of atoms which will implicitly give you the right matching for bonds. For example: https://github.com/dkoes/openbabel/blob/master/tools/obrms.cpp
-Dave On Oct 14, 2018, at 4:01 AM, Naruki Yoshikawa <naruki.yoshik...@gmail.com<mailto:naruki.yoshik...@gmail.com>> wrote: Hi everyone, I'm evaluating my fragment-based coordinate generation method. I want to measure the error of bond lengths and angles, but I have a problem in getting corresponding ones from two molecules. What I want to do is like this: // mol1: ground truth loaded from SDF // mol2: predicted molecule structure loaded from SDF OBMol mol1, mol2; // Display the length of each bond for (int idx = 0; idx < mol1.NumBonds(); ++idx) { OBBond *bond1 = mol1.GetBond(idx); OBBond *bond2 = mol2.GetBond(idx); // these assertion fails assert(bond1->GetBeginAtom()->GetAtomicNum() == bond2->GetBeginAtom()->GetAtomicNum()); assert(bond1->GetEndAtom()->GetAtomicNum() == bond2->GetEndAtom()->GetAtomicNum()); cout << bond1->GetLength() << "," << bond2->GetLength() << endl; } The problem is that the bonds are not ordered properly. When I execute the code above, the assertions fail. So n-th bond in mol1 was different from n-th bond in mol2. I also have a similar problem for angles. If I can get something like "canonical order of bonds", I can compare the length of each bond correctly. However, I don't know how to do it. Does anyone have a good idea to get corresponding bonds and angles? Thanks, Naruki _______________________________________________ OpenBabel-Devel mailing list OpenBabel-Devel@lists.sourceforge.net<mailto:OpenBabel-Devel@lists.sourceforge.net> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fopenbabel-devel&data=02%7C01%7Cdkoes%40pitt.edu%7Ca4d3f190d0c74200797d08d631ab31a3%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C636751008682354300&sdata=6%2FgdvGOjbSNR5zoo20k4MPJVuZn3057ooWnoFpHo1rI%3D&reserved=0
_______________________________________________ OpenBabel-Devel mailing list OpenBabel-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-devel