Hi Geoff and Ben,

Thanks for the comments! Yes, I fully agree now that my problem is about bond
perception, not SMARTS -- I was just describing the symptoms which happened
during SMARTS matching.

I would second Ben's suggestion on making ConnectTheDots() more versatile. I
understand that having a good default for sanitation is important to make sure
that the parsing of PDB and other formats can be done robustly, but
unconventional bonding is, as Geoff commented, so common in chemistry that it's
probably worthwhile of being considered in ConnectTheDots() via an optional
flag.

In any case, thanks for all the help!

Best regards,

Peng

On 10/25/2017 11:35 AM, Benjamin Bucior wrote:
I've been working on another system where oxygen frequently exceeds a standard 
valency of two (organometallics).  So far, I've been getting around the 
automatic bond deletion in an older version of Open Babel by modifying the 
element.txt file.  By changing the MaxBnd column for oxygen to a higher value 
(e.g. 6), the oxygen atom retains the extra bonds.  But that approach obviously 
causes other problems, including representation of hydrogens.

Would it be helpful to have an option in ConnectTheDots to manually disable the max 
valence cleanup step?  For example, rdkit 
<http://www.rdkit.org/docs/RDKit_Book.html#molecular-sanitization> has flags to 
selectively disable certain aspects of molecular sanitation.

Another question: if you manually build a hydronium ion bond-by-bond, what's 
the proper way to set the charge for SMILES export?  OBAtom::SetFormalCharge?  
Something with SetTotalCharge?  Is there a way to do this automatically on the 
molecule?

Thanks!
Ben

On Wed, Oct 25, 2017 at 9:51 AM, Geoffrey Hutchison <geoff.hutchi...@gmail.com 
<mailto:geoff.hutchi...@gmail.com>> wrote:

    > 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 
<mailto:OpenBabel-discuss@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/openbabel-discuss 
<https://lists.sourceforge.net/lists/listinfo/openbabel-discuss>



------------------------------------------------------------------------------
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