-
Notifications
You must be signed in to change notification settings - Fork 33
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
Test unit handling in GMSO for standard unit conversion utilities #747
Test unit handling in GMSO for standard unit conversion utilities #747
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #747 +/- ##
==========================================
+ Coverage 91.95% 92.04% +0.08%
==========================================
Files 67 67
Lines 6814 6873 +59
==========================================
+ Hits 6266 6326 +60
+ Misses 548 547 -1
☔ View full report in Codecov by Sentry. |
_out_parameters_and_units function
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.
I reviewed the code and have some comments/suggestions. Looks great overall! The LAMMPSUnitsSystem is quite neat. The tests for units seem to cover all new methods, but I think we should test some of them individually, just so if they fail in the future, it's easier to debug.
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.
The new changes look great! A few comments (can be discussed more tomorrow) about where some methods should stay (in or out of the LAMMPS_UnitSystem) leftover print, Å, etc.,. Also, we might want to add a bit more documentation/example/tutorials about how the unit system to be used (i.e., one is assigned to the topology, but will only be used during the writing out step, and will have no effect on the current unit that the topology is using).
get_parameter_dimension(1 * u.kJ / u.mol / u.nm, "(length)") == u.nm | ||
) | ||
|
||
def test_convert_to_unit_system(self): |
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.
Desirable, but may be on a subsequent PR
# convert a whole topology to a specific unit system | ||
pass | ||
|
||
def test_generate_unit_styles(self): |
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.
Would be useful to have too, or at least show what unit systems we are currently support.
Co-authored-by: Co Quach <[email protected]>
Co-authored-by: Co Quach <[email protected]>
…aven/gmso into 742-refactor-unit-handling
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.
LGTM! I will probably merge this after all the unit tests pass
This PR looks to make a central set of utilities for handling complex unit conversions, such that a given engine or topology can ask for a unyt UnitSystem and easily return a given parameter in that style. Will be useful when trying to perform conversions for a writer that are specified in the writer argument, instead of just always assuming that a specific parameter and unit output is desired.