Comparing "[H]" to itself with the UniversalIsomorphismTester.getIsomorphMaps(mol, mol), followed by conversion to atommaps (makeAtomsMapsOfBondsMaps) gives an empty list.
I understand where it's coming from (there are no bonds), but this is either a documentation bug or a corner-case requiring a bug fix, because this molecule is isomorphic to itself and the Tester should yield this result.
I also have problems with comparing "diatomic" molecules to themselves, e.g. "CN".
Hi all...
these might very well simply be cases which the UIT does not address... please check the JavaDoc:
http://pele.farmbio.uu.se/nightly-1.2.3/cdk-javadoc-1.2.3/org/openscience/cdk/isomorphism/UniversalIsomorphismTester.html
The UIT basically only works with at least a few bonds... I know we, at some, point added a workaround for substructure search with just one atom... I suspect this might simply be a reincarnation of the same pattern...
Noel, next time I'll try to remember to not just read the title and the first line... :)
For single atom molecules, the main isomoprhism mehtods of the UIT should not be invoked. Rather simply loop over the target molecule atoms seeing if we can match any atom to the query atom. (This is what the SMARTS query tool does)
I've got a fix that updates getIsomorphMaps to directly match single atom queries. The return value is the same as usual but in this case, RMap refers to atom indices rather than bond indices - thus there is no need to call makeAtomsMapsOfBondsMaps. However, in the interests of generality, makeAtomsMapsOfBondsMaps is also modified to account for single atom queries. Thus the return value is the appropriate atom-atom mapping (basically, just return the input mapping). This way code for multi-atom queries is the same as for single-atom queries. Unit tests and Javadocs are updated in the patch. Needs review
Patch is meant for cdk-1.2.x
removed patch file from here and added to the patch on the patch tracker
https://sourceforge.net/tracker/index.php?func=detail&aid=2896561&group_id=20024&atid=320024
Closing since patch with the fix has been applied and pushed