openbabel / openbabel

Open Babel is a chemical toolbox designed to speak the many languages of chemical data.
http://openbabel.org/
GNU General Public License v2.0
1.06k stars 412 forks source link

ConnectTheDots error with small bond angles #745

Open openbabel-bot opened 16 years ago

openbabel-bot commented 16 years ago

The ConnectTheDots() "cleanup" deletes too many bonds when there is a small bond angle.

In pseudocode, the broken bit of the algorithm is: WHILE (atom exceeds its maximum valence OR smallest bond angle < 45 degrees) { DELETE THE LONGEST BOND }

The documentation does not mention the minimum bond angle rule. I attach an XYZ file for a molecule that I would expect to have bonds angles less than 45 degrees, and for which ConnectTheDots() returns very strange results.

I am not sure where the 45 degree constraint comes from, so although simply removing it solves my specific problem, I am nervous suggesting this as the general solution. Perhaps some people like it? (I've not yet found a reference to it though)

However, even if consensus is that there should be a >45 degree rule, the current implementation is flawed: if the two shortest bonds from an atom are at 44 degrees to each other, the algorithm deletes all the longer bonds (longest first) before deleting the offending bond, and you end up with only one bond. This is surely not desired.

ASCII sketch of expected bonding: O-O \ / Ti /|\ Cl3

Molecule is described in http://dx.doi.org/10.1021/jp0661950

Reported by: rhw27

openbabel-bot commented 16 years ago

TiO2Cl3 molecule in XYZ format. Demonstrates error in ConnectTheDots()

Original comment by: rhw27

openbabel-bot commented 16 years ago

Logged In: YES user_id=21420 Originator: NO

The 45 degree rule comes from PDB and other files, where multiple atoms appear to indicate possible crystallography errors. I'm open to a broader suggestion of the angle issue...

You're certainly correct about the current code. It should remove short bonds, say less than 30 degrees, and then check for long bond issues.

What do you think?

Original comment by: @ghutchis