Skip to content

Added support for NNP property (gap) prediction#73

Open
themonkifier wants to merge 5 commits intoFLASK-LLNL:mainfrom
themonkifier:main
Open

Added support for NNP property (gap) prediction#73
themonkifier wants to merge 5 commits intoFLASK-LLNL:mainfrom
themonkifier:main

Conversation

@themonkifier
Copy link
Copy Markdown

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.

@bvanessen
Copy link
Copy Markdown
Contributor

@themonkifier can you please rebase this on the head of main.

@themonkifier
Copy link
Copy Markdown
Author

@bvanessen done.

Comment on lines +232 to +247
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
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you switch to Google-style docstring. Nearly all of the documentation is in Google-style

Comment thread charge/servers/molecular_property_utils.py Outdated
themonkifier and others added 2 commits December 15, 2025 22:47
Co-authored-by: Shehtab Zaman <szaman5@binghamton.edu>
Comment thread charge/servers/nnp_predictor.py Outdated
Comment on lines +86 to +92
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"))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't hard-code the location of the models, using an environment variable could be an option.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in not hardcoding that the models come use the from_pretrained constructor?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@themonkifier @szaman19 We definitely don't want to do that each time.

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

Successfully merging this pull request may close these issues.

3 participants