Log charge provenance once per unique molecule#1488
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1488 +/- ##
==========================================
- Coverage 94.07% 94.05% -0.03%
==========================================
Files 73 73
Lines 6045 6056 +11
==========================================
+ Hits 5687 5696 +9
- Misses 358 360 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| elif type(key) is ChargeModelTopologyKey: | ||
| logger.info( | ||
| "Charge section ChargeIncrementModel, using charge method " | ||
| f"{key.partial_charge_method}, " | ||
| f"applied to molecule with InChI {inchi}", | ||
| ) | ||
|
|
||
| elif type(key) is ChargeIncrementTopologyKey: | ||
| # here is where the individual increments could be logged at creation time, but they're | ||
| # also logged in _get_charges | ||
| pass | ||
|
|
There was a problem hiding this comment.
This is a subtle behavior change.
Previously, there was logging for the charge method applied to the whole molecule (partial_charge_method in the SMIRNOFF data and API) and then also each individual charge increment. Each of these are done on a "per-atom" view, if repetitive, same as how other charge methods were logged before these changes.
Taking a "per-molecule" view works nicely for other methods (no need to log ChargeIncrementModelHandler.partial_charge_method but doesn't work for each individual charge increment (i.e. BCC). There's probably a way to refactor all of this to cater to that detail, but I don't think it's trivial. Given that ChargeIncrementModel is not actually used in production, and there aren't plans to do so, I'm inclined to not put that effort into this change.
Closes #1484
Closes #1483
(I found this was easier to make these two changes in one go, but I can refactor it into separate changes if desired)
Description
With these changes:
Molecule.to_inchifailures are handled with a wide netlogging.INFOHere is an example of it in use, adopting from others' code
I have not done it yet, but, in principle, a large solvated protein-ligand system may have its entire charge provenance logged with as few as 5 lines i the log
Checklist