Avogadro2 (v1.93) is doing a great job of perceiving bonds and bond orders (currently in structures read in from Gromacs .gro files containing no bond information at all) using Extensions/Open Babel/Perceive Bonds. How do I do this from a python workflow with either Avogadro itself or directly in OpenBabel? I can’t seem to find any commands/methods that do this. How does Avogadro do it? Thanks for any direction.
The easiest would be with Open Babel in Python (e.g. Pybel).
from openbabel import pybel
mol = next(pybel.readfile('xyz', filename)) # readfile returns an iterator
mol.OBMol.ConnectTheDots() # perceives bonding between atoms
mol.OBMol.PerceiveBondOrders() # guesstimates bond orders
My group is working on an improved ML-based bond perception code - hopefully we can release that soon… it won’t depend (much) on the underlying toolkit.
1 Like
Thanks very much for those pointers and hats off to whomever came up with the method name “ConnectThe Dots”.