Skip to content

Commit

Permalink
Set coordination bond order to single
Browse files Browse the repository at this point in the history
  • Loading branch information
mwojcikowski committed May 9, 2018
1 parent 20d34c3 commit 8eb160d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions oddt/toolkits/extras/rdkit.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import absolute_import, print_function
from math import isnan, isinf

import rdkit
from rdkit import Chem
from rdkit.Chem import AllChem

Expand Down Expand Up @@ -55,6 +56,17 @@ def MolFromPDBBlock(molBlock,
bond.SetBondType(Chem.BondType.DOUBLE)
break

# Set metal coordination (zero order) bond orders to single
if rdkit.__version__ >= '2018.03':
for bond in mol.GetBonds():
if bond.GetBondType() == Chem.BondType.ZERO:
a1 = bond.GetBeginAtom()
a2 = bond.GetEndAtom()
if a1.GetAtomicNum() in _metals:
bond.SetBondType(Chem.BondType.SINGLE)
elif a2.GetAtomicNum() in _metals:
bond.SetBondType(Chem.BondType.SINGLE)

if sanitize:
result = Chem.SanitizeMol(mol)
if result != 0:
Expand Down

0 comments on commit 8eb160d

Please sign in to comment.