Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package/MDAnalysis/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link

Copilot AI Jan 26, 2026

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^-27 kg 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 of 1.660538921 × 10^-27 kg, 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.

Suggested change
mass u :math:`1.66053906660 \times 10^{-27}` kg
mass u :math:`1.660538921 \times 10^{-27}` kg

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jan 26, 2026

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 the corresponding MDANALYSIS_BASE_UNITS dictionary (line 404-411) does not include a "mass" entry with "u" as the base unit. For consistency, a "mass": "u" entry should be added to the MDANALYSIS_BASE_UNITS dictionary.

Suggested change
mass u :math:`1.66053906660 \times 10^{-27}` kg

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jan 26, 2026

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 uses AI. Check for mistakes.
Copy link

Copilot AI Jan 26, 2026

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.

Copilot uses AI. Check for mistakes.
=========== ============== ===============================================

Implementation notes
Expand Down
Loading