SiMolecule / centres

Perception and labelling of stereogenic centres in chemical structures
BSD 2-Clause "Simplified" License
16 stars 3 forks source link

Atropisomeric issue: result based on order of bonds from atom in BaseMol #13

Closed iclkevin closed 9 months ago

iclkevin commented 9 months ago

I believe I have found an issue with the Atropisomeric class. I randomly receive a M or P in return, it is never consistent. I have double checked that the foci and neighbors and config are all consistent. I can also verify the issue by adding a "Collections.shuffle()" of the bonds returned in the BaseMol.getBonds() function. If I enforce a certain order of the bonds in this function, I will receive a consistent result, but not always the correct one.

johnmay commented 9 months ago

Do you have an example molecule. The CDK tests use BiNAP and adding the following:

@Override
public Iterable<IBond> getBonds(IAtom atom)
{
  List<IBond> connectedBondsList = new ArrayList<>(base.getConnectedBondsList(atom));
  Collections.shuffle(connectedBondsList);
  return connectedBondsList;
}

Running TestAtropisomers 1000 times on M/P versions I do not see any wobble.

iclkevin commented 9 months ago

My apologies, this was a dumb mistake on my side. I spelled a variable wrong and was referencing the wrong atom copies. Thank you for double checking the Atropisomeric class.

johnmay commented 9 months ago

No worries, did have this issue before so thought it was possible.