-
Notifications
You must be signed in to change notification settings - Fork 91
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
Simplify unit handling in some setters #1570
Conversation
def test_set_partial_charges_openmm_quantity(self, water): | ||
import openmm.unit | ||
|
||
with pytest.raises(ValueError, match="Cannot set.*openmm.unit"): | ||
water.atoms[2].partial_charge = 0.0 * openmm.unit.elementary_charge | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be added back (I forget why I removed it) but the error message will probably be difference since this is no longer being handled internally.
6566b08
to
4e58a81
Compare
Co-authored-by: Jeff Wagner <[email protected]>
4e58a81
to
a0050fe
Compare
return str(input_quantity) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😱 How... long has this been around...?
@requires_pkg("openmm") | ||
def test_set_partial_charges_openmm_quantity(self, water): | ||
import openmm.unit | ||
|
||
with pytest.raises(ValueError, match="Cannot set.*openmm.unit"): | ||
water.atoms[2].partial_charge = 0.0 * openmm.unit.elementary_charge | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC, this is no longer an error because the openmm Quantities are now valid inputs.
Thanks for the review - I'll have to look back and see why I wanted these changes in the first place and if they're still needed. |
At various points in time we've needed to bake in logic to gracefully handle similar but heterogenous inputs. Each implementation has diverged over time; this change consolidates them and funnels most of the logic to a single choke point.