-
Notifications
You must be signed in to change notification settings - Fork 830
Inserted the unit of Mass #5214
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -47,6 +47,7 @@ | |||
| charge :math:`e` :math:`1.602176565 \times 10^{-19}` As | ||||
| force kJ/(mol·Å) :math:`1.66053892103219 \times 10^{-11}` J/m | ||||
| speed Å/ps :math:`100` m/s | ||||
| mass u :math:`1.66053906660 \times 10^{-27}` kg | ||||
|
||||
| mass u :math:`1.66053906660 \times 10^{-27}` kg |
Copilot
AI
Jan 26, 2026
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 documentation table now includes a mass entry, but no massUnit_factor dictionary is defined in the code (similar to lengthUnit_factor, timeUnit_factor, etc.), and mass is not added to the conversion_factor dictionary (lines 384-392). If mass unit conversions are intended to be supported, these need to be added. If mass conversions are not needed, this is acceptable, but the implementation is incomplete for full mass unit support.
Copilot
AI
Jan 26, 2026
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 test file testsuite/MDAnalysisTests/utils/test_units.py contains a TestBaseUnits class that tests the MDANALYSIS_BASE_UNITS dictionary. The reference dictionary in the test (lines 177-184) does not include "mass", so it will need to be updated to include "mass": "u" once the MDANALYSIS_BASE_UNITS dictionary is updated in the main code.
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 value
1.66053906660 × 10^-27kg appears to be from CODATA 2018. However, the codebase explicitly states that physical constants are taken from CODATA 2010 (line 196). For consistency with other constants in the file (e.g.,N_Avogadro = 6.02214129e23), the mass value should use the CODATA 2010 value of1.660538921 × 10^-27kg, which is also what was suggested in issue #3944. The atomic mass unit is related to Avogadro's number by the relationship: 1 u = 1 g/mol / N_A = 1e-3 kg / 6.02214129e23 = 1.660538921... × 10^-27 kg.