Added support for NNP property (gap) prediction#73
Added support for NNP property (gap) prediction#73themonkifier wants to merge 5 commits intoFLASK-LLNL:mainfrom
Conversation
|
@themonkifier can you please rebase this on the head of main. |
|
@bvanessen done. |
| Retrieve HOMO-LUMO band gap for the molecule specified by the SMILES string, smiles. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| smiles : str | ||
| A SMILES string for the molecule of interest. | ||
|
|
||
| Returns | ||
| ------- | ||
| float | ||
| Returns float representing the HOMO-LUMO band gap of the given SMILES string. | ||
|
|
||
| Examples | ||
| -------- | ||
| >>> get_gap("O=CCOC=O") | ||
| 0.2217 |
There was a problem hiding this comment.
Can you switch to Google-style docstring. Nearly all of the documentation is in Google-style
Co-authored-by: Shehtab Zaman <szaman5@binghamton.edu>
| if _calcs["U0"] is None: | ||
| logger.info("Initializing GotenNet U0 calculator") | ||
| _calcs["U0"] = GotenNetCalculator(GotenModel.from_pretrained("QM9_small_U0")) | ||
| logger.info("Initializing GotenNet homo calculator") | ||
| _calcs["homo"] = GotenNetCalculator(GotenModel.from_pretrained("QM9_small_homo")) | ||
| logger.info("Initializing GotenNet lumo calculator") | ||
| _calcs["lumo"] = GotenNetCalculator(GotenModel.from_pretrained("QM9_small_lumo")) |
There was a problem hiding this comment.
We shouldn't hard-code the location of the models, using an environment variable could be an option.
There was a problem hiding this comment.
As in not hardcoding that the models come use the from_pretrained constructor?
There was a problem hiding this comment.
This will trigger a download if not available locally, wherever the server is run. Almost certainly, we'll have pre-trained models in a central location (especially the ones we train with our own data), so it would be better to point to a directory of trained models.
There was a problem hiding this comment.
@themonkifier @szaman19 We definitely don't want to do that each time.
I can add any of the other properties from QM9 trivially, since GotenNet has pretrained models available for all of those. I can also do density or HoF, since I have models trained on those as well. Anything else could be discussed too, training a model is pretty quick.
The added code is pretty minimal, and does not change any of the currently implemented experiments/tasks, since I'm not sure how gap would integrate into those exactly. This is more of a proof of concept than anything.