Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implicit and explicit H's #25

Open
EBjerrum opened this issue Jul 27, 2024 · 5 comments
Open

Implicit and explicit H's #25

EBjerrum opened this issue Jul 27, 2024 · 5 comments

Comments

@EBjerrum
Copy link
Owner

There's no way to correct or set explicit H's. This can disturb kekulization in e.g. in aromatic heterocycles.

@jacktday
Copy link
Contributor

jacktday commented Dec 8, 2024

I was working on some code to automatically fix the hydrogens and atom valence. Unfortunately, it was really unreliable and I never full figured out how rdkit calculates the implicit valence.

@jacktday
Copy link
Contributor

jacktday commented Dec 8, 2024

There is a dirty hack where you export to smiles and then reimport it. Then rdkit will fix the hydrogens for you. I don’t really like it, but it works.

@EBjerrum
Copy link
Owner Author

EBjerrum commented Dec 9, 2024

I wouldn't like that hack either. The goal is to stay as true to the molecular graph as possible, so having a round-trip around SMILES with the potential information loss that can occur is not the way forward. The explicit/implicit/actual_H_atom_on_Graph is very confusing indeed and is some technical debt that would probably be designed differently if it was reimplemented today. We rather need a method to edit these counts via the interface so that the graph can be manipulated properly.

@jacktday
Copy link
Contributor

jacktday commented Dec 9, 2024

The more I look into solutions for this the more attractive it becomes to write a new library. Rdkit is some pretty nasty code.

There are also a lot of edge cases around aromaticity. This makes it really hard to determine how to fix the valence. You need to be able aware of the relationship of atoms to rings. Which I don’t think is available in rdkit.

@jacktday
Copy link
Contributor

jacktday commented Dec 10, 2024

This is still a work in progress, but it starts to simplify templates. It doesn't actually fix the hydrogen issue yet.

https://github.com/jacktday/rdeditor/tree/custom_reactions_for_better_templates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants