openforcefield / openff-qcsubmit

Automated tools for submitting molecules to QCFractal
https://openff-qcsubmit.readthedocs.io/en/latest/index.html
MIT License
26 stars 4 forks source link

Only call `Molecule.from_openff_molecule` if 'attributes' not present in `Dataset.add_molecule` kwargs #183

Closed dotsdl closed 2 years ago

dotsdl commented 2 years ago

Currently, we observe failures when calling Dataset.add_molecule when feeding in molecule=None, whereas this was permitted previously.

This appears due to the use of kwargs.pop, with MoleculeAttributes.from_openff_molecule(molecule=molecule) as the default value. This gets called even if 'attributes' is present as a key in the dictionary. This PR separates these operations to avoid this call.

Status

dotsdl commented 2 years ago

@jthorton this is currently blocking qca-dataset-submission validation. I will temporarily change validation there to use this branch instead.

codecov[bot] commented 2 years ago

Codecov Report

Merging #183 (4005917) into main (9849a0a) will increase coverage by 0.00%. The diff coverage is 100.00%.

jthorton commented 2 years ago

@dotsdl Thanks for fixing this I did not realise that the default statements were evaluated as well Ill add a test to ensure I don't break this again and then merge!