Skip to content

Bug in conversion units of speed #5051

@raulloiscuns

Description

@raulloiscuns

Expected behavior

When using MDAnalysis.units.convert to transform between different speed units, such as going from A/fs to A/ps, the conversion factor should be 1000 (and likewise for other conversion).

Actual behavior

The unit conversions that involve conversion factors that deal with time units in the denominator (e.g A/ps to A/fs, A/ms to A/ps, ...) all yield the inverse of the correct conversion factor.

Code to reproduce the behavior

import MDAnalysis as mda
print(mda.units.convert(1, "A/fs", "A/ps")) # Gives 1e-3, should be 1e3

# The conversion between time and inverse time is inconsistent
# These yield the same number, and should be reciprocals

print(mda.units.convert(1, "fs", "ps"))
print(mda.units.convert(1, "A/fs", "A/ps"))

Current version of MDAnalysis

  • MDAnalysis version 2.9.0
  • Python 3.12.9
  • Linux OS

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions