Skip to content

Conversation

@GardevoirX
Copy link
Contributor

@GardevoirX GardevoirX commented Feb 4, 2026

The default unit is actually (eV/u)^(1/2) but I wrongly set it as nm/fs.

For reference, see https://ase-lib.org/ase/units.html, and also their implementation of _maxwellboltzmanndistribution https://gitlab.jsc.fz-juelich.de/kesselheim1/ase/-/blob/e240cec52abeb150b1b5cefa69888b7b60489878/ase/md/velocitydistribution.py#L14-21

Contributor (creator of pull-request) checklist

  • Tests updated (for new features and bugfixes)?
  • Documentation updated (for new features)?
  • Issue referenced (for PRs that solve an issue)?

Reviewer checklist

  • CHANGELOG updated with public API or any other important changes?

@GardevoirX GardevoirX requested a review from Luthaf February 4, 2026 14:15
Copy link
Member

@Luthaf Luthaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you also check the unit for momenta?

@GardevoirX
Copy link
Contributor Author

GardevoirX commented Feb 4, 2026

could you also check the unit for momenta?

yeah this one is correct, bascially atoms.get_momenta() / atoms.get_velocities() gives me the atomic mass in u

{"A/fs", 1e1},
{"m/s", 1e6},
{"nm/ps", 1e3},
{"(eV/u)^(1/2)", 101.80506},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dunno if this is the right place but why not

(eV/u) **0.5

Do we recognize that too? I can't remember

Copy link
Contributor Author

@GardevoirX GardevoirX Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we need a page to introduce the units that we support? Like exposing things here to users
https://github.com/metatensor/metatomic/blob/main/metatomic-torch%2Fsrc%2Fmodel.cpp#L1078-1154

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, these should be documented in https://docs.metatensor.org/metatomic/latest/torch/reference/misc.html#known-quantities-and-units for now.

(eV/u) **0.5

No, we don't recognise that for now. I don't think we ever should, although we could introduce (eV/u)^0.5 at some point. For now I think this is fine

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, these should be documented in https://docs.metatensor.org/metatomic/latest/torch/reference/misc.html#known-quantities-and-units for now.

(eV/u) **0.5

No, we don't recognise that for now. I don't think we ever should, although we could introduce (eV/u)^0.5 at some point. For now I think this is fine

Can we link this page to every page of the quantities? I did remember that we have such a table but failed to find it out... BTW we haven't update charge into this table yet

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean... we could just do an expression parser or something, there's gotta be something out there already, with sympy and even openmm taking expression strings.

The point is rather than explicitly enumerating it'd be easier to just define the operators and be done.

Copy link
Contributor Author

@GardevoirX GardevoirX Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I also thought about this a little bit, if this is possible, we can utilize the unit stored in the info of the TensorMap and do unit calculations when functions in metatensor.operations are called, which makes our tensor more tensor-like. but maybe it's just nobody want to spend time on this

Maybe opening an issue on it is the best action at this moment

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean... we could just do an expression parser or something, there's gotta be something out there already, with sympy and even openmm taking expression strings.

Yes, this is the plan. I'll open an issue

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Luthaf Luthaf merged commit 6798121 into metatensor:main Feb 5, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants