gcorso / DiffDock

Implementation of DiffDock: Diffusion Steps, Twists, and Turns for Molecular Docking
https://arxiv.org/abs/2210.01776
MIT License
976 stars 238 forks source link

Fix range error due to inconsistent rotable_bonds. #220

Closed Nobody-Zhang closed 2 months ago

Nobody-Zhang commented 2 months ago
from datasets.pdbbind import PDBBind
dataset = PDBBind(root='data/samples', split_path='data/samples/samples_test', keep_original=True, require_ligand=True)

When using PDBBind Datasets, it could cause some problems just like:

image

Skipping 4qw4 ligand because of the error:
Range Error
    lAtomId
    Violation occurred on line 618 in file Code/GraphMol/MolTransforms/MolTransforms.cpp
    Failed Expression: 79 < 52
    RDKIT: 2022.09.5
    BOOST: 1_78

After checking process_mols.py, it is probably due to the inconsistency between mol_maybe_noh and mol_rdkit/mol.

For example, it is probable that mol removes more Hs than mol_maybe_noh due to 'AllChem.RemoveAllHs' function.

If still using rotable_bonds generated by mol_maybe_noh, there could be some bounds that do not included in mol.

And that's the reason why optimize_rotatable_bonds function could cause the error above.

By changing rotable_bounds, the error is fixed.

image

Nobody-Zhang commented 2 months ago

@gcorso @amorehead @jsilter @duerrsimon

jsilter commented 2 months ago

I patched this in a different way but the bug should be fixed in v1.1.2