duartegroup / autodE

automated reaction profile generation
https://duartegroup.github.io/autodE/
MIT License
171 stars 52 forks source link

Mismatch in atom ordering if user overrides conformer generation method #264

Open aleksy-k opened 1 year ago

aleksy-k commented 1 year ago

Describe the bug

For some molecules with explict hydrogens in their SMILES (e.g. O=C1C2=C(OC)C=C(OC)C=C2CC3(SCCCS3)/C=C/C=C[C@]4([H])C@(O4)CC@@HO1 ) there is a mismatch in atom ordering if you try to force RDKit conformer generation.

Raises: ValueError( "Cannot alter the atomic symbols of a " "conformer. Parent molecule was different: " f"{atom.label} != {parent_atom.label}"

Would be good if there is an argument for the user to override RDKit vs autodE automatic conformer generation method choice. Additionally not sure why rdkit_conf_gen_is_fine is not private.

To Reproduce

import autode as ade 
from rdkit.Chem import rdmolfiles
from rdkit.Chem import rdmolops

smiles = 'O=C1C2=C(OC)C=C(OC)C=C2CC3(SCCCS3)/C=C/C=C\[C@]4([H])[C@]([H])(O4)C[C@@H](C)O1'
molecule = ade.Molecule(smiles=smiles)
molecule.rdkit_conf_gen_is_fine = True
molecule.rdkit_mol_obj = rdmolops.AddHs(rdmolfiles.MolFromSmiles(smiles))

molecule.populate_conformers(n_confs=300)

Expected behavior

Environment

t-young31 commented 1 year ago

Thanks for raising this – certainly a bug. rdkit_conf_gen_is_fine is public so autodE conformer generation can be used when RDKit also works (docs) and there's no test that it works the other way round.

Would be a nice feature to be able to override the rather opinionated choices. I'd vote having Config.molecule_conformer_method as an enum of {Default, RDKit, autodE} – what do you think?