> atom by atom, and then call `ConnectTheDots()` to add bonds

Not surprisingly, for a general-purpose library, Open Babel has a 
general-purpose bond perception algorithm. As you note, it will ensure oxygen 
atoms have a maximum of two bonds. This ensures PDB and other crystallography 
files with disordered atoms still retain “normal” valency.

> How should I then approach this SMARTS matching problem? My system has regular
> water molecules and I have only coordinates and atomic numbers, so a priori I
> don't know which oxygen atoms belong to H3O+ and which hydrogen atoms are
> bridging hydrogen in H5O2+.

I would say *that* is your key problem, not SMARTS. You can certainly adapt the 
ConnectTheDots code - it simply loops through all atoms and checks where the 
distance between atoms is smaller than the sum of the covalent radii. Those are 
“bonds.” (OB’s code will sort along the Z axis and adds a few additional checks 
for performance reasons, but that’s the basics of the algorithm.)

You’ll need a special-purpose bond detection algorithm for your needs. You 
might find larger hydrogen-bonded clusters beyond H5O2, for example. I’ve found 
systems with unusual bond distances. That’s part of chemistry.

-Geoff
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to