-
Notifications
You must be signed in to change notification settings - Fork 840
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
Fix io.cp2k.input.DataFile
#3745
Conversation
WalkthroughThe recent changes in the Changes
Poem
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (3)
Files skipped from review as they are similar to previous changes (1)
Additional comments not posted (15)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Can you please review this fix? @janosh Apologize again for the trouble. |
…or better err msg
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.
thanks for this fix. i added several new tests and made the DataFile.from_file
an abstractmehod
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.
Actionable comments posted: 4
Thanks for reviewing and making it a real "fix" 😄 |
@@ -191,7 +190,7 @@ def test_assign_partial_charges(mol_files): | |||
openff_mol, atom_map = add_conformer(openff_mol, geometry) | |||
partial_charges = np.load(mol_files["CCO_charges"]) | |||
openff_mol = assign_partial_charges(openff_mol, atom_map, "am1bcc", partial_charges) | |||
assert np.allclose(openff_mol.partial_charges.magnitude, partial_charges) | |||
assert_allclose(openff_mol.partial_charges.magnitude, partial_charges) |
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.
Wondering what is the advantage here? (thought the original syntax is more consistent with the assert condition
syntax)
From the assert_allclose documentation, these two seems equivalent:
The test is equivalent to allclose(actual, desired, rtol, atol) (note that allclose has different default values). It compares the difference between actual and desired to atol + rtol * abs(desired).
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.
compare the error messages when they each fail. assert_allclose
gives a much more informative message
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.
Thanks for the input! Appreciate that.
Summary
Fixed a flawed change in
io.cp2k.input.DataFile.from_file
made by me in #3705, discussed in #3705 (comment). Also added comment to prevent this from happening again.