franciscoadasme / chem.cr

Library for dealing with computational chemistry files
https://franciscoadasme.github.io/chem.cr/
MIT License
23 stars 1 forks source link

Topology guessing fails on molecule with a symmetric group #209

Open franciscoadasme opened 9 months ago

franciscoadasme commented 9 months ago

Topology guessing on FAD sometimes fails due to the central phosphate group being symmetrical, so the algorithm can go in the correct direction (guessing succeeds) or the opposite direction (fails) arbitrarily. The Templates::Detector#search seems to be the culprit as it only goes in one direction based on atom order (?).

structure = Chem::Structure.read spec_file("FAD.mol")
Chem::Templates.register structure

structure = Chem::Structure.read spec_file("FAD_bad_guess.mol")
structure.topology.guess_names
structure.residues[0].name # => "UNK" (detection failed)

FAD.mol.txt FAD_bad_guess.mol.txt